users@jersey.java.net

[Jersey] Re: Running Jersey with Jetty in memory

From: Jakub Podlesak <jakub.podlesak_at_oracle.com>
Date: Tue, 01 Nov 2011 22:47:02 +0100

Hi Jan,

If in-memory meant embedded, you may want to try out the following,
taken from jetty docs (see [1]). I replaced the original Servlet class
with Jersey's ServletContainer:

|Server server = ||new| |Server(||8080||);|
|Context root = ||new| |Context(server,||"/"||,Context.SESSIONS);|
|root.addServlet(||new| |ServletHolder(||new| |ServletContainer(new
DefaultResourceConfig(JerseyResource.class)||||)), ||"/*"||);|
|server.start();

Have not tested the above, but crossing fingers it could work...

HTH,

~Jakub
|


[1]http://docs.codehaus.org/display/JETTY/Embedding+Jetty

On 1.11.2011 16:57, Jan Algermissen wrote:
> Hi,
>
> does anyone know a quick way to start an in-memory Jetty with Jersey (e.g. without using a web.xml).
>
> Jan
>