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.containerbean removing theremotedefinition (inweb-scripts-application-context.xmlofremote-api):I suggest you include it again as a custom Javascript API root level object.
The
remoteroot 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.xmlas found insidespring-webscripts-1.0.0.CI-SNAPSHOT.jarof Alfresco 3.4.0, which is where theremoteroot object gets its definition: