Debian Codegraph @

samples/simple-console/README.html

raw symbols SCIP
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>Simple Console Example</title></head>
44
45
46 <body>
47 <h1>Simple Console Example</h1>
48 <p>This example demonstrates how to develop RESTful web services with the
49 embedded Grizzly server.</p>
50
51 <h2>Contents</h2>
52 <p>The example consists of three Java classes and one HTML file:</p>
53 <dl>
54 <dt><code>com.sun.ws.rest.sample.console.Main</code></dt>
55 <dd>Contains the main function which starts and stops the HTTP server.</dd>
56 <dt><code>com.sun.jersey.samples.console.resource.Colours</code></dt>
57 <dd>A resource class that can produce two different representations of a
58 list of colors. The list can be filtered by a client-supplied query
59 parameter.
60 The resource references the Form resource using the
61 Path annotation declared on the Colours.getColours method.
62 </dd>
63 <dt><code>com.sun.jersey.samples.console.resource.Form</code></dt>
64 <dd>A resource class that produces a form in response to an HTTP GET,
65 processes the content of the form when submitted, and produces a
66 table of the submitted values in respose to the form being posted.</dd>
67 <dt><code>form.html</code></dt>
68 <dd>A static HTML file that is returned by the Form resource.</dd>
69 </dl>
70 <p>The mapping of the URI path space is presented in the following table:</p>
71 <table border="1">
72 <tr>
73 <th>URI path</th>
74 <th>Resource class</th>
75 <th>HTTP methods</th>
76 </tr>
77 <tr>
78 <td>/form</td>
79 <td>Form</td>
80 <td>GET, POST</td>
81 </tr>
82 <tr>
83 <td>/form/colours</td>
84 <td>Colours</td>
85 <td>GET</td>
86 </tr>
87 </table>
88
89 <h2>Running the Example</h2>
90 <p>Run the example as follows:</p>
91 <blockquote><pre>
92 mvn clean compile exec:java</pre></blockquote>
93
94 <p>From a web browser, visit:</p>
95 <blockquote><code><a href="http://127.0.0.1:9998/resources/form">http://127.0.0.1:9998/resources/form</a></code></blockquote>
96 <p>Fill in the form and submit it. Note that the pull-down list of colors
97 is populated dynamically. Enter part of a color name in the hint box
98 to see a filtered list of colors containing the hint.</p>
99 <p>You can see the complete list of colors at:</p>
100 <blockquote><code><a href="http://127.0.0.1:9998/resources/form/colours">http://127.0.0.1:9998/resources/form/colours</a></code></blockquote>
101 <p>Or see only those colors containing the letter 'r':</p>
102
103 <blockquote><code><a href="http://127.0.0.1:9998/resources/form/colours?match=r">http://127.0.0.1:9998/resources/form/colours?match=r</a></code></blockquote>
104 <p>A <a href="http://wadl.java.net/#spec">WADL description</a> may be accessed at the URL:</p>
105 <blockquote><code><a href="http://127.0.0.1:9998/resources/application.wadl">http://127.0.0.1:9998/resources/application.wadl</a></code></blockquote>
106
107 </body></html>