I'm writing a WebScript in Alfresco using JS controller and I want to make a HTTP request to the local HTTP resource. This resource is a Java-based app and gives me its own REST API.
My WebScript is not a Share Component: so I don't have a remote
object to call another webscript.
How can I make a HTTP request to the local resource (something like '/sdo/documents/getName?type=fl') from a WebScript?
EDIT: Alfresco is overriding the Spring Surf
webscripts.container
bean removing theremote
definition (inweb-scripts-application-context.xml
ofremote-api
):I suggest you include it again as a custom Javascript API root level object.
The
remote
root object comes from the Spring Surf framework, meaning you have it regardless of being developing your Web Scripts against the Alfresco repository or Share. As a proof, here's the source for a Web Script available in the public Alfresco CMIS server (-> Alfresco repository instance, admin/admin if you are asked to login):The following snippet is taken from
spring-surf-application-context.xml
as found insidespring-webscripts-1.0.0.CI-SNAPSHOT.jar
of Alfresco 3.4.0, which is where theremote
root object gets its definition: