<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> <TITLE>Dependencies</TITLE> <META NAME="GENERATOR" CONTENT="StarOffice 9 (Unix)"> <META NAME="CREATED" CONTENT="0;0"> <META NAME="CHANGED" CONTENT="20090824;14171500"> <META NAME="Info 1" CONTENT=""> <META NAME="Info 2" CONTENT=""> <META NAME="Info 3" CONTENT=""> <META NAME="Info 4" CONTENT=""> </HEAD> <BODY LANG="en-US" DIR="LTR"> <H1>Dependencies</H1> <P>Jersey is built, assembled and installed using Maven. Jersey is deployed to the Java.Net maven repository at the following location:</P> <BLOCKQUOTE><A HREF="http://download.java.net/maven/2/com/sun/jersey">http://download.java.net/maven/2/</A></BLOCKQUOTE> <P>The Jersey modules can be browsed at the following location:</P> <BLOCKQUOTE><A HREF="http://download.java.net/maven/2/com/sun/jersey">http://download.java.net/maven/2/com/sun/jersey/</A></BLOCKQUOTE> <P>Jars, Jar sources, Jar JavaDoc and samples are all available on the java.net maven repository. </P> <P>For getting started with a simple example please read the <A HREF="getting-started.html">getting started</A> document. For an overview of many JAX-RS features please read the <A HREF="https://wikis.oracle.com/display/Jersey/Overview+of+JAX-RS+1.0+Features">overview</A> document.</P> <P>A zip file containing all maven-based samples can be obtained <A HREF="http://download.java.net/maven/2/com/sun/jersey/samples/jersey-samples/1.1.3-ea-SNAPSHOT/jersey-samples-1.1.3-ea-SNAPSHOT-project.zip">here</A>. Individual zip files for each sample may be found by browsing the <A HREF="http://download.java.net/maven/2/com/sun/jersey/samples/">samples</A> directory. </P> <P>An application depending on Jersey requires that it in turn includes the set of jars that Jersey depends on. Jersey has a pluggable component architecture so the set of jars required to be include in the class path can be different for each application. </P> <P>Developers using maven are likely to find it easier to include and manage dependencies of their applications than developers using ant or other build technologies. This document will explain to both maven and non-maven developers how to depend on Jersey for their application. Ant developers are likely to find the <A HREF="http://maven.apache.org/ant-tasks.html">Ant Tasks for Maven</A> very useful. For the convenience of non-maven developers the following are provided:</P> <UL> <LI><P>A <A HREF="http://download.java.net/maven/2/com/sun/jersey/jersey-archive/1.1.3-ea-SNAPSHOT/jersey-archive-1.1.3-ea-SNAPSHOT.zip">zip of Jersey</A> containing the Jersey jars, core dependencies (it does not provide dependencies for third party jars beyond the those for JSON support) and JavaDoc.</P> <LI><P>A jersey bundle jar to avoid the dependency management of multiple jersey-based jars.</P> </UL> <P>Jersey's runtime dependences are categorized into the following:</P> <UL> <LI><P>Core server. The minimum set of dependences that Jersey requires for the server.</P> <LI><P>Core client. The minimum set of dependences that Jersey requires for the client.</P> <LI><P>Container. The set of container dependences. Each container provider has it's own set of dependences.</P> <LI><P>Entity. The set of entity dependencies. Each entity provider has it's own set of dependences.</P> <LI><P>Tools. The set of dependencies required for runtime tooling.</P> <LI><P>Spring. The set of dependencies required for Spring.</P> <LI><P>Guice. The set of dependencies required for Guice.</P> </UL> <P>All dependences in this documented are referenced by hyper-links</P> <H2>Core server</H2> <P>Maven developers require a dependency on the <A HREF="http://download.java.net/maven/2/com/sun/jersey/jersey-server/1.1.3-ea-SNAPSHOT/jersey-server-1.1.3-ea-SNAPSHOT.pom">jersey-server</A> module. The following dependency needs to be added to the pom:</P> <PRE STYLE="margin-left: 0.79in"><dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-server</artifactId> <version>1.1.3-ea-SNAPSHOT</version> </dependency></PRE><P> And the following repositories need to be added to the pom:</P> <PRE STYLE="margin-left: 0.79in"><repository> <id>maven2-repository.dev.java.net</id> <name>Java.net Repository for Maven</name> <url>http://download.java.net/maven/2/</url> <layout>default</layout> </repository> <repository> <id>maven-repository.dev.java.net</id> <name>Java.net Maven 1 Repository (legacy)</name> <url>http://download.java.net/maven/1</url> <layout>legacy</layout> </repository></PRE><P> Non-maven developers require: </P> <BLOCKQUOTE><A HREF="http://download.java.net/maven/2/com/sun/jersey/jersey-server/1.1.3-ea-SNAPSHOT/jersey-server-1.1.3-ea-SNAPSHOT.jar">jersey-server.jar</A>, <A HREF="http://download.java.net/maven/2/com/sun/jersey/jersey-core/1.1.3-ea-SNAPSHOT/jersey-core-1.1.3-ea-SNAPSHOT.jar">jersey-core.jar</A>, <A HREF="http://download.java.net/maven/2/javax/ws/rs/jsr311-api/1.1/jsr311-api-1.1.jar">jsr311-api.jar</A>, <A HREF="http://repo1.maven.org/maven2/asm/asm/3.1/asm-3.1.jar">asm.jar</A></BLOCKQUOTE> <BLOCKQUOTE STYLE="margin-left: 0in; margin-right: 0in">or, if using the jersey-bundle:</BLOCKQUOTE> <BLOCKQUOTE><A NAME="DDE_LINK2"></A><A HREF="http://download.java.net/maven/2/com/sun/jersey/jersey-bundle/1.1.3-ea-SNAPSHOT/jersey-bundle-1.1.3-ea-SNAPSHOT.jar">jersey-bundle.jar</A>, <A HREF="http://download.java.net/maven/2/javax/ws/rs/jsr311-api/1.1/jsr311-api-1.1.jar">jsr311-api.jar</A>, <A HREF="http://repo1.maven.org/maven2/asm/asm/3.1/asm-3.1.jar">asm.jar</A></BLOCKQUOTE> <BLOCKQUOTE STYLE="margin-left: 0in; margin-right: 0in">For Ant developers the <A HREF="http://maven.apache.org/ant-tasks.html">Ant Tasks for Maven</A> may be used to add the following to the ant document such that the dependencies do not need to be downloaded explicitly:</BLOCKQUOTE> <PRE STYLE="margin-left: 0.79in"><artifact:dependencies pathId="dependency.classpath"> <dependency groupId="com.sun.jersey" artifactId="jersey-server" version="1.1.3-ea-SNAPSHOT"/> <artifact:remoteRepository id="maven2-repository.dev.java.net" url="http://download.java.net/maven/2/" /> <artifact:remoteRepository id="maven-repository.dev.java.net" url="http://download.java.net/maven/1" layout="legacy" /> </artifact:dependencies></PRE><BLOCKQUOTE STYLE="margin-left: 0in; margin-right: 0in"> The path id “dependency.classpath” may then be referenced as the classpath to be used for compiling or executing.</BLOCKQUOTE> <BLOCKQUOTE STYLE="margin-left: 0in; margin-right: 0in">Specifically the <A HREF="http://repo1.maven.org/maven2/asm/asm/3.1/asm-3.1.jar">asm.jar</A> dependency is required when either of the following <A HREF="https://jersey.dev.java.net/nonav/apidocs/1.1.3-ea-SNAPSHOT/jersey/com/sun/jersey/api/core/ResourceConfig.html"><FONT FACE="Courier New, monospace">com.sun.jersey.api.core.ResourceConfig</FONT></A> implementations are utilized: </BLOCKQUOTE> <UL> <LI><P><A HREF="https://jersey.dev.java.net/nonav/apidocs/1.1.3-ea-SNAPSHOT/jersey/com/sun/jersey/api/core/ClasspathResourceConfig.html"><FONT FACE="Courier New, monospace">com.sun.jersey.api.core.ClasspathResourceConfig</FONT></A>; or</P> <LI><P><A HREF="https://jersey.dev.java.net/nonav/apidocs/1.1.3-ea-SNAPSHOT/jersey/com/sun/jersey/api/core/PackagesResourceConfig.html"><FONT FACE="Courier New, monospace">com.sun.jersey.api.core.PackagesResourceConfig</FONT></A></P> </UL> <P>By default Jersey will utilize the <A HREF="https://jersey.dev.java.net/nonav/apidocs/1.1.3-ea-SNAPSHOT/jersey/com/sun/jersey/api/core/ClasspathResourceConfig.html"><FONT FACE="Courier New, monospace">ClasspathResourceConfig</FONT></A> if an alternative is not specified. If an alternative is specified that does not depend on the asm.jar then it is no longer necessary to include the asm.jar in the minimum set of required jars.</P> <H2>Core client</H2> <P>Maven developers require a dependency on the <A HREF="http://download.java.net/maven/2/com/sun/jersey/jersey-client/1.1.3-ea-SNAPSHOT/jersey-client-1.1.3-ea-SNAPSHOT.pom">jersey-client</A> module. The following dependency needs to be added to the pom:</P> <PRE STYLE="margin-left: 0.79in"><dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-client</artifactId> <version>1.1.3-ea-SNAPSHOT</version> </dependency></PRE><P> Non-maven developers require: </P> <BLOCKQUOTE><A HREF="http://download.java.net/maven/2/com/sun/jersey/jersey-client/1.1.3-ea-SNAPSHOT/jersey-client-1.1.3-ea-SNAPSHOT.jar">jersey-client.jar</A>, <A HREF="http://download.java.net/maven/2/com/sun/jersey/jersey-core/1.1.3-ea-SNAPSHOT/jersey-core-1.1.3-ea-SNAPSHOT.jar">jersey-core.jar</A>, <A HREF="http://download.java.net/maven/2/javax/ws/rs/jsr311-api/1.1/jsr311-api-1.1.jar">jsr311-api.jar</A></BLOCKQUOTE> <BLOCKQUOTE STYLE="margin-left: 0in; margin-right: 0in">or, if using the jersey-bundle:</BLOCKQUOTE> <BLOCKQUOTE><A HREF="http://download.java.net/maven/2/com/sun/jersey/jersey-bundle/1.1.3-ea-SNAPSHOT/jersey-bundle-1.1.3-ea-SNAPSHOT.jar">jersey-bundle.jar</A>, <A HREF="http://download.java.net/maven/2/javax/ws/rs/jsr311-api/1.1/jsr311-api-1.1.jar">jsr311-api.jar</A></BLOCKQUOTE> <P>The use of client with the Apache HTTP client to make HTTP request and receive HTTP responses requires a dependency on the <A HREF="http://download.java.net/maven/2/com/sun/jersey/contribs/jersey-apache-client/1.1.3-ea-SNAPSHOT/jersey-apache-client-1.1.3-ea-SNAPSHOT.pom">jersey-apache-client</A> module. The following dependency needs to be added to the pom:</P> <PRE STYLE="margin-left: 0.79in"><dependency> <groupId>com.sun.jersey.contribs</groupId> <artifactId>jersey-apache-client</artifactId> <version>1.1.3-ea-SNAPSHOT</version> </dependency></PRE><H2> Container</H2> <H3>Grizzly HTTP Web server</H3> <P><A NAME="DDE_LINK1"></A><A NAME="DDE_LINK5"></A>Maven developers, deploying an application using the Grizzly HTTP Web server, require a dependency on the <A HREF="http://download.java.net/maven/2/com/sun/grizzly/grizzly-servlet-webserver/1.9.8/grizzly-servlet-webserver-1.9.8.pom">grizzly-servlet-webserver</A> module.</P> <P>Non-maven developers require:</P> <BLOCKQUOTE><A NAME="DDE_LINK4"></A><A HREF="http://download.java.net/maven/2/com/sun/grizzly/grizzly-servlet-webserver/1.9.8/grizzly-servlet-webserver-1.9.8.jar">grizzly-servlet-webserver.jar</A></BLOCKQUOTE> <H3>Simple HTTP Web server</H3> <P>Maven developers, deploying an application using the Simple HTTP Web server, require a dependency on the <A HREF="http://download.java.net/maven/2/com/sun/jersey/contribs/jersey-simple/1.1.3-ea-SNAPSHOT/jersey-simple-1.1.3-ea-SNAPSHOT.pom">jersey-simple</A> module.</P> <H3>Light weight HTTP server</H3> <P><A NAME="DDE_LINK3"></A>Maven developers, using Java SE 5 and deploying an application using the light weight HTTP server, require a dependency on the <A HREF="http://download.java.net/maven/2/com/sun/net/httpserver/http/20070405/http-20070405.pom">http</A> module.</P> <P>Non-maven developers require:</P> <BLOCKQUOTE><A HREF="http://download.java.net/maven/2/com/sun/net/httpserver/http/20070405/http-20070405.jar">http.jar</A></BLOCKQUOTE> <P>Deploying an application using the light weight HTTP server with Java SE 6 requires no additional dependences.</P> <H3>Servlet</H3> <P>Deploying an application on a servlet container requires a deployment dependency with that container.</P> <P>See the Java documentation <A HREF="https://jersey.dev.java.net/nonav/apidocs/1.1.3-ea-SNAPSHOT/jersey/com/sun/jersey/spi/container/servlet/package-summary.html">here</A> on how to configure the servlet container.</P> <P>Using servlet:</P> <BLOCKQUOTE><FONT FACE="Courier New, monospace">com.sun.jersey.spi.container.servlet.ServletContainer</FONT></BLOCKQUOTE> <P><A NAME="DDE_LINK7"></A>requires no additional dependences.</P> <P>Maven developers using servlet:</P> <BLOCKQUOTE><FONT FACE="Courier New, monospace">com.sun.jersey.server.impl.container.servlet.ServletAdaptor</FONT></BLOCKQUOTE> <P>in a non-EE 5 servlet require a dependency on the <A HREF="http://download.java.net/maven/1/javax.persistence/poms/persistence-api-1.0.2.pom">persistence-api</A> module.</P> <P>Non-Maven developers require:</P> <BLOCKQUOTE><A HREF="http://download.java.net/maven/1/javax.persistence/jars/persistence-api-1.0.2.jar">persistence-api.jar</A></BLOCKQUOTE> <H2>Entity</H2> <H3>JAXB</H3> <P>XML serialization support of Java types that are JAXB beans requires a dependency on the JAXB reference implementation version 2.x or higher (see later for specific version constraints with respect to JSON support). Deploying an application for XML serialization support using JAXB with Java SE 6 requires no additional dependences, since Java SE 6 ships with JAXB 2.x support.</P> <P>Maven developers, using Java SE 5, require a dependency on the <A HREF="http://download.java.net/maven/1/com.sun.xml.bind/poms/jaxb-impl-2.1.12.pom">jaxb-impl</A> module.</P> <P>Non-maven developers require:</P> <BLOCKQUOTE><A HREF="http://download.java.net/maven/1/com.sun.xml.bind/jars/jaxb-impl-2.1.12.jar">jaxb-impl.jar</A>, <A HREF="http://download.java.net/maven/1/javax.xml.bind/jars/jaxb-api-2.1.jar">jaxb-api.jar</A>, <A HREF="http://download.java.net/maven/1/javax.activation/jars/activation-1.1.jar">activation.jar</A>, <A HREF="http://download.java.net/maven/1/javax.xml.stream/jars/stax-api-1.0-2.jar">stax-api.jar</A></BLOCKQUOTE> <P>Maven developers, using Java SE 5, that are consuming or producing <FONT FACE="Courier New, monospace">T[]</FONT>, <FONT FACE="Courier New, monospace">List<T></FONT> or <FONT FACE="Courier New, monospace">Collection<T></FONT> where <FONT FACE="Courier New, monospace">T</FONT> is a JAXB bean require a dependency on a StAX implementation, such as Woodstox version 3.2.1 or greater using the following dependency:</P> <PRE STYLE="margin-left: 0.79in"><dependency> <groupId>woodstox</groupId> <artifactId>wstx-asl</artifactId> <version>3.2.1</version> </dependency></PRE><P> Non-maven developers require:</P> <BLOCKQUOTE><A HREF="http://repo1.maven.org/maven2/woodstox/wstx-asl/3.2.1/wstx-asl-3.2.1.jar">wstx-asl-3.2.1.jar</A></BLOCKQUOTE> <P>Maven developers, using JSON serialization support of JAXB beans when using the MIME media type "application/json" require a dependency on the <A HREF="http://download.java.net/maven/2/com/sun/jersey/jersey-json/1.1.3-ea-SNAPSHOT/jersey-json-1.1.3-ea-SNAPSHOT.pom">jersey-json</A> module (no explicit dependency on jaxb-impl is required). This module depends on the JAXB reference implementation version 2.1.12 or greater, and such a version is required when enabling support for the JAXB natural JSON convention. For all other supported JSON conventions any JAXB 2.x version may be utilized. The following dependency needs to be added to the pom:</P> <PRE STYLE="margin-left: 0.79in"><dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-json</artifactId> <version>1.1.3-ea-SNAPSHOT</version> </dependency></PRE><P> Non-maven developers require:</P> <BLOCKQUOTE><A HREF="http://repository.codehaus.org/org/codehaus/jackson/jackson-core-asl/1.1.1/jackson-core-asl-1.1.1.jar">jackson-core-asl.jar</A>, <A HREF="http://repo1.maven.org/maven2/org/codehaus/jettison/jettison/1.1/jettison-1.1.jar">jettison.jar</A>, <A HREF="http://download.java.net/maven/1/com.sun.xml.bind/jars/jaxb-impl-2.1.12.jar">jaxb-impl.jar</A>, <A HREF="http://download.java.net/maven/1/javax.xml.bind/jars/jaxb-api-2.1.jar">jaxb-api.jar</A>, <A HREF="http://download.java.net/maven/1/javax.activation/jars/activation-1.1.jar">activation.jar</A>, <A HREF="http://download.java.net/maven/1/javax.xml.stream/jars/stax-api-1.0-2.jar">stax-api.jar</A></BLOCKQUOTE> <BLOCKQUOTE STYLE="margin-left: 0in; margin-right: 0in">and additionally, if not depending on the <A HREF="http://download.java.net/maven/2/com/sun/jersey/jersey-bundle/1.1.3-ea-SNAPSHOT/jersey-bundle-1.1.3-ea-SNAPSHOT.jar">jersey-bundle.jar</A>, non-maven developers require:</BLOCKQUOTE> <BLOCKQUOTE><A HREF="http://download.java.net/maven/2/com/sun/jersey/jersey-json/1.1.3-ea-SNAPSHOT/jersey-json-1.1.3-ea-SNAPSHOT.jar">jersey-json.jar</A></BLOCKQUOTE> <BLOCKQUOTE STYLE="margin-left: 0in; margin-right: 0in">Maven developers, using Fast Infoset serialization support of JAXB beans with using the MIME media type "application/fastinfoset" require a dependency on the <A HREF="http://download.java.net/maven/2/com/sun/jersey/jersey-fastinfoset/1.1.3-ea-SNAPSHOT/jersey-fastinfoset-1.1.3-ea-SNAPSHOT.pom">jersey-fastinfoset</A> module (no dependency on jaxb-impl is required). The following dependency needs to be added to the pom:</BLOCKQUOTE> <PRE STYLE="margin-left: 0.79in"><dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-fastinfoset</artifactId> <version>1.1.3-ea-SNAPSHOT</version> </dependency></PRE><P> Non-maven developers require:</P> <BLOCKQUOTE><A HREF="http://download.java.net/maven/1/com.sun.xml.fastinfoset/jars/FastInfoset-1.2.2.jar">FastInfoset.jar</A>, <A HREF="http://download.java.net/maven/1/com.sun.xml.bind/jars/jaxb-impl-2.1.12.jar">jaxb-impl.jar</A>, <A HREF="http://download.java.net/maven/1/javax.xml.bind/jars/jaxb-api-2.1.jar">jaxb-api.jar</A>, <A HREF="http://download.java.net/maven/1/javax.activation/jars/activation-1.1.jar">activation.jar</A>, <A HREF="http://download.java.net/maven/1/javax.xml.stream/jars/stax-api-1.0-2.jar">stax-api.jar</A></BLOCKQUOTE> <BLOCKQUOTE STYLE="margin-left: 0in; margin-right: 0in">and additionally, if not depending on the <A HREF="http://download.java.net/maven/2/com/sun/jersey/jersey-bundle/1.1.3-ea-SNAPSHOT/jersey-bundle-1.1.3-ea-SNAPSHOT.jar">jersey-bundle.jar</A>, non-maven developers require:</BLOCKQUOTE> <BLOCKQUOTE><A HREF="http://download.java.net/maven/2/com/sun/jersey/jersey-fastinfoset/1.1.3-ea-SNAPSHOT/jersey-fastinfoset-1.1.3-ea-SNAPSHOT.jar">jersey-fastinfoset.jar</A></BLOCKQUOTE> <H3>Atom</H3> <P>The use of the Java types <FONT FACE="Courier New, monospace">org.apache.abdera.model.{Categories, Entry, Feed, Service}</FONT> requires a dependency on Apache Abdera.</P> <P>Maven developers require a dependency on the <A HREF="http://download.java.net/maven/2/com/sun/jersey/contribs/jersey-atom-abdera/1.1.3-ea-SNAPSHOT/jersey-atom-abdera-1.1.3-ea-SNAPSHOT.pom">jersey-atom-abdera</A> module. The following dependency needs to be added to the pom:</P> <PRE STYLE="margin-left: 0.79in"><dependency> <groupId>com.sun.jersey.contribs</groupId> <artifactId>jersey-atom-abdera</artifactId> <version>1.1.3-ea-SNAPSHOT</version> </dependency></PRE><P> The use of the Java types <FONT FACE="Courier New, monospace">com.sun.syndication.feed.atom.Entry</FONT> and <FONT FACE="Courier New, monospace">com.sun.syndication.feed.atom.Feed</FONT> requires a dependency on ROME version 0.9 or higher.</P> <P>Maven developers require a dependency on the <A HREF="http://download.java.net/maven/2/com/sun/jersey/jersey-atom/1.1.3-ea-SNAPSHOT/jersey-atom-1.1.3-ea-SNAPSHOT.pom">jersey-atom</A> module. The following dependency needs to be added to the pom:</P> <PRE STYLE="margin-left: 0.79in"><dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-atom</artifactId> <version>1.1.3-ea-SNAPSHOT</version> </dependency></PRE><P> Non-maven developers require:</P> <BLOCKQUOTE><A HREF="http://download.java.net/maven/1/rome/jars/rome-0.9.jar">rome.jar</A>, <A HREF="http://repo1.maven.org/maven2/jdom/jdom/1.0/jdom-1.0.jar">jdom.jar</A></BLOCKQUOTE> <BLOCKQUOTE STYLE="margin-left: 0in; margin-right: 0in">and additionally, if not depending on the <A HREF="http://download.java.net/maven/2/com/sun/jersey/jersey-bundle/1.1.3-ea-SNAPSHOT/jersey-bundle-1.1.3-ea-SNAPSHOT.jar">jersey-bundle.jar</A>, non-maven developers require:</BLOCKQUOTE> <BLOCKQUOTE><A HREF="http://download.java.net/maven/2/com/sun/jersey/jersey-atom/1.1.3-ea-SNAPSHOT/jersey-atom-1.1.3-ea-SNAPSHOT.jar">jersey-atom.jar</A></BLOCKQUOTE> <H3>JSON</H3> <P>The use of the Java types <FONT FACE="Courier New, monospace">org.codehaus.jettison.json.JSONObject</FONT> and <FONT FACE="Courier New, monospace">org.codehaus.jettison.json.JSONArray</FONT> requires Jettison version 1.0 or higher.</P> <P>Maven developers require a dependency on the <A HREF="http://download.java.net/maven/2/com/sun/jersey/jersey-json/1.1.3-ea-SNAPSHOT/jersey-json-1.1.3-ea-SNAPSHOT.pom">jersey-json</A> module. The following dependency needs to be added to the pom:</P> <PRE STYLE="margin-left: 0.79in"><dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-json</artifactId> <version>1.1.3-ea-SNAPSHOT</version> </dependency></PRE><P> Non-maven developers require:</P> <BLOCKQUOTE><A HREF="http://repo1.maven.org/maven2/org/codehaus/jettison/jettison/1.1/jettison-1.1.jar">jettison.jar</A></BLOCKQUOTE> <BLOCKQUOTE STYLE="margin-left: 0in; margin-right: 0in">and additionally, if not depending on the <A HREF="http://download.java.net/maven/2/com/sun/jersey/jersey-bundle/1.1.3-ea-SNAPSHOT/jersey-bundle-1.1.3-ea-SNAPSHOT.jar">jersey-bundle.jar</A>, non-maven developers require:</BLOCKQUOTE> <BLOCKQUOTE><A HREF="http://download.java.net/maven/2/com/sun/jersey/jersey-json/1.1.3-ea-SNAPSHOT/jersey-json-1.1.3-ea-SNAPSHOT.jar">jersey-json.jar</A></BLOCKQUOTE> <H3>Mail and MIME multipart</H3> <P>The use of the Java type <FONT FACE="Courier New, monospace">javax.mail.internet.MimeMultipart</FONT> with Java SE 5 or 6 requires Java Mail version 1.4 or higher.</P> <P>Maven developers require a dependency on the <A HREF="http://download.java.net/maven/1/javax.mail/poms/mail-1.4.pom">java-mail</A> module.</P> <P>Non-maven developers require:</P> <BLOCKQUOTE><A NAME="DDE_LINK"></A><A HREF="http://download.java.net/maven/1/javax.mail/jars/mail-1.4.jar">mail.jar</A>, <A HREF="http://download.java.net/maven/1/javax.activation/jars/activation-1.1.jar">activation.jar</A></BLOCKQUOTE> <P>The use of the Java type <FONT FACE="Courier New, monospace">javax.mail.internet.MimeMultipart</FONT> with Java EE 5 requires no additional dependencies.</P> <P>Jersey ships with a high-level MIME multipart API. Maven developers requires a dependency on the <A HREF="http://download.java.net/maven/2/com/sun/jersey/contribs/jersey-multipart/1.1.3-ea-SNAPSHOT/jersey-multipart-1.1.3-ea-SNAPSHOT.pom">jersey-multipart</A> module. The following dependency needs to be added to the pom:</P> <PRE STYLE="margin-left: 0.79in"><dependency> <groupId>com.sun.jersey.contribs</groupId> <artifactId>jersey-multipart</artifactId> <version>1.1.3-ea-SNAPSHOT</version> </dependency></PRE><P> Non-maven developers require:</P> <BLOCKQUOTE><A NAME="DDE_LINK6"></A><A HREF="http://download.java.net/maven/2/org/jvnet/mimepull/1.3/mimepull-1.3.jar">mimepull.jar</A>, <A HREF="http://download.java.net/maven/2/com/sun/jersey/contribs/jersey-multipart/1.1.3-ea-SNAPSHOT/jersey-multipart-1.1.3-ea-SNAPSHOT.jar">jersey-multipart.jar</A></BLOCKQUOTE> <H3>Activation</H3> <P>The use of the Java type <FONT FACE="Courier New, monospace">javax.activation.DataSource</FONT> with Java SE 5 requires Java Activation 1.1 or higher.</P> <P>Maven developers require a dependency on the <A HREF="http://download.java.net/maven/1/javax.activation/poms/activation-1.1.pom">activation</A> module.</P> <P>Non-maven developers require:</P> <BLOCKQUOTE><A HREF="http://download.java.net/maven/1/javax.activation/jars/activation-1.1.jar">activation.jar</A></BLOCKQUOTE> <P>The use of the Java type <FONT FACE="Courier New, monospace">javax.activation.DataSource</FONT> with Java SE 6 and Java EE 5 requires no additional dependencies.</P> <H2>Tools</H2> <P>By default WADL for resource classes is generated dynamically at runtime. WADL support requires a dependency on the JAXB reference implementation version 2.x or higher. Deploying an application for WADL support with Java SE 6 requires no additional dependences, since Java SE 6 ships with JAXB 2.x support.</P> <P>Maven developers, using Java SE 5, require a dependency on the <A HREF="http://download.java.net/maven/1/com.sun.xml.bind/poms/jaxb-impl-2.1.12.pom">jaxb-impl</A> module.</P> <P>Non-maven developers require:</P> <BLOCKQUOTE><A HREF="http://download.java.net/maven/1/com.sun.xml.bind/jars/jaxb-impl-2.1.12.jar">jaxb-impl.jar</A>, <A HREF="http://download.java.net/maven/1/javax.xml.bind/jars/jaxb-api-2.1.jar">jaxb-api.jar</A>, <A HREF="http://download.java.net/maven/1/javax.activation/jars/activation-1.1.jar">activation.jar</A>, <A HREF="http://download.java.net/maven/1/javax.xml.stream/jars/stax-api-1.0-2.jar">stax-api.jar</A> </BLOCKQUOTE> <P>If the above dependencies are not present then WADL generation is disabled and a warning will be logged.</P> <P>The WADL ant task requires the same set of dependences as those for runtime WADL support.</P> <H2>Spring</H2> <P>Maven developers, using Spring 2.0.x or Spring 2.5.x, require a dependency on the <A HREF="http://download.java.net/maven/2/com/sun/jersey/contribs/jersey-spring/1.1.3-ea-SNAPSHOT/jersey-spring-1.1.3-ea-SNAPSHOT.pom">jersey-spring</A> module. The following dependency needs to be added to the pom:</P> <PRE STYLE="margin-left: 0.79in"><dependency> <groupId>com.sun.jersey.contribs</groupId> <artifactId>jersey-spring</artifactId> <version>1.1.3-ea-SNAPSHOT</version> </dependency></PRE><P> See the Java documentation <A HREF="https://jersey.dev.java.net/nonav/apidocs/1.1.3-ea-SNAPSHOT/contribs/jersey-spring/com/sun/jersey/spi/spring/container/servlet/package-summary.html">here</A> on how to integrate Jersey-based Web applications with Spring.</P> <H2>Guice</H2> <P>Maven developers, using Guice 2.0, require a dependency on the <A HREF="http://download.java.net/maven/2/com/sun/jersey/contribs/jersey-guice/1.1.3-ea-SNAPSHOT/jersey-guice-1.1.3-ea-SNAPSHOT.pom">jersey-guice</A> module. The following dependency needs to be added to the pom:</P> <PRE STYLE="margin-left: 0.79in"><dependency> <groupId>com.sun.jersey.contribs</groupId> <artifactId>jersey-guice</artifactId> <version>1.1.3-ea-SNAPSHOT</version> </dependency></PRE><P> See the Java documentation <A HREF="https://jersey.dev.java.net/nonav/apidocs/1.1.3-ea-SNAPSHOT/contribs/jersey-guice/com/sun/jersey/guice/spi/container/servlet/package-summary.html">here</A> on how to integrate Jersey-based Web applications with Spring.</P> <P>Guice support depends on the Guice artifacts distributed with <A HREF="http://code.google.com/p/guiceyfruit/">GuiceyFruit</A> a set of extensions on top of Guice 2.0, such as support for Java EE artifacts like <FONT FACE="Courier New, monospace">@PostConstruct</FONT>/<FONT FACE="Courier New, monospace">@PreDestroy</FONT>, <FONT FACE="Courier New, monospace">@Resource</FONT> and <FONT FACE="Courier New, monospace">@PersistenceContext</FONT>. To avail of GuiceyFruit features add the following dependency and repository to the pom:</P> <PRE STYLE="margin-left: 0.79in"><dependency> <groupId>org.guiceyfruit</groupId> <artifactId>guiceyfruit</artifactId> <version>2.0-beta-6</version> </dependency> ... <repository> <id>guice-maven</id> <name>guice maven</name> <url><A HREF="http://guiceyfruit.googlecode.com/svn/repo/releases">http://guiceyfruit.googlecode.com/svn/repo/releases</A></url> </repository></PRE><P> <BR><BR> </P> <H2>Jersey Test Framework</H2> <P><SPAN STYLE="background: #ffff00">NOTE that breaking changes have occurred between 1.1.1-ea and 1.1.2-ea. See the end of this section for details.</SPAN></P> <P>Jersey Test Framework allows you to test your RESTful Web Services on a wide range of containers. It supports light-weight containers such as Grizzly, Embedded GlassFish, and the Light Weight HTTP Server in addition to regular web containers such as GlassFish and Tomcat. Developers may plug in their own containers.</P> <P>A developer may write tests using the Junit 4.x framework can extend from the abstract <A HREF="https://jersey.dev.java.net/nonav/apidocs/1.1.3-ea-SNAPSHOT/jersey-test-framework/com/sun/jersey/test/framework/JerseyTest.html">JerseyTest</A> class.</P> <P>Maven developers require a dependency on the <A HREF="http://download.java.net/maven/2/com/sun/jersey/jersey-test-framework/1.1.3-ea-SNAPSHOT/jersey-test-framework-1.1.3-ea-SNAPSHOT.pom">jersey-test-framework</A> module. The following dependency needs to be added to the pom:</P> <PRE STYLE="margin-left: 0.79in"><dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-test-framework</artifactId> <version>1.1.3-ea-SNAPSHOT</version> <scope>test</scope> </dependency></PRE><P> When utilizing an embedded container this framework can manage deployment and testing of your web services. However, the framework currently doesn't support instantiating and deploying on external containers. </P> <P><SPAN STYLE="font-weight: normal">The test framework provides the following test container factories:</SPAN></P> <UL> <LI><P STYLE="margin-bottom: 0in">com.sun.jersey.test.framework.spi.container.http.HTTPContainerFactory<BR>For testing with the Light Weight HTTP server.</P> <LI><P STYLE="margin-bottom: 0in">com.sun.jersey.test.framework.spi.container.inmemory.InMemoryTestContainerFactory<BR>For testing in memory without using HTTP.</P> <LI><P STYLE="margin-bottom: 0in">com.sun.jersey.test.framework.spi.container.grizzly.GrizzlyTestContainerFactory<BR>For testing with low-level Grizzly.</P> <LI><P STYLE="margin-bottom: 0in">com.sun.jersey.test.framework.spi.container.grizzly.web.GrizzlyWebTestContainerFactory<BR>For testing with Web-based Grizzly.</P> <LI><P STYLE="margin-bottom: 0in">com.sun.jersey.test.framework.spi.container.embedded.glassfish.EmbeddedGlassFishTestContainerFactory<BR>For testing with embedded GlassFish v3. </P> <LI><P>com.sun.jersey.test.framework.spi.container.external.ExternalTestContainerFactory<BR>For testing with application deployed externally, for example to GlassFish or Tomcat. </P> </UL> <P><SPAN STYLE="font-weight: normal">The system property </SPAN><SPAN STYLE="font-weight: normal"><FONT FACE="Courier New, monospace">test.containerFactory</FONT></SPAN><SPAN STYLE="font-weight: normal"> is utilized to declare the default test container factory that shall be used for testing, the value of which is the fully qualified class name of a test container factory class. If the property is not declared then the GrizzlyWebTestContainerFactory is utilized as default test container factory.</SPAN></P> <P>To test a maven-based web project with an external container such as GlassFish, create the war file then deploy as follows (assuming that the pom file is set up for deployment):</P> <PRE STYLE="margin-left: 0.79in">mvn clean package -Dmaven.test.skip=true </PRE><P STYLE="font-weight: normal"> Then execute the tests as follows:</P> <PRE STYLE="margin-left: 0.79in">mvn test -Dtest.containerFactory=com.sun.jersey.test.framework.spi.container.external.ExternalTestContainerFactory -DJERSEY_HTTP_PORT=<HTTP_PORT> </PRE><P> <SPAN STYLE="background: #ffff00">Breaking changes from 1.1.1-ea to 1.1.2-ea</SPAN></P> <P>The maven project groupId has changed from “com.sun.jersey.test.framework” to “com.sun.jersey”.</P> <P>The extending of Jersey unit test and configuration has changed. See <A HREF="https://jersey.dev.java.net/nonav/apidocs/1.1.3-ea-SNAPSHOT/jersey-test-framework/com/sun/jersey/test/framework/package-summary.html">here</A> for an example.</P> <P>See the blog entry on <A HREF="http://blogs.sun.com/naresh/entry/jersey_test_framework_makes_it">Jersey Test Framework</A> for detailed instructions on how to use 1.1.1-ea version of the framework in your application.</P> </BODY> </HTML>