02-09-2010 04:27 AM
02-25-2011 08:15 AM
02-25-2011 08:33 AM
02-25-2011 03:22 PM
If you are using a "Java Backed WebScript" then you don't need it, use spring injection instead.
Its in the Repository Project.
02-28-2011 10:28 AM
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.alfresco.service.ServiceRegistry;
public class TestWebScript extends AbstractWebScript implements ApplicationContextAware {
private ServiceRegistry serviceRegistry;
private ApplicationContext applicationContext;
@Override
public void setApplicationContext(ApplicationContext arg0) throws BeansException {
this.applicationContext = applicationContext;
}
public void execute(WebScriptRequest req, WebScriptResponse res){
this.serviceRegistry=(ServiceRegistry)applicationContext.getBean("serviceRegistry");
// serviceRegistry.getAnyServices and use them
}
}
To make this class compile in share, I had to add the 'alfresco-repository-3.4.c.jar' from the repository project as you suggested so that it recognizes the <bean id="webscript.org.alfresco.components.package.testwebscript.get"
class="package.TestWebScript "
parent="webscript">
<property name="serviceRegistry" ref="ServiceRegistry" />
</bean>
Like suggested in most other places, but context can't bes initializad because share don't seem to resolve/find the 'ServiceRegistry' bean the only one available is referenced as: <property name="serviceRegistry" ref="webframework.service.registry" /> But that's not the one… what am I missing?02-28-2011 11:32 AM
02-07-2012 09:43 PM
import org.springframework.extensions.surf.RequestContext;
import org.springframework.extensions.surf.support.ThreadLocalRequestContext;
import org.springframework.extensions.webscripts.AbstractWebScript;
import org.springframework.extensions.webscripts.WebScriptRequest;
import org.springframework.extensions.webscripts.WebScriptResponse;
import org.springframework.extensions.webscripts.connector.User;
public class DemoAction extends AbstractWebScript {
@Override
public void execute(WebScriptRequest request, WebScriptResponse response) {
RequestContext context = ThreadLocalRequestContext.getRequestContext();
User user = context.getUser();
}
}
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.