| 1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| 2 |
<!-- |
| 3 |
|
| 4 |
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
| 5 |
|
| 6 |
Copyright (c) 2010-2011 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 |
<html><head><title>Jersey-EJB Example</title></head> |
| 44 |
|
| 45 |
|
| 46 |
<body> |
| 47 |
<h1>Jersey EJB Example</h1> |
| 48 |
|
| 49 |
<p>This example demonstrates how to develop RESTful web service with a |
| 50 |
Servlet 3.0 container.</p> |
| 51 |
|
| 52 |
<h2>Contents</h2> |
| 53 |
<!-- |
| 54 |
See http://java.net/jira/browse/JERSEY-683 |
| 55 |
<p>TODO</p> |
| 56 |
<dl> |
| 57 |
<dt><code>TODO</code></dt> |
| 58 |
<dd>A resource class that produces a textual response to an HTTP GET.</dd> |
| 59 |
</dl> |
| 60 |
--> |
| 61 |
<p>The mapping of the URI path space is presented in the following table:</p> |
| 62 |
<table border="1"> |
| 63 |
<tbody> |
| 64 |
<tr> |
| 65 |
<th>URI path</th> |
| 66 |
<th>Resource class</th> |
| 67 |
<th>HTTP method</th> |
| 68 |
<th>Description</th> |
| 69 |
</tr> |
| 70 |
<tr> |
| 71 |
<td>/jersey-ejb</td> |
| 72 |
<td>---</td> |
| 73 |
<td>GET</td> |
| 74 |
<td>Simple html/ajax client</td> |
| 75 |
</tr> |
| 76 |
<tr> |
| 77 |
<td>/jersey-ejb/app/messages</td> |
| 78 |
<td>MessageBoardResourceBean</td> |
| 79 |
<td>GET</td> |
| 80 |
<td>Returns first ten messsages</td> |
| 81 |
</tr> |
| 82 |
<tr> |
| 83 |
<td>/jersey-ejb/app/messages/{id}</td> |
| 84 |
<td>MessageBoardResourceBean</td> |
| 85 |
<td>GET</td> |
| 86 |
<td>Returns message with uniqueId = {id} or returns HTTP 404 if |
| 87 |
message does not exist</td> |
| 88 |
</tr> |
| 89 |
<tr> |
| 90 |
<td>/jersey-ejb/app/messages/{id}</td> |
| 91 |
<td>MessageBoardResourceBean</td> |
| 92 |
<td>DELETE</td> |
| 93 |
<td>Deletes message with uniqueId = {id} or returns HTTP 404 if |
| 94 |
message does not exist</td> |
| 95 |
</tr> |
| 96 |
<tr> |
| 97 |
<td>/jersey-ejb/app/messages/<br> |
| 98 |
(with message as request entity)</td> |
| 99 |
<td>MessageBoardResourceBean</td> |
| 100 |
<td>POST</td> |
| 101 |
<td>Creates new message and allocates unique id for it</td> |
| 102 |
</tr> |
| 103 |
</tbody> |
| 104 |
</table> |
| 105 |
|
| 106 |
|
| 107 |
<h2>Running the Example</h2> |
| 108 |
|
| 109 |
<p>This sample utilizes Java EE 6 features of the GlassFish in Glassfish 3.1</p> |
| 110 |
|
| 111 |
<p>If you are working with Jersey GlassFish update center module installed into your existing GlassFish |
| 112 |
instance, |
| 113 |
you will need to follow instructions at <a href="../../README.html">the module README file</a> in order to |
| 114 |
deploy the example. |
| 115 |
|
| 116 |
<p>Otherwise, you can run the example using embedded GlassFish as follows:</p> |
| 117 |
|
| 118 |
<p>Build and deploy the project by executing maven 2 from the project directory</p> |
| 119 |
<blockquote><code>mvn clean package embedded-glassfish:run</code></blockquote> |
| 120 |
|
| 121 |
<p>From a web browser, visit:</p> |
| 122 |
<blockquote><code><a href="http://localhost:8080/jersey-ejb">http://localhost:8080/jersey-ejb</a></code> |
| 123 |
</blockquote> |
| 124 |
</body> |
| 125 |
</html> |