-
1. Deployment of GateIn REST services
hifly81 Mar 28, 2011 3:15 PM (in response to buczyn)I tried to deploy a rest service either in a .war archive or in .ear archive. It deploys but the rest service is not registered. The only chance to get it working is to create a .jar archive as you did; I put it in gatein.ear/lib.
Someone did it in a war archive?
Thanks,
Giovanni
-
2. Deployment of GateIn REST services
hoang_to Mar 28, 2011 10:21 PM (in response to hifly81)Could you post the configuration and code (annotation part) of your REST service?
-
3. Deployment of GateIn REST services
trong.tran Mar 29, 2011 2:34 AM (in response to hifly81)You could try by configure your war/ear as a portal extension, this only ensures that configuration in your war/ear will be read by Portal Container. BUT i'm not sure if it work totally, i didn't try it though :-)
-
4. Re: Deployment of GateIn REST services
buczyn Mar 29, 2011 7:38 AM (in response to trong.tran)Thank you all for the replies.
@Giovanni, I do also have a feeling that it only works as jar file deployed either to lib directory of the serwer or gatein.ear/lib.
My configuration.xml in jar with REST service is very simple:
{noformat}
<configuration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
<component>
<type>t3.examples.restservices.HelloWorldRest</type>
</component>
<configuration>
{noformat}
The REST service is also a sample one:
{noformat}
@Path( "HelloWorldRest" )
public class HelloWorldRest implements ResourceContainer {
@GET
@Path( "/ejbtest" )
public Response ejbTest( @Context SecurityContext sc ) {
String test = "ERROR";
try{
javax.naming.Context context = new InitialContext();
TestServiceRemote testService = (TestServiceRemote)context.lookup( "app/TestServiceBean/remote" );
test = testService.getTest();
}catch( NamingException e ){
e.printStackTrace();
}
return Response
.ok(
"Got from test service: " + test + "<br/>"
+ "This method is permitted for all authenticated users, caller principal "
+ sc.getUserPrincipal() ).header( HttpHeaders.CACHE_CONTROL, CC ).build();
}
}
{noformat}
I tried to deploy it in EAR with my application, as well as in another EAR, where I have only portal (new portal, pages, users, etc.) configuration (I mean it works as portal extension). The deployment succedded, all other stuff worked but REST service was not accessible.
-
5. Re: Deployment of GateIn REST services
nscavell Mar 31, 2011 11:39 AM (in response to buczyn)You can definitely deploy your rest service in an ear file, however pretty sure it needs to be part of an extension like Trong mentioned.
One thing I would do is put a System.out.println in a default constructor of your HelloWorldRest class to see if the container is picking up your class. If not then there's a classpath issue and the container is not seeing it. If it is then there's an issue with your rest service or the path you are trying to access it.
Try something even simpler:
@Path( "HelloWorldRest" ) public class HelloWorldRest implements ResourceContainer { @GET public String helloWorld() { return "Hello World !"; } }
and see what you get by going to http://localhost:8080/rest/HelloWorldRest