users@jersey.java.net

[Jersey] Re: jaxrs-ri (jersey2.0) and embedded server example

From: Michal Gajdos <michal.gajdos_at_oracle.com>
Date: Thu, 18 Jul 2013 14:42:43 +0200

Hi Rajeev,

take a look at App class in helloworld example ([1]) and if you follow
the pattern you should be able to execute your app from your IDE.

Don't forget to add a dependency on jersey-container-grizzly2-http module:

<dependency>
     <groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-grizzly2-http</artifactId>
     <version>2.0</version>
</dependency>

If you want to package your app as WAR, then take a look at
helloworld-webapp ([2]) example as well.

[1]
https://github.com/jersey/jersey/blob/2.0/examples/helloworld/src/main/java/org/glassfish/jersey/examples/helloworld/App.java#L65
[2] https://github.com/jersey/jersey/blob/2.0/examples/helloworld-webapp

Michal

On 18.07.2013 12:14 , rajeev jha wrote:
> Hi
>
> I have downloaded the latest jersey 2.0 jars from site. I am afraid I
> am not very familiar with Maven.
>
> I have a simple REST service that works with glassfish v4. I would
> like to test my service with an embedded container (project | run)
> without the headache of deploying it on glassfish. The console sample
> I have works with jersey 1.7.1 release using class
> com.sun.jersey.api.container.httpserver.HttpServerFactory.
>
> I cannot find this class in jersey 2.0 release. Does anyone have a
> working example with either JDKHttp server or grizzly and a list of
> jars to include to make this work? remember, no maven :(
>
> Thanks
>
> /rajeev
>