The basic configuration (without POJO / JSON mapping) can be found here: http://www.mkyong.com/webservices/jax-rs/jersey-hello-world-example/
To add POJO / JSON mapping:
- Ensure the following jar files are on classpath:
- asm
- jackson-core-asl
- jackson-jaxrs
- jackson-mapper-asl
- jackson-xc
- jersey-core
- jersey-json
- jersey-servlet
- jersey-server
- web.xml should look something like this:
<servlet> <servlet-name>WsServlet</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.xxxxx.ws</param-value> </init-param> <init-param> <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name> <param-value>true</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>WsServlet</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> |
No comments:
Post a Comment