Skip to content

Commit 85fcc73

Browse files
committed
initial import
1 parent 1bd96f8 commit 85fcc73

File tree

260 files changed

+44971
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

260 files changed

+44971
-0
lines changed

changes.txt

+2,977
Large diffs are not rendered by default.

dependencies.html

+475
Large diffs are not rendered by default.

getting-started.html

+159
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2+
<HTML>
3+
<HEAD>
4+
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
5+
<TITLE>Getting Started</TITLE>
6+
<META NAME="GENERATOR" CONTENT="OpenOffice.org 3.0 Beta (Unix)">
7+
<META NAME="CREATED" CONTENT="0;0">
8+
<META NAME="CHANGED" CONTENT="20081008;15594200">
9+
<META NAME="Info 1" CONTENT="">
10+
<META NAME="Info 2" CONTENT="">
11+
<META NAME="Info 3" CONTENT="">
12+
<META NAME="Info 4" CONTENT="">
13+
</HEAD>
14+
<BODY LANG="en-US" DIR="LTR">
15+
<H1>Getting Started</H1>
16+
<P>This document will present how to get started with Jersey using
17+
the embedded Grizzly server. The last section of this document
18+
presents a reference to equivalent functionality for getting started
19+
with a Web application.</P>
20+
<P>First, it is necessary to depend on the correct Jersey artifacts
21+
as described in the <A HREF="dependencies.html">dependencies</A>
22+
document.</P>
23+
<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>
24+
module, 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>
25+
module and optionally for WADL support if using Java SE 5 the
26+
<A HREF="http://download.java.net/maven/1/com.sun.xml.bind/poms/jaxb-impl-2.1.pom">jaxb-impl</A>
27+
module. The following dependencies need to be added to the pom:</P>
28+
<PRE STYLE="margin-left: 0.79in">&lt;dependency&gt;
29+
&lt;groupId&gt;com.sun.jersey&lt;/groupId&gt;
30+
&lt;artifactId&gt;jersey-server&lt;/artifactId&gt;
31+
&lt;version&gt;1.1.3-ea-SNAPSHOT&lt;/version&gt;
32+
&lt;/dependency&gt;&lt;dependency&gt;
33+
&lt;groupId&gt;com.sun.grizzly&lt;/groupId&gt;
34+
&lt;artifactId&gt;grizzly-servlet-webserver&lt;/artifactId&gt;
35+
&lt;version&gt;1.9.8&lt;/version&gt;
36+
&lt;/dependency&gt;</PRE><P>
37+
And the following repositories need to be added to the pom:</P>
38+
<PRE STYLE="margin-left: 0.79in">&lt;repository&gt;
39+
&lt;id&gt;maven2-repository.dev.java.net&lt;/id&gt;
40+
&lt;name&gt;Java.net Repository for Maven&lt;/name&gt;
41+
&lt;url&gt;http://download.java.net/maven/2/&lt;/url&gt;
42+
&lt;layout&gt;default&lt;/layout&gt;
43+
&lt;/repository&gt;
44+
&lt;repository&gt;
45+
&lt;id&gt;maven-repository.dev.java.net&lt;/id&gt;
46+
&lt;name&gt;Java.net Maven 1 Repository (legacy)&lt;/name&gt;
47+
&lt;url&gt;http://download.java.net/maven/1&lt;/url&gt;
48+
&lt;layout&gt;legacy&lt;/layout&gt;
49+
&lt;/repository&gt;</PRE><P>
50+
Non-maven developers require:</P>
51+
<BLOCKQUOTE><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>,
52+
<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>,
53+
<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>,
54+
<A HREF="http://download.java.net/maven/2/javax/ws/rs/jsr311-api/1.0/jsr311-api-1.0.jar">jsr311-api.jar</A>,
55+
<A HREF="http://repo1.maven.org/maven2/asm/asm/3.1/asm-3.1.jar">asm.jar</A></BLOCKQUOTE>
56+
<P>and optionally for WADL support if using Java SE 5:</P>
57+
<BLOCKQUOTE><A HREF="http://download.java.net/maven/1/com.sun.xml.bind/jars/jaxb-impl-2.1.jar">jaxb-impl.jar</A>,
58+
<A HREF="http://download.java.net/maven/1/javax.xml.bind/jars/jaxb-api-2.1.jar">jaxb-api.jar</A>,
59+
<A HREF="http://download.java.net/maven/1/javax.activation/jars/activation-1.1.jar">activation.jar</A>,
60+
<A HREF="http://download.java.net/maven/1/javax.xml.stream/jars/stax-api-1.0-2.jar">stax-api.jar</A></BLOCKQUOTE>
61+
<BLOCKQUOTE STYLE="margin-left: 0in; margin-right: 0in">For Ant
62+
developers the <A HREF="http://maven.apache.org/ant-tasks.html">Ant
63+
Tasks for Maven</A> may be used to add the following to the ant
64+
document such that the dependencies do not need to be downloaded
65+
explicitly:</BLOCKQUOTE>
66+
<PRE STYLE="margin-left: 0.79in">&lt;artifact:dependencies pathId=&quot;dependency.classpath&quot;&gt;
67+
&lt;dependency groupId=&quot;com.sun.jersey&quot;
68+
artifactId=&quot;jersey-server&quot;
69+
version=&quot;1.1.3-ea-SNAPSHOT&quot;/&gt;
70+
&lt;dependency groupId=&quot;com.sun.grizzly&quot;
71+
artifactId=&quot;grizzly-servlet-webserver&quot;
72+
version=&quot;1.8.6.4&quot;/&gt;
73+
&lt;artifact:remoteRepository id=&quot;maven2-repository.dev.java.net&quot;
74+
url=&quot;http://download.java.net/maven/2/&quot; /&gt;
75+
&lt;artifact:remoteRepository id=&quot;maven-repository.dev.java.net&quot;
76+
url=&quot;http://download.java.net/maven/1&quot;
77+
layout=&quot;legacy&quot; /&gt;
78+
&lt;/artifact:dependencies&gt;</PRE><BLOCKQUOTE STYLE="margin-left: 0in; margin-right: 0in">
79+
The path id “dependency.classpath” may then be referenced as the
80+
classpath to be used for compiling or executing.</BLOCKQUOTE>
81+
<P>Second, create a new project (using your favourite IDE or just
82+
ant/maven) and add the dependences. (For those who want to skip the
83+
creation of their own project take a look at the last <A HREF="#created">section</A>
84+
of this document.)</P>
85+
<H1>Creating a root resource</H1>
86+
<P>Create the following Java class in your project:</P>
87+
<PRE> 1 // The Java class will be hosted at the URI path &quot;/helloworld&quot;
88+
2 @Path(&quot;/helloworld&quot;)
89+
3 public class HelloWorldResource {
90+
4
91+
5 // The Java method will process HTTP GET requests
92+
6 @GET
93+
7 // The Java method will produce content identified by the MIME Media
94+
8 // type &quot;text/plain&quot;
95+
9 @Produces(&quot;text/plain&quot;)
96+
10 public String getClichedMessage() {
97+
11 // Return some cliched textual content
98+
12 return &quot;Hello World&quot;;
99+
13 }
100+
14 }</PRE><P>
101+
The <CODE>HelloWorldResource</CODE> class is a very simple Web
102+
resource. The URI path of the resource is &quot;/helloworld&quot;
103+
(line 2), it supports the HTTP GET method (line 6) and produces
104+
cliched textual content (line 12) of the MIME media type &quot;text/plain&quot;
105+
(line 9).</P>
106+
<P>Notice the use of Java annotations to declare the URI path, the
107+
HTTP method and the media type. This is a key feature of JSR 311.</P>
108+
<H1>Deploying the root resource</H1>
109+
<P>The root resource will be deployed using the Grizzly Web
110+
container.</P>
111+
<P>Create the following Java class in your project:</P>
112+
<PRE> 1 public class Main {
113+
2
114+
3 public static void main(String[] args) throws IOException {
115+
4
116+
5 final String baseUri = &quot;http://localhost:9998/&quot;;
117+
6 final Map&lt;String, String&gt; initParams = new HashMap&lt;String, String&gt;();
118+
7
119+
8 initParams.put(&quot;com.sun.jersey.config.property.packages&quot;,
120+
9 &quot;com.sun.jersey.samples.helloworld.resources&quot;);
121+
10
122+
11 System.out.println(&quot;Starting grizzly...&quot;);
123+
12 SelectorThread threadSelector = GrizzlyWebContainerFactory.create(
124+
13 baseUri, initParams);
125+
14 System.out.println(String.format(
126+
15 &quot;Jersey app started with WADL available at %sapplication.wadl\n” +
127+
16 “Try out %shelloworld\nHit enter to stop it...&quot;, baseUri, baseUri));
128+
17 System.in.read();
129+
18 threadSelector.stopEndpoint();
130+
19 System.exit(0);
131+
20 }
132+
21 }</PRE><P>
133+
The <CODE>Main</CODE> class deploys the <CODE>HelloWorldResource</CODE>
134+
using the Grizzly Web container.</P>
135+
<P>Lines 8 to 9 creates an initialization parameter that informs the
136+
Jersey runtime where to search for root resource classes to be
137+
deployed. In this case it assumes the root resource class in the
138+
package <FONT FACE="Courier New, monospace">com.sun.jersey.samples.helloworld.resources</FONT>
139+
(or in a sub-package of).</P>
140+
<P>Lines 12 to 13 deploys the root resource to the base URI
141+
&quot;<A HREF="http://localhost:9998/">http://localhost:9998/</A>&quot;
142+
and returns a Grizzly SelectorThread. The complete URI of the Hello
143+
World root resource is &quot;<A HREF="http://localhost:9998/helloworld">http://localhost:9998/helloworld</A>&quot;.</P>
144+
<P>Notice that no deployment descriptors were needed and the root
145+
resource was setup in a few statements of Java code.</P>
146+
<H1>Testing the root resource</H1>
147+
<P>Goto the URI <A HREF="http://localhost:9998/helloworld">http://localhost:9998/helloworld</A>
148+
in your favourite browser.</P>
149+
<P>Or, from the command line use <CODE>curl:</CODE></P>
150+
<PRE STYLE="margin-bottom: 0.2in"><CODE> &gt; curl http://localhost:9998/helloworld</CODE></PRE><H1>
151+
<A NAME="created"></A>Here's one I created earlier</H1>
152+
<P>The example code presented above is shipped as the <A HREF="http://download.java.net/maven/2/com/sun/jersey/samples/helloworld/1.1.3-ea-SNAPSHOT/helloworld-1.1.3-ea-SNAPSHOT-project.zip">HelloWorld</A>
153+
sample in the Java.Net maven repository.</P>
154+
<P>For developers wishing to get started by deploying a Web
155+
application an equivalent sample, as a Web application, is shipped as
156+
the <A HREF="http://download.java.net/maven/2/com/sun/jersey/samples/helloworld-webapp/1.1.3-ea-SNAPSHOT/helloworld-webapp-1.1.3-ea-SNAPSHOT-project.zip">HelloWorld-WebApp</A>
157+
sample.</P>
158+
</BODY>
159+
</HTML>

