Debian Codegraph @

tests/functional/jmaki-backend/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>jMaki Back-End Example</title></head>
44
45
46 <body>
47 <h1>jMaki Back-End Example</h1>
48 <p>This example demonstrates providing <a href="http://ajax.java.net">jMaki</a>
49 widget JSON data models as Jersey resources.
50 </p>
51 <p>The jMakiBackend application maintains a list of printers.
52 The list can be manipulated by an end user via a RESTful API.</p>
53 <p>Two resources are also available, which provides jMaki table and tree widgets
54 data models for the current data (printer list)</p>
55
56 <h2>Contents</h2>
57 <p>The example consists of the following:
58 </p><dl>
59 <dt><code>com.sun.jersey.samples.jmaki.resources.PrintersResource</code></dt>
60 <dd>This class is the core of the appliaction. It holds the data model (printer list)
61 and provides a RESTful interface for it.
62 </dd>
63 <dt><code>com.sun.jersey.samples.jmaki.beans.*</code></dt>
64 <dd>This package contains JAXB beans, which are used for Java to JSON
65 transformation. Besides the transformation, a <code>Printer</code> bean
66 is also a data model for a printer list row. The bean is encapsulated
67 in jMaki widget beans (<code>PrinterTableModel</code> and <code>TreeModel</code>).
68 </dd>
69 <dt><code>com.sun.jersey.samples.jmaki.config.JAXBContextResolver</code></dt>
70 <dd>Provides a configuration point for Java to JSON transformation.
71 </dd>
72 </dl>
73 <p>The mapping of the URI path space is presented in the following table:</p>
74 <table border="1">
75 <tr>
76 <th>URI path</th>
77 <th>Resource</th>
78 <th>HTTP methods</th>
79 </tr>
80 <tr>
81 <td>/printers</td>
82 <td>bootstrap resource</td>
83 <td>GET</td>
84 </tr>
85 <tr>
86 <td>/printers/list</td>
87 <td>a list of printers</td>
88 <td>GET</td>
89 </tr>
90 <tr>
91 <td>/printers/ids/{printerId}</td>
92 <td>a printer row</td>
93 <td>GET, PUT, DELETE</td>
94 </tr>
95 <tr>
96 <td>/printers/jMakiTree</td>
97 <td>jMaki Tree data model</td>
98 <td>GET</td>
99 </tr>
100 <tr>
101 <td>/printers/jMakiTable</td>
102 <td>jMaki Table data model</td>
103 <td>GET</td>
104 </tr>
105 </table>
106
107 <h2>Running the Example</h2>
108 <p>If you are working with Jersey GlassFish update center module installed into your existing GlassFish instance,
109 you will need to follow instructions at <a href="../../README.html">the module README file</a> in order to deploy the example.
110 <p>Otherwise, you can run the example using embedded GlassFish as follows:</p>
111 <blockquote><code>mvn clean package embedded-glassfish:run</code></blockquote>
112 <p>or you can run the example using Jetty as follows:</p>
113 <blockquote><code>mvn clean package jetty:run</code></blockquote>
114 <p>A <a href="http://wadl.java.net/#spec">WADL description</a> may be accessed at the URL:</p>
115 <blockquote><code><a href="http://localhost:8080/jMakiBackend/webresources/application.wadl">http://localhost:8080/jMakiBackend/webresources/application.wadl</a></code></blockquote>
116
117 <p>You can also see an initial sample list of printers at the URL:</p>
118 <blockquote><code><a href="http://localhost:8080/jMakiBackend/webresources/printers/list">http://localhost:8080/jMakiBackend/webresources/printers/list</a></code></blockquote>
119 <h2>jMaki Front-End</h2>
120 <p>To use the provided jMaki data models, you will need Netbeans 6.0 with jMaki plugin installed.
121 Then simply create a new WebApplication and select jMaki AJAX Framework for it.
122 You can than drag and drop appropriate widget (e.g.YahooTable)
123 from the jMaki widgets panel to your <code>index.jsp</code> page.
124 Then update the widget code to look like follows:
125 <pre>
126 &lt;a:widget name="yahoo.dataTable"
127 service="http://localhost:8080/jMakiBackend/webresources/printers/jMakiTable"/&gt;
128 </pre>
129 Then you should be able to run your web application and see the table on your index page.
130 A screenshot and further info is available at <a href="http://blogs.oracle.com/japod/entry/jmaki_widgets_talking_to_jersey">http://blogs.oracle.com/japod/entry/jmaki_widgets_talking_to_jersey</a>
131 </body></html>