0

I have created a rest service in a java application . I need to call this rest service on the click of a button in Alfresco Share page . How do i approacj it . Can i directly call the service with the url ?

1 Answer 1

3

You can add a custom endpoint to SURF & use the SURF Proxy-Servlet: Example Flickr Endpoint share-config-custom.xml:

<alfresco-config>
   <config evaluator="string-compare" condition="Remote">
      <remote>       
         <endpoint>
            <id>flickr</id>
            <name>flickr - unauthenticated access for oembed resolution</name>
            <description>Access flickr to resolve URLs to embed presentations.</description>
            <connector-id>http</connector-id>
            <endpoint-url>http://www.flickr.com/services</endpoint-url>
            <identity>none</identity>
         </endpoint>         
      </remote>
   </config>
</alfresco-config>

In Browser JS Code just use the flickr endpoint via PROXY, e.g. add a new va PROXY_FLICKR_API :

var PROXY_FLICKR_API = Alfresco.constants.PROXY_URI.replace("/alfresco/", "/flickr/");
Alfresco.util.Ajax.jsonRequest(
     {
        method: Alfresco.util.Ajax.GET,
        url: PROXY_FLICKR_API + "add your concrete URL",
        successCallback:
        {
           ...
        },
        failureCallback:
        {
           ...
        }
     });

You should add your var PROXY_FLICKR_API JS declaration via SURF Extension mechanism - your target markupid is (more details http://blogs.alfresco.com/wp/developer/2012/05/22/customizing-share-javascript-widget-instantiation-part-1/):

<@markup id="yourid" target="resources" action="after">
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.