Jersey deployment

I designed the jersey resource class.

Can someone tell me how I can deploy it to a web application server. Preferably Tomcat or JBoss.

Or even better is the question, can Jersey applications use only the resource class on the web application server? If so, how?

+4
source share
3 answers

using web.xml:

<servlet> <servlet-name>jersey-servlet</servlet-name> <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class> <init-param> <param-name>com.sun.jersey.config.property.packages</param-name> <param-value>com.foo.resources;org.bar.resources</param-value> </init-param> </servlet> 

or in Java (without servlet container):

 public class MyConfig extends PackagesResourceConfig { public MyApplication() { super("com.foo.resources;org.bar.resources"); } } 

or subclassical application:

 public class MyApplicaton extends Application { public Set<Class<?>> getClasses() { Set<Class<?>> s = new HashSet<Class<?>>(); s.add(com.foo.resources.MyResource.class); return s; } } 
+7
source

Deploying in a servlet container will certainly work if you need a servlet container. Simplified and recommended Jersey with Grizzly - http://jersey.java.net/nonav/documentation/latest/user-guide.html#d4e60

0
source

First you need to load the jesey engine into your web application, which can be done using web.xml and set loadonstartup as 1.

you can read the first application and jersery configurations here

you can see a simple greeting example here

0
source

All Articles