-
1. Re: JAX RS Service on Gatein
jeremi23 May 16, 2010 9:40 PM (in response to kunalgaba)Hi,
You can have a look at an exemple in eXo Social:
To deploy your service, you need to add configuration as done in this exemple:
I wrote a webservice in groovy few days ago that access the organisation service, you can easily convert it to java:
import javax.ws.rs.Path import javax.ws.rs.GET import javax.ws.rs.PathParam import org.exoplatform.container.PortalContainer import org.exoplatform.services.organization.OrganizationService import org.exoplatform.container.component.RequestLifeCycle @Path("/test") public class Demo { @GET @Path("/demoGroup") public String demoGroup() { def pc = PortalContainer.getInstance() RequestLifeCycle.begin(pc); try { def organizationService = pc.getComponentInstanceOfType(OrganizationService.class) def groupHandler = organizationService.getGroupHandler() def group = groupHandler.findGroupById("/Platform") ... } finally { RequestLifeCycle.end(); } } }
I hope it helps, let me know,
Jeremi
-
2. Re: JAX RS Service on Gatein
kunalgaba May 17, 2010 1:00 AM (in response to jeremi23)Thanks Jeremy. It works but I am not sure
about RequestLifeCycle.begin(pc). Is it required even if my service is executed within the context of the portal container.
-
3. Re: JAX RS Service on Gatein
jeremi23 May 17, 2010 1:17 AM (in response to kunalgaba)Yes, you need to initialize the RequestLifeCycle even if you are not in the portal context. Some services such as the OrganisationService need this initialization to work properly. Hopefully it will be done for you in a later version of GateIn so you will not have to care about it (EXOJCR-728) but until then it's required.
-
4. Re: JAX RS Service on Gatein
kunalgaba May 17, 2010 1:35 AM (in response to jeremi23)Thanks Jeremy for your help.