jersey-client/pom.xml

+176
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
4+
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
5+
6+
Copyright (c) 2010-2013 Oracle and/or its affiliates. All rights reserved.
7+
8+
The contents of this file are subject to the terms of either the GNU
9+
General Public License Version 2 only ("GPL") or the Common Development
10+
and Distribution License("CDDL") (collectively, the "License"). You
11+
may not use this file except in compliance with the License. You can
12+
obtain a copy of the License at
13+
http://glassfish.java.net/public/CDDL+GPL_1_1.html
14+
or packager/legal/LICENSE.txt. See the License for the specific
15+
language governing permissions and limitations under the License.
16+
17+
When distributing the software, include this License Header Notice in each
18+
file and include the License file at packager/legal/LICENSE.txt.
19+
20+
GPL Classpath Exception:
21+
Oracle designates this particular file as subject to the "Classpath"
22+
exception as provided by Oracle in the GPL Version 2 section of the License
23+
file that accompanied this code.
24+
25+
Modifications:
26+
If applicable, add the following below the License Header, with the fields
27+
enclosed by brackets [] replaced by your own identifying information:
28+
"Portions Copyright [year] [name of copyright owner]"
29+
30+
Contributor(s):
31+
If you wish your version of this file to be governed by only the CDDL or
32+
only the GPL Version 2, indicate your decision by adding "[Contributor]
33+
elects to include this software in this distribution under the [CDDL or GPL
34+
Version 2] license." If you don't indicate a single choice of license, a
35+
recipient has the option to distribute your version of this file under
36+
either the CDDL, the GPL Version 2 or to extend the choice of license to
37+
its licensees as provided above. However, if you add GPL Version 2 code
38+
and therefore, elected the GPL Version 2 license, then the option applies
39+
only if the new code is made subject to such option by the copyright
40+
holder.
41+
42+
-->
43+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
45+
<modelVersion>4.0.0</modelVersion>
46+
47+
<parent>
48+
<groupId>com.sun.jersey</groupId>
49+
<artifactId>jersey-project</artifactId>
50+
<version>1.17.1</version>
51+
</parent>
52+
<artifactId>jersey-client</artifactId>
53+
<packaging>jar</packaging>
54+
<name>jersey-client</name>
55+
56+
<profiles>
57+
<profile>
58+
<id>release</id>
59+
<build>
60+
<plugins>
61+
<plugin>
62+
<groupId>org.apache.maven.plugins</groupId>
63+
<artifactId>maven-javadoc-plugin</artifactId>
64+
<configuration>
65+
<links>
66+
<link>http://jsr311.java.net/nonav/releases/1.1</link>
67+
</links>
68+
<excludePackageNames>com.sun.jersey.client.impl com.sun.ws.rs.ex</excludePackageNames>
69+
</configuration>
70+
</plugin>
71+
</plugins>
72+
</build>
73+
</profile>
74+
<profile>
75+
<id>cobertura</id>
76+
<activation>
77+
<property>
78+
<name>cobertura</name>
79+
</property>
80+
</activation>
81+
<dependencies>
82+
<dependency>
83+
<groupId>com.sun.jersey</groupId>
84+
<artifactId>jersey-core</artifactId>
85+
<version>${project.version}</version>
86+
<classifier>cobertura</classifier>
87+
</dependency>
88+
</dependencies>
89+
</profile>
90+
<profile>
91+
<id>default</id>
92+
<activation>
93+
<activeByDefault>true</activeByDefault>
94+
</activation>
95+
<dependencies>
96+
<dependency>
97+
<groupId>com.sun.jersey</groupId>
98+
<artifactId>jersey-core</artifactId>
99+
<version>${project.version}</version>
100+
</dependency>
101+
</dependencies>
102+
</profile>
103+
</profiles>
104+
105+
<dependencies>
106+
<dependency>
107+
<groupId>junit</groupId>
108+
<artifactId>junit</artifactId>
109+
<scope>test</scope>
110+
</dependency>
111+
<dependency>
112+
<groupId>com.sun.net.httpserver</groupId>
113+
<artifactId>http</artifactId>
114+
<version>20070405</version>
115+
<scope>test</scope>
116+
</dependency>
117+
<dependency>
118+
<groupId>org.osgi</groupId>
119+
<artifactId>osgi_R4_core</artifactId>
120+
<version>1.0</version>
121+
<scope>provided</scope>
122+
</dependency>
123+
</dependencies>
124+
125+
<build>
126+
<resources>
127+
<resource>
128+
<directory>${basedir}/src/main/java</directory>
129+
<includes>
130+
<include>META-INF/**/*</include>
131+
</includes>
132+
</resource>
133+
<resource>
134+
<directory>${basedir}/src/main/resources</directory>
135+
<filtering>true</filtering>
136+
</resource>
137+
</resources>
138+
139+
<plugins>
140+
141+
<plugin>
142+
<groupId>org.apache.maven.plugins</groupId>
143+
<artifactId>maven-compiler-plugin</artifactId>
144+
</plugin>
145+
146+
<plugin>
147+
<groupId>org.apache.felix</groupId>
148+
<artifactId>maven-bundle-plugin</artifactId>
149+
<extensions>true</extensions>
150+
<configuration>
151+
<instructions>
152+
<Import-Package>javax.mail.*;resolution:=optional, *</Import-Package>
153+
<Export-Package>com.sun.jersey.api.client.*,com.sun.jersey.client.*,com.sun.ws.rs.ext</Export-Package>
154+
</instructions>
155+
<unpackBundle>true</unpackBundle>
156+
</configuration>
157+
</plugin>
158+
159+
<plugin>
160+
<groupId>org.apache.maven.plugins</groupId>
161+
<artifactId>maven-source-plugin</artifactId>
162+
<executions>
163+
<execution>
164+
<id>attach-sources</id>
165+
<phase>package</phase>
166+
<goals>
167+
<goal>jar</goal>
168+
</goals>
169+
</execution>
170+
</executions>
171+
</plugin>
172+
173+
</plugins>
174+
</build>
175+
</project>
176+

jersey-client/src/docbook/client.xml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<chapter id="client">
2+
<title>Client</title>
3+
<para>
4+
TBD...
5+
</para>
6+
</chapter>
7+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.17.1

0 commit comments

Comments
 (0)