| 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-2012 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>Extended WADL WebApp Example</title></head> |
| 44 |
|
| 45 |
|
| 46 |
<body> |
| 47 |
<h1>Extended WADL WebApp Example</h1> |
| 48 |
|
| 49 |
<p>This example demonstrates how to get an extended WADL generated by jersey.</p> |
| 50 |
|
| 51 |
<h2>Contents</h2> |
| 52 |
<p>The description of what's done here you'll find in the |
| 53 |
<a href="https://wikis.oracle.com/display/Jersey/HowToConfigureExtendedWADL">jersey wiki</a>.</p> |
| 54 |
<p>Just as a pointer at which files you might have a look: |
| 55 |
<ul> |
| 56 |
<li>pom.xml</li> |
| 57 |
<li>src/main/webapp/WEB-INF/web.xml</li> |
| 58 |
<li>src/main/resources/*</li> |
| 59 |
<li>src/main/xsd/schema.xsd</li> |
| 60 |
<li>com.sun.jersey.samples.extendedwadl.SampleWadlGeneratorConfig |
| 61 |
</ul> |
| 62 |
|
| 63 |
<p>The mapping of the URI path space is presented in the following table:</p> |
| 64 |
<table border="1"> |
| 65 |
<tbody> |
| 66 |
<tr> |
| 67 |
<th>URI path</th> |
| 68 |
<th>Resource class</th> |
| 69 |
<th>HTTP method</th> |
| 70 |
<th>Description</th> |
| 71 |
</tr> |
| 72 |
<tr> |
| 73 |
<td>items</td> |
| 74 |
<td>ItemsResource</td> |
| 75 |
<td>POST</td> |
| 76 |
<td>Creates a new item and allocates a new unique URI for it, the new URI is returned back in the Location header</td> |
| 77 |
</tr> |
| 78 |
<tr> |
| 79 |
<td>items/{id}</td> |
| 80 |
<td>ItemResource</td> |
| 81 |
<td>GET</td> |
| 82 |
<td>Returns an item with the id={id}</td> |
| 83 |
</tr> |
| 84 |
<tr> |
| 85 |
<td>items/{id}/value/{val}</td> |
| 86 |
<td>ItemResource</td> |
| 87 |
<td>PUT</td> |
| 88 |
<td>Updates the value of the item with the id={id} with the new value {val}</td> |
| 89 |
</tr> |
| 90 |
</tbody> |
| 91 |
</table> |
| 92 |
|
| 93 |
<h2>Running the Example</h2> |
| 94 |
<p>If you are working with Jersey GlassFish update center module installed into your existing GlassFish instance, |
| 95 |
you will need to follow instructions at <a href="../../README.html">the module README file</a> in order to deploy the example. |
| 96 |
<p>Otherwise, you can run the example using embedded GlassFish as follows:</p> |
| 97 |
<p> run |
| 98 |
<blockquote><code>mvn clean package embedded-glassfish:run</code></blockquote> |
| 99 |
<p>or you can run the example using Jetty as follows:</p> |
| 100 |
<blockquote><code>mvn clean package jetty:run</code></blockquote> |
| 101 |
<p>Get the generated wadl via curl:</p> |
| 102 |
<blockquote><code>curl http://localhost:8080/extended-wadl-webapp/application.wadl</blockquote> |
| 103 |
<p>Or from a web browser, visit:</p> |
| 104 |
<blockquote><code><a href="http://localhost:8080/extended-wadl-webapp/application.wadl">http://localhost:8080/extended-wadl-webapp/application.wadl</a></code></blockquote> |
| 105 |
</body></html> |