AnsweredAssumed Answered

Access Alfresco Repo from Java Backed Share Webscript

Question asked by redtreetom on Jan 4, 2013
Latest reply on Jan 7, 2013 by jpotts
Version :Enterprise - v4.1.1 (.3 61) (Trial)

So i have created a java backed webscript.

<bean id="webscript.control-panel.sign-control.get" class="be.redtree.webscript.View" parent="webscript"></bean>
<webscript>
   <shortname>Admin Console Manage Signatures</shortname>
   <description>Administration Console - Manage Signatures</description>
   <url>/extras/components/console/manage-signatures</url>
   <family>admin-console</family>
</webscript>

public class View extends DeclarativeWebScript {

   private static final Logger sLog = Logger.getLogger(View.class);

   @Override
   protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache) {

Map<String, Object> model = new HashMap<String, Object>();
      model.put("demo", "Happy coding! :D");
      return model;
}

This works fine and it post as desired, However i am now trying to access the alfresco repository.
Please note that i cannot use CMIS since i have to change users.

So im left with the rest api or the remote services.
Rest requires the alf ticket and the remote services require username/password.

What is the best way to do this ?

              
 String ticket = req.getParameter("ticket");
      sLog.error("ticket 0 : "+ticket);
      
      ticket = AuthenticationUtils.getTicket();
      sLog.error("ticket 1 : "+ticket);
      
      ticket = req.getParameter("alfticket");
      sLog.error("ticket 2 : "+ticket);

                AuthenticationDetails authenticationDetails = AuthenticationUtils.getAuthenticationDetails();

will always return null.

Lost of posts say to use javascript, but this not an option for me.

Any advice ?

Outcomes