A custom response appears within the metadata.custom section of the JSON response. An example of a cleanly installed service is the vtiServer configuration, defined within the slingshot-context.xml file.
The customResponses property defines a map of JSON key to custom response bean within the SlingshotDocLibCustomerResponse bean definition.
Default slingshotDocLibCustomResponse bean configuration:
<beanid="slingshotDocLibCustomResponse"parent="baseJavaScriptExtension"class="org.alfresco.repo.jscript.SlingshotDocLibCustomResponse"> <property name="extensionName"> <value>slingshotDocLib</value> </property> <property name="<b>customResponses</b>"> <map> <entry key="vtiServer"> <ref bean="doclibCustomVtiServer"/> </entry> </map> </property> </bean>
The bean for returning the vtiServer configuration is defined as:
<beanid="doclibCustomVtiServer"class="org.alfresco.repo.jscript.app.VtiServerCustomResponse"> <property name="scriptUtils"> <ref bean="utilsScript" /> </property> <property name="sysAdminParams"> <ref bean="sysAdminParams" /> </property> <property name="port"> <value>${vti.server.external.port}</value> </property> <property name="host"> <value>${vti.server.external.host}</value> </property> </bean>
The VtiServerCustomResponse class (which implements CustomResponse) returns a Serializable object (for example a LinkedHashMap) that is serialized into the JSON response by the DocLib web scripts.
This extension point is designed to return useful information that is not specific to any node, for example, the presence of an optional module; whether a subsystem is active or not, etc.