incubator-wink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From el...@apache.org
Subject svn commit: r834791 [6/8] - in /incubator/wink/site/trunk/src/site: apt/ resources/1.0/html/ resources/1.0/html/attachments/ resources/1.0/html/attachments/2328628/ resources/1.0/html/attachments/2328642/ resources/1.0/html/attachments/2329360/ resourc...
Date Wed, 11 Nov 2009 07:39:50 GMT
Added: incubator/wink/site/trunk/src/site/resources/1.0/html/JAX-RS HTTP Headers.html
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/JAX-RS%20HTTP%20Headers.html?rev=834791&view=auto
==============================================================================
--- incubator/wink/site/trunk/src/site/resources/1.0/html/JAX-RS HTTP Headers.html (added)
+++ incubator/wink/site/trunk/src/site/resources/1.0/html/JAX-RS HTTP Headers.html Wed Nov 11 07:39:44 2009
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+    <head>
+        <title>Apache Wink : JAX-RS HTTP Headers</title>
+	    <link rel="stylesheet" href="styles/site.css" type="text/css" />
+        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">	    
+    </head>
+
+    <body>
+	    <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+		    <tr>
+			    <td valign="top" class="pagebody">
+				    <div class="pageheader">
+					    <span class="pagetitle">
+                            Apache Wink : JAX-RS HTTP Headers
+                                                    </span>
+				    </div>
+				    <div class="pagesubheading">
+					    This page last changed on Sep 22, 2009 by <font color="#0050B2">michael</font>.
+				    </div>
+
+				    <h1><a name="JAX-RSHTTPHeaders-HTTPHeaders"></a>HTTP Headers</h1>
+
+<p><a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html">HTTP headers</a> generally store metadata and control information.  There are some common headers shared in requests and responses but there are a few specific headers to either a request or a response.  Developers should read the HTTP specification for a complete understanding of HTTP headers.  Some of the more common HTTP headers are mentioned below in cases where JAX-RS provides convenient methods for the header.</p>
+
+<p>Generally, in order to get the request header name and values, developers can use either an injected @HeaderParam annotated with a parameter/field/property or an injected @Context HttpHeaders parameter/field/property.</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">@Path(<span class="code-quote">"/example"</span>)
+<span class="code-keyword">public</span> ExampleResource {
+    @Context HttpHeaders requestHeaders;
+
+    @GET
+    <span class="code-keyword">public</span> void getSomething(@HeaderParam(<span class="code-quote">"User-Agent"</span>) <span class="code-object">String</span> theUserAgent) {
+        /* use theUserAgent variable or requestHeader's methods to get more info */
+    }
+}
+</pre>
+</div></div>
+<p>In order to set response headers, developers can set them on a javax.ws.rs.core.Response return object.</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">@Path(<span class="code-quote">"/example"</span>)
+<span class="code-keyword">public</span> ExampleResource {
+    @GET
+    <span class="code-keyword">public</span> Response getSomething() {
+        <span class="code-keyword">return</span> Response.ok(/* some entity */).header(<span class="code-quote">"CustomHeader"</span>, <span class="code-quote">"CustomValue"</span>).build();
+    }
+}
+</pre>
+</div></div>
+<p>A response headers can be set when a MessageBodyWriter#writeTo() method is called.</p>
+
+<p><a name="JAX-RSHTTPHeaders-CommonHeaders"></a></p>
+
+<h3><a name="JAX-RSHTTPHeaders-CommonHeaders"></a>Common Headers</h3>
+
+<p>The common header specifies the size and type of a header. Every header must begin with the common header. The common header must not appear by itself.</p>
+
+<h5><a name="JAX-RSHTTPHeaders-ContentType"></a>Content-Type</h5>
+
+<p>The Content-Type signals the media type of the request/response entity. The Content-Type header on requests is read via HttpHeaders#getMediaType() method. The Content-Type is set for responses when doing a javax.ws.rs.core.Response.ResponseBuilder#type() method or a javax.ws.rs.core.Response.ResponseBuilder#variant() method.</p>
+
+<h5><a name="JAX-RSHTTPHeaders-ContentLanguage"></a>Content-Language</h5>
+
+<p>The Content-Language denotes what language the entity is in. In order to receive the request entity language, use the HttpHeaders#getLanguage() method. In order to set the response entity language, use the javax.ws.rs.core.Response.ResponseBuilder#language() method.</p>
+
+<h5><a name="JAX-RSHTTPHeaders-ContentLength"></a>Content-Length</h5>
+
+<p>The Content-Length is useful for determining the entity's length.  If possible, the MessageBodyWriter entity providers will automatically set the Content-Length if possible, and some containers will set the response Content-Length if the entity is small.</p>
+
+<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><b>Reference</b><br />Refer to the HTTP spec for more details on when this header is set and valid.</td></tr></table></div>
+
+<p><a name="JAX-RSHTTPHeaders-RequestHeaders"></a></p>
+
+<h3><a name="JAX-RSHTTPHeaders-CommonRequestHTTPHeaders"></a>Common Request HTTP Headers</h3>
+
+<p>An HTTP Request Header is a line of text that a client software (i.e. Web Browser) sends to a server together with other request data.</p>
+
+<h5><a name="JAX-RSHTTPHeaders-Accept"></a>Accept</h5>
+
+<p>The Accept header is used to determine the possible response representations that the client prefers such as XML over JSON but not plain text.  When a resource method is effectively annotated with a @Produces, any incoming request must have a compatible Accept header value for the resource method to be selected.  Clients can set quality parameters (priority ordering) for the best possible response and services generally try to honor the request.  To get the best representation of a response, use either the HttpHeaders#getAcceptableMediaTypes() or Request#selectVariant() methods.</p>
+
+<h5><a name="JAX-RSHTTPHeaders-AcceptLanguage"></a>Accept-Language</h5>
+
+<p>Like the Accept header, Accept-Language lists the preferred languages. A&nbsp; HttpHeaders#getAcceptableLanguages() method will list the acceptable languages in a preferred order.</p>
+
+<h5><a name="JAX-RSHTTPHeaders-IfMatchandIfNoneMatch"></a>If-Match and If-None-Match</h5>
+
+<p>If a previous response had an ETag header, the client can re-use the ETag value with the If-Match or If-None-Match request header to do conditional requests (if the server application supported the If-Match/If-None-Match headers).  For example, a POST with an If-Match header and an old ETag value should only execute the POST request if the old ETag value is still valid.  javax.ws.rs.core.Request#evaluatePreconditions() may help evaluate the If-Match and If-None-Match headers.</p>
+
+<h5><a name="JAX-RSHTTPHeaders-IfModifiedSinceandIfUnmodifiedSince"></a>If-Modified-Since and If-Unmodified-Since</h5>
+
+<p>Like ETags, If-Modified-Since and If-Unmodified-Since are based on the Last-Modified date.  Using either request header with a date, will set up a conditional request (if the server application supports the headers).  For instance, a GET with an If-Modified-Since header of an old known date would allow the server to send back a response with just a HTTP status code of 304 (Not Modified).  By sending back a HTTP status code of 304, the server is telling the client that the resource has not changed so there is no need to re-download the resource representation.  This could save precious bandwidth for the client.  javax.ws.rs.core.Request#evaluatePreconditions() may help evaluate the If-Modified-Since and If-Unmodified-Since headers.</p>
+
+<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><b>Important Note</b><br />Note that date formats are specified in the HTTP specification.</td></tr></table></div>
+
+<p><a name="JAX-RSHTTPHeaders-ResponseHeaders"></a></p>
+
+<h3><a name="JAX-RSHTTPHeaders-CommonResponseHTTPHeaders"></a>Common Response HTTP Headers</h3>
+
+<p>HTTP Headers form the core of an HTTP request, and are very important in an HTTP response. They define various characteristics of the data that is requested or the data that has been provided. The headers are separated from the request or response body by a blank line</p>
+
+<h5><a name="JAX-RSHTTPHeaders-ETag"></a>ETag</h5>
+
+<p>ETags or entity tags can be set.  Like a hashcode, it is given to the client so a client can use various control request headers such as If-Match and If-None-Match for conditional requests.  javax.ws.rs.core.Response.ResponseBuilder#tag() and javax.ws.rs.core.EntityTag are useful for ETags.</p>
+
+<h5><a name="JAX-RSHTTPHeaders-Expires"></a>Expires</h5>
+
+<p>The Expires response header indicates the amount of time that the response entity should be cached.  It is useful to set the expiration for data that is not going to change for a known time length.  Browsers use this response header to manage their caches among other user agents.The  javax.ws.rs.core.Response.ResponseBuilder#expires() method can be used to set the Expires header.</p>
+
+<h5><a name="JAX-RSHTTPHeaders-LastModified"></a>Last-Modified</h5>
+
+<p>Last-Modified specifies the date when the resource was changed.  A client can use the response value in combination with If-Modified-Since and If-Unmodified-Since request headers to perform conditional requests.The  javax.ws.rs.core.Response.ResponseBuilder#lastModified() method can be used to set the Last-Modified header.</p>
+<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><b>Important Note</b><br />Note that date formats are specified in the HTTP specification.</td></tr></table></div>
+
+
+<h5><a name="JAX-RSHTTPHeaders-Location"></a>Location</h5>
+
+<p>The Location response header usually indicates where the resource is located (in a redirect) or the URI of the new resource (when resources are created and usually in a HTTP 201 response).  The javax.ws.rs.core.Response.ResponseBuilder#location()method can be used to set the Location header.</p>
+
+				    
+                    			    </td>
+		    </tr>
+	    </table>
+	    <table border="0" cellpadding="0" cellspacing="0" width="100%">
+			<tr>
+				<td height="12" background="http://cwiki.apache.org/confluence/images/border/border_bottom.gif"><img src="images/border/spacer.gif" width="1" height="1" border="0"/></td>
+			</tr>
+		    <tr>
+			    <td align="center"><font color="grey">Document generated by Confluence on Nov 11, 2009 06:57</font></td>
+		    </tr>
+	    </table>
+    </body>
+</html>
\ No newline at end of file

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/JAX-RS HTTP Headers.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/JAX-RS Parameters.html
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/JAX-RS%20Parameters.html?rev=834791&view=auto
==============================================================================
--- incubator/wink/site/trunk/src/site/resources/1.0/html/JAX-RS Parameters.html (added)
+++ incubator/wink/site/trunk/src/site/resources/1.0/html/JAX-RS Parameters.html Wed Nov 11 07:39:44 2009
@@ -0,0 +1,156 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+    <head>
+        <title>Apache Wink : JAX-RS Parameters</title>
+	    <link rel="stylesheet" href="styles/site.css" type="text/css" />
+        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">	    
+    </head>
+
+    <body>
+	    <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+		    <tr>
+			    <td valign="top" class="pagebody">
+				    <div class="pageheader">
+					    <span class="pagetitle">
+                            Apache Wink : JAX-RS Parameters
+                                                    </span>
+				    </div>
+				    <div class="pagesubheading">
+					    This page last changed on Sep 22, 2009 by <font color="#0050B2">michael</font>.
+				    </div>
+
+				    <h1><a name="JAX-RSParameters-Parameters"></a>Parameters</h1>
+
+<p>Parameters are used to pass and add additional information to a request.  Search queries, offsets/pages in a collection, and other information can be used.  While parameters are sometimes used to add more verbs to HTTP, it is advised not to use parameters as a way to create new HTTP methods or to make existing HTTP methods break the generally understood attributes (i.e. idempotent).</p>
+
+<p>Parameters can be any basic Java primitive type including java.lang.String as well as types with a constructor that takes in a single String or a valueOf(String) static method.In addition, List, SortedSet, and Set can be used where the generic type is one of the previously mentioned types such as a <b>Set&lt;String&gt;</b> when a parameter can have multiple values.</p>
+
+<p>When full control is needed for parsing requests, it is generally recommend that developers use a String as the parameter type so that some basic inspection can be performed and developers can customize error path responses.</p>
+
+<p><a name="JAX-RSParameters-QueryParameter"></a></p>
+
+<h3><a name="JAX-RSParameters-QueryParameters%28@QueryParam%29"></a>Query Parameters (@QueryParam)</h3>
+
+<p>Query parameters are one of the better known parameters.  A query string is appended to the request URL with a leading "?" and then name/value pairs.</p>
+
+<div class='panelMacro'><table class='tipMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="images/icons/emoticons/check.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><b>Query Parameter Examples</b><br />Refer to the following links:<br/>
+<a href="http://www.google.com/search?q=apache+wink">http://www.google.com/search?q=apache+wink</a><br/>
+<a href="http://www.example.com/users?offset=100&amp;numPerPage=20">http://www.example.com/users?offset=100&amp;numPerPage=20</a>&nbsp;</td></tr></table></div>
+
+<p>In order to enable JAX-RS to read a query parameters, add a parameter to the resource method and annotate with <b>@QueryParam</b>:</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">@Path(<span class="code-quote">"/example"</span>)
+<span class="code-keyword">public</span> class RootResource {
+    @GET
+    <span class="code-keyword">public</span> Response invokeWithParameters(@QueryParam(<span class="code-quote">"q"</span>) <span class="code-object">String</span> searchTerm) {
+        <span class="code-keyword">if</span>(q == <span class="code-keyword">null</span>) {
+            <span class="code-keyword">return</span> Response.status(Status.BAD_REQUEST).build();
+        }
+        /* <span class="code-keyword">do</span> a search */
+        <span class="code-keyword">return</span> Response.ok(/* some entity here */).build();
+    }
+}
+</pre>
+</div></div>
+<p>If a HTTP GET request to "/example?q=abcd" is made, searchTerm will have "abcd" as the value when invoked.</p>
+
+<p><a name="JAX-RSParameters-PathParameter"></a></p>
+
+<h3><a name="JAX-RSParameters-PathParameters%28@PathParam%29"></a>Path Parameters (@PathParam)</h3>
+
+<p>Path parameters take the incoming URL and match parts of the path as a parameter.  By including <em>{name}</em> in a <b>@Path</b> annotation, the resource can later access the matching part of the URI to a path parameter with the corresponding "<b>name</b>".  Path parameters make parts of the request URL as parameters which can be useful in embedding request parameter information to a simple URL.</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">@Path(<span class="code-quote">"/books/{bookid}"</span>)
+<span class="code-keyword">public</span> class BookResource {
+    @GET
+    <span class="code-keyword">public</span> Response invokeWithBookId(@PathParam(<span class="code-quote">"bookid"</span>) <span class="code-object">String</span> bookId) {
+        /* get the info <span class="code-keyword">for</span> bookId */
+        <span class="code-keyword">return</span> Response.ok(/* some entity here */).build();
+    }
+
+    @GET
+    @Path(<span class="code-quote">"{language}"</span>)
+    <span class="code-keyword">public</span> Response invokeWithBookIdAndLanguage(@PathParam(<span class="code-quote">"bookid"</span>) <span class="code-object">String</span> bookId, @PathParam(<span class="code-quote">"language"</span>) <span class="code-object">String</span> language) {
+        /* get the info <span class="code-keyword">for</span> bookId */
+        <span class="code-keyword">return</span> Response.ok(/* some entity here */).build();
+    }
+}
+</pre>
+</div></div>
+<p>In the previous example, HTTP GET to /books/1 or to /books/abcd would result in invokeWithBookId being called.  If a HTTP GET request is issued to /books/1/en or /books/1/fr or /books/abcd/jp, then invokeWithBookIdAndLanguage would be invoked with the appropriate parameters.</p>
+
+<p><a name="JAX-RSParameters-MatrixParameter"></a></p>
+
+<h3><a name="JAX-RSParameters-MatrixParameters%28@MatrixParam%29"></a>Matrix Parameters (@MatrixParam)</h3>
+
+<p>Matrix parameters are not as widely used on the Internet today.  However, you can read a MatrixParam just as easily as any other parameter.</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">@Path(<span class="code-quote">"/"</span>)
+<span class="code-keyword">public</span> class RootResource {
+    @GET
+    <span class="code-keyword">public</span> Response invokeWithParameters(@MatrixParam(<span class="code-quote">"name"</span>) <span class="code-object">String</span> name) {
+        <span class="code-keyword">if</span>(name == <span class="code-keyword">null</span>) {
+            <span class="code-keyword">return</span> Response.status(Status.BAD_REQUEST).build();
+        }
+        <span class="code-keyword">return</span> Response.ok(/* some entity here */).build();
+    }
+}
+</pre>
+</div></div>
+<p><a name="JAX-RSParameters-HeaderParameter"></a></p>
+
+<h3><a name="JAX-RSParameters-HeaderParameters%28@HeaderParam%29"></a>Header Parameters (@HeaderParam)</h3>
+
+<p>Header parameters are useful especially when there are additional metadata control parameters that need to be passed in for example, security information, cache information, and so forth.</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">@Path(<span class="code-quote">"/"</span>)
+<span class="code-keyword">public</span> class RootResource {
+    @GET
+    <span class="code-keyword">public</span> Response invokeWithParameters(@HeaderParam(<span class="code-quote">"controlInfo"</span>) <span class="code-object">String</span> controlInfo) {
+        <span class="code-keyword">if</span>(controlInfo == <span class="code-keyword">null</span>) {
+            <span class="code-keyword">return</span> Response.status(Status.BAD_REQUEST).build();
+        }
+        <span class="code-keyword">return</span> Response.ok(/* some entity here */).build();
+    }
+}
+</pre>
+</div></div>
+
+<p><a name="JAX-RSParameters-CookieParameter"></a></p>
+
+<h3><a name="JAX-RSParameters-CookieParameters%28@CookieParam%29"></a>CookieParameters (@CookieParam)</h3>
+
+<p>In a REST application, requests are stateless although applications sometimes use Cookies for various reasons, such as adding some stateless resource viewing information without embedding it into the URL such as the maximum number of items to retrieve.  The CookieParam annotation is used to easily retrieve the information.</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">@Path(<span class="code-quote">"/"</span>)
+<span class="code-keyword">public</span> class RootResource {
+    @GET
+    <span class="code-keyword">public</span> Response invokeWithParameters(@CookieParam(<span class="code-quote">"max"</span>) <span class="code-object">String</span> maximumItems) {
+        <span class="code-keyword">if</span>(userId == <span class="code-keyword">null</span>) {
+            <span class="code-keyword">return</span> Response.status(Status.BAD_REQUEST).build();
+        }
+        <span class="code-keyword">return</span> Response.ok(/* some entity here */).build();
+    }
+}
+</pre>
+</div></div>
+
+				    
+                    			    </td>
+		    </tr>
+	    </table>
+	    <table border="0" cellpadding="0" cellspacing="0" width="100%">
+			<tr>
+				<td height="12" background="http://cwiki.apache.org/confluence/images/border/border_bottom.gif"><img src="images/border/spacer.gif" width="1" height="1" border="0"/></td>
+			</tr>
+		    <tr>
+			    <td align="center"><font color="grey">Document generated by Confluence on Nov 11, 2009 06:57</font></td>
+		    </tr>
+	    </table>
+    </body>
+</html>
\ No newline at end of file

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/JAX-RS Parameters.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/JAX-RS Request and Response Entities.html
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/JAX-RS%20Request%20and%20Response%20Entities.html?rev=834791&view=auto
==============================================================================
--- incubator/wink/site/trunk/src/site/resources/1.0/html/JAX-RS Request and Response Entities.html (added)
+++ incubator/wink/site/trunk/src/site/resources/1.0/html/JAX-RS Request and Response Entities.html Wed Nov 11 07:39:44 2009
@@ -0,0 +1,199 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+    <head>
+        <title>Apache Wink : JAX-RS Request and Response Entities</title>
+	    <link rel="stylesheet" href="styles/site.css" type="text/css" />
+        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">	    
+    </head>
+
+    <body>
+	    <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+		    <tr>
+			    <td valign="top" class="pagebody">
+				    <div class="pageheader">
+					    <span class="pagetitle">
+                            Apache Wink : JAX-RS Request and Response Entities
+                                                    </span>
+				    </div>
+				    <div class="pagesubheading">
+					    This page last changed on Oct 14, 2009 by <font color="#0050B2">michael</font>.
+				    </div>
+
+				    <h1><a name="JAX-RSRequestandResponseEntities-RequestandResponseEntities"></a>Request and Response Entities</h1>
+
+<p>Request and response entities represent the main part of an HTTP request.  Entities are also refered to as the "<b>message body</b>" or "<b>payload</b>".  Entities are sent via a request, usually an HTTP POST and PUT method are used or they are returned in a response, this is relevant for all HTTP methods.</p>
+
+<p>Unlike other distributed systems technologies, there is generally no wrapper around an entity.  For example, if a request is made for a binary PNG image represented here, <a href="http://example.com/user/abcd/portrait.png">http://example.com/user/abcd/portrait.png</a> , the response entity is only the PNG image binary data.</p>
+
+<p>Resource methods have a single entity parameter that represents the main entity body.  It is the <b>only unannotated parameter allowed</b> in a resource method.</p>
+
+<p>When using JAX-RS, request and response entites are mapped to and from Java types by Entity Providers that implement the JAX-RS interfaces, MessageBodyReader and MessageBodyWriter.  Applications may provide their own MessageBodyReaders and MessageBodyWriters that take precedent over the runtime provided ones.</p>
+
+<p><a name="JAX-RSRequestandResponseEntities-MediaType"></a></p>
+
+<h3><a name="JAX-RSRequestandResponseEntities-MediaTypes%28MIME%29andjavax.ws.rs.core.MediaType"></a>Media Types (MIME) and javax.ws.rs.core.MediaType</h3>
+
+<p>The request and response entity can be any form of data, a way of identifying what the entities bits and bytes represent is needed.  In requests and responses, the <b>Content-Type</b> HTTP header is used to indicate the type of entity currently being sent. The Content-Type value comes from a well known <a href="http://www.iana.org/assignments/media-types/">media type as registered in IANA</a>.</p>
+
+<p>Common content types include "text/plain", "text/xml", "text/html", and "application/json".</p>
+
+<p>Correct Content-Type values are essential for clients and servers.  "<b>Unusual</b>" behavior by clients such as browsers can be attributed to wrong content types.</p>
+
+<p>Media Types are also used in a request <b>Accept</b> header to indicate what type of resource representation the client wants to receive.  Clients could indicate a preference as well, such as JSON before XML.</p>
+
+<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><b>Reference</b><br />Refer to the HTTP spec regarding the Accept header and the Content Negotiation topic.</td></tr></table></div>
+
+
+<p>javax.ws.rs.core.MediaType has functionality and representations related to Media Types.</p>
+
+<p><a name="JAX-RSRequestandResponseEntities-ConsumesAndProduces"></a></p>
+
+<h3><a name="JAX-RSRequestandResponseEntities-@Consumesand@ProducesAnnotations"></a>@Consumes and @Produces Annotations</h3>
+
+
+<p>Annotating a class or a resource method with @Consumes and @Produces will help the JAX-RS runtime identify the appropriate methods to invoke for requests.  For example:</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">@Path(<span class="code-quote">"/example"</span>)
+<span class="code-keyword">public</span> RootResource {
+    @POST
+    @Consumes(<span class="code-quote">"text/xml"</span>)
+    @Produces(<span class="code-quote">"text/xml"</span>)
+    <span class="code-keyword">public</span> Response getOnlyXML(<span class="code-object">String</span> incomingXML) {
+        <span class="code-keyword">return</span> Response.ok(<span class="code-quote">"only xml"</span>).type(<span class="code-quote">"text/xml"</span>).build();
+    }
+
+    @GET
+    @Produces(<span class="code-quote">"text/html"</span>, <span class="code-quote">"text/plain"</span>)
+    <span class="code-keyword">public</span> <span class="code-object">String</span> getText() {
+        <span class="code-keyword">return</span> <span class="code-quote">"text representation"</span>;
+    }
+}
+</pre>
+</div></div>
+<p>In the previous code example, if a HTTP POST to "/example" was issued with a Content-Type header of "text/xml" and an Accept header of "text/xml", then the RootResource#getOnlyXML method would be invoked.  If the same POST request was issued with an Accept header of "text/plain", then a 406 Not Acceptable response would be generated by the JAX-RS runtime and the method would not be invoked.</p>
+
+<p>It is a good practice to return a javax.ws.rs.core.Response with a .type() or .variant() call since it would guarantee a return content type.  Notice that the above getText() code supports multiple data types.  A javax.ws.rs.core.Response object returned must have a single concrete Content-Type value.  In orer to select the best acceptable representation in the resource method, use either the <b>@Context HttpHeaders#getAcceptableMediaTypes()</b> or a <b>@Context Request#selectVariant()</b> method.</p>
+<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><b>Reference</b><br />Refer to the Context topic page for more information.</td></tr></table></div>
+
+<p>While resource methods may consume one media type for example XML and produce another such as JSON, most user requests expect the same media type that was sent in the request to be returned in the response.</p>
+
+<p>If the Content-Type header is empty and there is an entity, then the JAX-RS runtime will make the Content-Type be "<b>application/octet-stream</b>".  If an Accept header is empty, then according to the HTTP specification, the Accept header is equivalent to &#42;/&#42; which is a wildcard that matches anything.</p>
+
+<div class='panelMacro'><table class='tipMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="images/icons/emoticons/check.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><b>Important Note</b><br />Note that the resource method ultimately has control over the response content. If a javax.ws.rs.core.Response is returned, then the developer can return whatever Content-Type is desired. The @Consumes and @Produces is primarily useful only when processing request information and determining which resource method is possible to invoke. If a specific Response content type is not specified via a returned javax.ws.rs.core.Response object, the response media type is determined by a combination of the @Produces annotation values and the available MessageBodyWriters for the response entity's Java type. This can lead to undesired results if there is no @Produces annotation or if the @Produces annotation has multiple media types listed.<
 /td></tr></table></div>
+<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><b>Reference</b><br />Refer to the JAX-RS specification for the effective algorithm used.</td></tr></table></div>
+
+<p><a name="JAX-RSRequestandResponseEntities-JAXRSStandardEntityProviders"></a></p>
+
+<h3><a name="JAX-RSRequestandResponseEntities-JAXRSStandardEntityParameterTypes"></a>JAX-RS Standard Entity Parameter Types</h3>
+
+<p>JAX-RS requires certain parameters to be supported for virtually any content type.  The following table lists the supported content types:</p>
+
+<table class='confluenceTable'><tbody>
+<tr>
+<th class='confluenceTh'> Java Type </th>
+<th class='confluenceTh'> Content Type Supported </th>
+<th class='confluenceTh'> Special Notes </th>
+</tr>
+<tr>
+<td class='confluenceTd'> java.lang.String </td>
+<td class='confluenceTd'> &#42;/&#42; </td>
+</tr>
+<tr>
+<td class='confluenceTd'> byte[] </td>
+<td class='confluenceTd'> &#42;/&#42; </td>
+</tr>
+<tr>
+<td class='confluenceTd'> java.io.InputStream </td>
+<td class='confluenceTd'> &#42;/&#42; </td>
+</tr>
+<tr>
+<td class='confluenceTd'> java.io.Reader </td>
+<td class='confluenceTd'> &#42;/&#42; </td>
+</tr>
+<tr>
+<td class='confluenceTd'> java.io.File </td>
+<td class='confluenceTd'> &#42;/&#42; </td>
+</tr>
+<tr>
+<td class='confluenceTd'> javax.activation.DataSource </td>
+<td class='confluenceTd'> &#42;/&#42; </td>
+</tr>
+<tr>
+<td class='confluenceTd'> javax.xml.transform.Source </td>
+<td class='confluenceTd'> text/xml, application/xml, application/*+xml </td>
+</tr>
+<tr>
+<td class='confluenceTd'> javax.xml.bind.JAXBElement<br clear="all" />
+ and JAXB classes </td>
+<td class='confluenceTd'> text/xml, application/xml, application/*+xml </td>
+</tr>
+<tr>
+<td class='confluenceTd'> javax.ws.rs.core<br clear="all" />
+ .MultivaluedMap<br clear="all" />
+ &lt;String, String&gt; </td>
+<td class='confluenceTd'> application/x-www-form-urlencoded </td>
+</tr>
+<tr>
+<td class='confluenceTd'> javax.ws.rs<br clear="all" />
+ .core.StreamingOutput </td>
+<td class='confluenceTd'> &#42;/&#42; </td>
+<td class='confluenceTd'> As a writer only </td>
+</tr>
+</tbody></table>
+
+<p>Developers can use the previous Java types as entity parameters for requests and responses.</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">@Path(<span class="code-quote">"/example"</span>)
+<span class="code-keyword">public</span> class RootResource {
+
+    @GET
+    @Produces(<span class="code-quote">"text/xml"</span>)
+    <span class="code-keyword">public</span> Response getInfo() {
+        <span class="code-object">byte</span>[] entity = /* get the entity into a <span class="code-object">byte</span> array */
+        <span class="code-keyword">return</span> Response.ok(entity).type(<span class="code-quote">"text/xml"</span>).build();
+    }
+
+    @POST
+    @Consumes(<span class="code-quote">"application/json"</span>)
+    @Produces(<span class="code-quote">"application/json"</span>)
+    <span class="code-keyword">public</span> StreamingOutput createItem(InputStream requestBodyStream) {
+        /* read the requestBodyStream like a normal input stream */
+        <span class="code-keyword">return</span> <span class="code-keyword">new</span> StreamingOutput() {
+
+            <span class="code-keyword">public</span> void write(OutputStream output) <span class="code-keyword">throws</span> IOException, WebApplicationException {
+                <span class="code-object">byte</span>[] out = /* get some bytes to write */
+                output.write(out);
+            }
+        })
+    }
+}
+</pre>
+</div></div>
+<p><a name="JAX-RSRequestandResponseEntities-TransferEncoding"></a></p>
+
+<h3><a name="JAX-RSRequestandResponseEntities-TransferEncoding"></a>Transfer Encoding</h3>
+
+<p>Transfer or "<b>chunked</b>" encoding is handled by the container for incoming requests.  The container or the application must do any transfer encoding for outgoing responses.</p>
+
+<p><a name="JAX-RSRequestandResponseEntities-ContentEncoding"></a></p>
+
+<h3><a name="JAX-RSRequestandResponseEntities-ContentEncoding"></a>Content Encoding</h3>
+
+<p>Content for example "<b>gzip</b>" and or "<b>deflate</b>" encoding is handled by the application.  However, some containers handle content encoding for developers and will uncompress content automatically or will with various configuration set.  Check the  container documentation.</p>
+
+				    
+                    			    </td>
+		    </tr>
+	    </table>
+	    <table border="0" cellpadding="0" cellspacing="0" width="100%">
+			<tr>
+				<td height="12" background="http://cwiki.apache.org/confluence/images/border/border_bottom.gif"><img src="images/border/spacer.gif" width="1" height="1" border="0"/></td>
+			</tr>
+		    <tr>
+			    <td align="center"><font color="grey">Document generated by Confluence on Nov 11, 2009 06:57</font></td>
+		    </tr>
+	    </table>
+    </body>
+</html>
\ No newline at end of file

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/JAX-RS Request and Response Entities.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/JAX-RS Resources, HTTP Methods, and Paths.html
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/JAX-RS%20Resources%2C%20HTTP%20Methods%2C%20and%20Paths.html?rev=834791&view=auto
==============================================================================
--- incubator/wink/site/trunk/src/site/resources/1.0/html/JAX-RS Resources, HTTP Methods, and Paths.html (added)
+++ incubator/wink/site/trunk/src/site/resources/1.0/html/JAX-RS Resources, HTTP Methods, and Paths.html Wed Nov 11 07:39:44 2009
@@ -0,0 +1,233 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+    <head>
+        <title>Apache Wink : JAX-RS Resources, HTTP Methods, and Paths</title>
+	    <link rel="stylesheet" href="styles/site.css" type="text/css" />
+        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">	    
+    </head>
+
+    <body>
+	    <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+		    <tr>
+			    <td valign="top" class="pagebody">
+				    <div class="pageheader">
+					    <span class="pagetitle">
+                            Apache Wink : JAX-RS Resources, HTTP Methods, and Paths
+                                                    </span>
+				    </div>
+				    <div class="pagesubheading">
+					    This page last changed on Sep 07, 2009 by <font color="#0050B2">michael</font>.
+				    </div>
+
+				    <h1><a name="JAX-RSResources%2CHTTPMethods%2CandPaths-Resources"></a>Resources</h1>
+
+<p>Resources are one of the fundamental concepts in REST.  REST emphasizes the manipulation of resources rather than issuing function calls.  Resources have unique identifiers.  In HTTP terms, this means associating every resource with at least one URL.</p>
+
+<p>In order to manipulate a resource, requests are made with a specific HTTP method.  For instance, in order to retrieve a representation of a resource, an HTTP GET request to the resource's URL is issued. In order to create a new item in a collection, an HTTP POST can be used with the collection URL.</p>
+
+<p>Application developers define resources and the HTTP methods in order to quickly manipulate them by using regular plain old Java objects and JAX-RS annotations.</p>
+
+<p><a name="JAX-RSResources%2CHTTPMethods%2CandPaths-RootResource"></a></p>
+
+<h3><a name="JAX-RSResources%2CHTTPMethods%2CandPaths-DefiningaRootResource%28@PathonJavaclass%29"></a>Defining a Root Resource (@Path on Java class)</h3>
+
+<p>Developers can use POJOs to define a resource.  Root resources have a <b>@Path</b> annotation at the class declaration level.  JAX-RS matches an incoming request's URL with the <b>@Path</b> annotation on all of an application's root resources in order to determine which initial Java class will handle the request.</p>
+
+<p>Root resources Java class instances are created per request by default.</p>
+
+<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><b>Reference</b><br />Refer to the JAX-RS Application configuration topic for more information.</td></tr></table></div>
+<p>Resource classes have methods that are invoked when specific HTTP method requests are made, referred to as resource methods. In order to create Java methods that will be invoked with specific HTTP methods, a regular Java method must be implemented and annotated with one of the JAX-RS @HttpMethod annotated annotations (namely, @GET, @POST, @PUT, and @DELETE).</p>
+
+<p>For example, if a resource is located at a "/welcome" URL, the following root resource is defined.</p>
+
+<div class="code panel" style="border-style: solid;border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><b>WelcomeMessage.java</b></div><div class="codeContent panelContent">
+<pre class="code-java">@Path(<span class="code-quote">"/welcome"</span>)
+<span class="code-keyword">public</span> class WelcomeMessage {
+    <span class="code-keyword">private</span> <span class="code-object">String</span> welcomeMessage = <span class="code-quote">"Hello world!"</span>;
+
+    @GET
+    <span class="code-keyword">public</span> <span class="code-object">String</span> returnWelcomeMessage() {
+        <span class="code-keyword">return</span> welcomeMessage;
+    }
+}
+</pre>
+</div></div>
+<p>Any incoming GET request that has the URL of "/welcome" is handled by WelcomeMessage class's <b>returnWelcomeMessage()</b> method.  A string is returned that represents the response body and is sent as the response payload in a HTTP 200 status response.</p>
+
+<h3><a name="JAX-RSResources%2CHTTPMethods%2CandPaths-Usingajavax.ws.rs.core.Response"></a>Using a javax.ws.rs.core.Response</h3>
+
+<p>In the previous GET resource method example, the response body is returned as a String.  If a more complex response is requiredfor example, additional HTTP response headers or a different status code, a <b>javax.ws.rs.core.Response</b> should be used as the Java method's return type.  By building a Response object, additional information can be returned to the client.</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">@Path(<span class="code-quote">"/welcome"</span>)
+<span class="code-keyword">public</span> class WelcomeMessage {
+    <span class="code-keyword">private</span> <span class="code-object">String</span> welcomeMessage = <span class="code-quote">"Hello world!"</span>;
+
+    @GET
+    <span class="code-keyword">public</span> Response returnWelcomeMessage() {
+        <span class="code-object">String</span> responseEntity = welcomeMessage;
+        <span class="code-keyword">return</span> Response.status(299).entity(responseEntity).header(<span class="code-quote">"CustomHeader"</span>, <span class="code-quote">"CustomValue"</span>).build();
+    }
+}
+</pre>
+</div></div>
+<p>The previous example uses 299 as the status code, standard HTTP status codes should be used in order to help clients understand responses.When using Strings as the response entity, different Java types may be used for complex responses.</p>
+
+<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><b>Reference</b><br />Refer to the Request/Response entities page for more details on how request/response entities are handled.</td></tr></table></div>
+
+
+<p><a name="JAX-RSResources%2CHTTPMethods%2CandPaths-HTTPMethods"></a></p>
+
+<h3><a name="JAX-RSResources%2CHTTPMethods%2CandPaths-UsingCommonHTTPMethods%28@GET%2C@POST%2C@PUT%2C@DELETE%29"></a>Using Common HTTP Methods (@GET, @POST, @PUT, @DELETE)</h3>
+
+<p>The four most common HTTP methods are GET, POST, PUT, and DELETE.</p>
+
+<p>As shown in the previous example,  an HTTP GET response to "/welcome" invokes the  returnWelcomeMessage() Java method.In order&nbsp; to add a Java method that would be invoked when a HTTP PUT request is made to "/welcome", the following code should be added:</p>
+
+<div class="code panel" style="border-style: solid;border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><b>WelcomeMessageWithPut</b></div><div class="codeContent panelContent">
+<pre class="code-java">@Path(<span class="code-quote">"/welcome"</span>)
+<span class="code-keyword">public</span> class WelcomeMessage {
+    <span class="code-keyword">private</span> <span class="code-object">String</span> welcomeMessage = <span class="code-quote">"Hello world!"</span>;
+
+    @GET
+    <span class="code-keyword">public</span> <span class="code-object">String</span> returnWelcomeMessage() {
+        <span class="code-keyword">return</span> welcomeMessage;
+    }
+
+    @PUT
+    <span class="code-keyword">public</span> <span class="code-object">String</span> updateWelcomeMessage(<span class="code-object">String</span> aNewMessage) {
+        welcomeMessage = aNewMessage;
+    }
+}
+</pre>
+</div></div>
+<p>Notice that the updateWelcomeMessage has an unannotated parameter which represents an incoming request's body.</p>
+
+
+<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><b>Reference</b><br />Refer to the Request/Response entities page for more details on how request/response entities are handled.</td></tr></table></div>
+
+<p><a name="JAX-RSResources%2CHTTPMethods%2CandPaths-SubresourceMethod"></a></p>
+
+<h3><a name="JAX-RSResources%2CHTTPMethods%2CandPaths-SubresourceMethods%28@Pathand@GET%2C@POST%2C@PUT%2C@DELETEonaJavamethod%29"></a>Subresource Methods (@Path and @GET, @POST, @PUT, @DELETE on a Java method)</h3>
+
+<p>Sometimes it is easier having a root resource resolve a generic URL path and to have <b>@Path</b> annotated methods further resolve the request.  For instance, suppose that a HTTP GET to "/administrator" returned generic information about an administrator.  However, sometimes it is better to return smaller bits or more detailed information about the resource using a slightly different URL identifier.  Suppose that a HTTP GET to "/administrator/name" should return the name.  Instead of creating many root resource classes for each URL, you can have the root resource initially resolve the beginning of the URL request and then further resolve the request against subresource methods.</p>
+
+<p>Subresource methods are Java methods with a <b>@Path</b> annotation and a @HttpMethod annotated annotation (@GET, @POST, @PUT, @DELETE).</p>
+
+<div class="code panel" style="border-style: solid;border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><b>AdministratorResourceWithSubresourceMethod</b></div><div class="codeContent panelContent">
+<pre class="code-java">@Path(<span class="code-quote">"/administrator"</span>)
+<span class="code-keyword">public</span> class Administrator{
+
+    @GET
+    <span class="code-keyword">public</span> <span class="code-object">String</span> findUserInfo() {
+        <span class="code-object">String</span> userInfo = <span class="code-keyword">null</span>;
+        /* build user info */
+        <span class="code-keyword">return</span> userInfo;
+    }
+
+    @GET
+    @Path(<span class="code-quote">"/name"</span>)
+    <span class="code-keyword">public</span> <span class="code-object">String</span> getJustUserName() {
+        <span class="code-object">String</span> userName = "";
+        /* get the user name */
+        <span class="code-keyword">return</span> userName;
+    }
+
+    @GET
+    @Path(<span class="code-quote">"/id"</span>)
+    <span class="code-keyword">public</span> <span class="code-object">String</span> getUserId() {
+        <span class="code-object">String</span> userId = "";
+        /* get the user id */
+        <span class="code-keyword">return</span> userId;
+    }
+}
+</pre>
+</div></div>
+<p>An HTTP URL request to the <b>"/administrator"</b> would resolve to Administrator#findUserInfo().  A HTTP URL request to "/administrator/name" would invoke the Administrator#getJustUserName() method.  Finally a HTTP URL request to "/administrator/id" would resolve to Administrator#getUserId().</p>
+
+<p><a name="JAX-RSResources%2CHTTPMethods%2CandPaths-SubresourceLocator"></a></p>
+
+<h3><a name="JAX-RSResources%2CHTTPMethods%2CandPaths-UsingSubresourceLocators%28@PathonJavamethod%29"></a>Using Subresource Locators (@Path on Java method)</h3>
+
+
+<p>In more complicated scenarios, subresource locators are needed.  Subresource locators are particularly useful when requests must be further resolved by other objects. Subresource locators are Java methods which have only an <b>@Path</b> annotation.  They are different than subresource methods because they do <b>not</b> have any HTTP method annotation on them.</p>
+
+<p>A subresource locator returns an object that has JAX-RS annotations on its methods (or inherits them).  The object is used to further resolve the incoming requests by dynamically inspecting the object for JAX-RS annotations.</p>
+
+<p>This scenario uses @PathParams which are discussed on the parameters page.</p>
+
+<div class="code panel" style="border-style: solid;border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><b>UsersResourcesWithSubresourceLocators</b></div><div class="codeContent panelContent">
+<pre class="code-java">@Path(<span class="code-quote">"/users"</span>)
+<span class="code-keyword">public</span> class UsersCollection {
+
+    @Path(<span class="code-quote">"{userid}"</span>)
+    <span class="code-keyword">public</span> <span class="code-object">Object</span> findUserInfo(@PathParam(<span class="code-quote">"userid"</span>) <span class="code-object">String</span> userId) {
+        <span class="code-keyword">if</span>(userId.equals(<span class="code-quote">"superuser"</span>)) {
+            <span class="code-keyword">return</span> <span class="code-keyword">new</span> SuperUser();
+        }
+        <span class="code-keyword">return</span> User.findUserInDatabase(userId);
+    }
+}
+
+<span class="code-keyword">public</span> class Superuser {
+    @GET
+    <span class="code-keyword">public</span> <span class="code-object">String</span> getUserInfo() {
+       <span class="code-object">String</span> userInfo = /* get the user info */;
+       <span class="code-keyword">return</span> userInfo;
+    }
+
+    @GET
+    @Path(<span class="code-quote">"/contactinfo"</span>)
+    <span class="code-keyword">public</span> <span class="code-object">String</span> getContactInfo() {
+      <span class="code-object">String</span> contactInfo = /* get the user contact info */;
+      <span class="code-keyword">return</span> contactInfo;
+    }
+}
+
+<span class="code-keyword">public</span> class User {
+    <span class="code-keyword">protected</span> <span class="code-object">String</span> name;
+
+    <span class="code-keyword">protected</span> User() {
+        /* subresource locator object lifecycles are controlled by the developer */
+    }
+
+    <span class="code-keyword">public</span> <span class="code-keyword">static</span> User findUserInDatabase(<span class="code-object">String</span> userName) {
+        User u = /* get user from database with assigned field values */
+        <span class="code-keyword">return</span> u;
+    }
+
+    @GET
+    <span class="code-keyword">public</span> <span class="code-object">String</span> getInfo() {
+        <span class="code-object">String</span> info = /* get the user info */;
+        <span class="code-keyword">return</span> info;
+    }
+
+    @GET
+    @Path(<span class="code-quote">"/name"</span>)
+    <span class="code-keyword">public</span> <span class="code-object">String</span> getMyUserName() {
+        <span class="code-keyword">return</span> name;
+    }
+}
+
+</pre>
+</div></div>
+<p>A HTTP GET to "/users/superuser" would result in User#findUserInfo() being invoked first.  The method inspects the "userId" path parameter (which resolves to "superuser" for this request) so a Superuser object is returned.  The request is then further resolved against the Superuser object.  In the simple "/users/superuser" case, the request invokes Superuser#getUserInfo();</p>
+
+<p>If a HTTP GET to "/users/superuser/contactinfo" was made, then User#findUserInfo() is invoked and again returns a Superuser object.  The Superuser object is then used to resolve the "/contactinfo" portion of the request which invokes Superuser#getContactInfo.</p>
+
+<p>If a HTTP GET to "/users/user1/name" was made, then User#findUserInfo() is again invoked but it would go and look up the user from the database and return a User object.  The User object is then used to resolve the "/name" portion and results in the User#getMyUserName() method being invoked on the User object returned.</p>
+
+				    
+                    			    </td>
+		    </tr>
+	    </table>
+	    <table border="0" cellpadding="0" cellspacing="0" width="100%">
+			<tr>
+				<td height="12" background="http://cwiki.apache.org/confluence/images/border/border_bottom.gif"><img src="images/border/spacer.gif" width="1" height="1" border="0"/></td>
+			</tr>
+		    <tr>
+			    <td align="center"><font color="grey">Document generated by Confluence on Nov 11, 2009 06:57</font></td>
+		    </tr>
+	    </table>
+    </body>
+</html>
\ No newline at end of file

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/JAX-RS Resources, HTTP Methods, and Paths.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328628/2523206.png
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328628/2523206.png?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328628/2523206.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328628/2523207.png
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328628/2523207.png?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328628/2523207.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328628/2523208.png
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328628/2523208.png?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328628/2523208.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328628/2523209.png
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328628/2523209.png?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328628/2523209.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328628/2523211.jpg
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328628/2523211.jpg?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328628/2523211.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328628/2523229.pdf
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328628/2523229.pdf?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328628/2523229.pdf
------------------------------------------------------------------------------
    svn:mime-type = application/pdf

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328628/2523230.zip
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328628/2523230.zip?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328628/2523230.zip
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328628/2523231.pdf
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328628/2523231.pdf?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328628/2523231.pdf
------------------------------------------------------------------------------
    svn:mime-type = application/pdf

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328628/2523232.pdf
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328628/2523232.pdf?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328628/2523232.pdf
------------------------------------------------------------------------------
    svn:mime-type = application/pdf

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328628/2523233.zip
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328628/2523233.zip?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328628/2523233.zip
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328642/2523181.jpg
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328642/2523181.jpg?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328642/2523181.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328642/2523182.jpg
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328642/2523182.jpg?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2328642/2523182.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/2523203.jpg
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/2523203.jpg?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/2523203.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/2523204.jpg
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/2523204.jpg?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/2523204.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/2523205.jpg
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/2523205.jpg?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/2523205.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/2523210.jpg
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/2523210.jpg?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/2523210.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/2523212.jpg
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/2523212.jpg?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/2523212.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/2523213.jpg
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/2523213.jpg?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/2523213.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/2523214.jpg
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/2523214.jpg?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/2523214.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/2523215.jpg
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/2523215.jpg?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/2523215.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/2523216.jpg
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/2523216.jpg?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/2523216.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/3113001.jpg
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/3113001.jpg?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/3113001.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/3113002.jpg
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/3113002.jpg?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/3113002.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/3113003.jpg
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/3113003.jpg?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2329360/3113003.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851038/3112966.jpg
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851038/3112966.jpg?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851038/3112966.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851038/3112967.jpg
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851038/3112967.jpg?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851038/3112967.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851038/3112968.jpg
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851038/3112968.jpg?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851038/3112968.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851038/3801097.jpg
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851038/3801097.jpg?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851038/3801097.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851038/3801124.jpg
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851038/3801124.jpg?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851038/3801124.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851038/3801125.jpg
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851038/3801125.jpg?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851038/3801125.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851038/4751370.jpg
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851038/4751370.jpg?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851038/4751370.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851038/4751371.jpg
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851038/4751371.jpg?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851038/4751371.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851038/4751372.jpg
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851038/4751372.jpg?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851038/4751372.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851038/4751373.jpg
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851038/4751373.jpg?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851038/4751373.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851055/3112970.jpg
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851055/3112970.jpg?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851055/3112970.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851055/3112983.jpg
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851055/3112983.jpg?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851055/3112983.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851061/4751374.jpg
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851061/4751374.jpg?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851061/4751374.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851061/4751375.jpg
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851061/4751375.jpg?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2851061/4751375.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113127.java
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113127.java?rev=834791&view=auto
==============================================================================
--- incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113127.java (added)
+++ incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113127.java Wed Nov 11 07:39:44 2009
@@ -0,0 +1,23 @@
+package myPackage;
+
+import javax.ws.rs.core.MediaType;
+
+import org.apache.wink.client.Resource;
+import org.apache.wink.client.RestClient;
+import org.apache.wink.common.model.atom.AtomEntry;
+import org.apache.wink.common.model.atom.AtomFeed;
+
+public class ConsumeAtomUsingWink {
+
+    public static void main(String[] args) {
+        System.out.println("Consuming Atom Documents using Apache Wink...\n");
+        RestClient client = new RestClient();
+        Resource resource = client.resource("http://alexharden.org/blog/atom.xml");
+        AtomFeed feed = resource.accept(MediaType.APPLICATION_ATOM_XML).get(AtomFeed.class);
+        System.out.println(feed.getTitle().getValue());
+        for (AtomEntry entry : feed.getEntries()) {
+            System.out.println("\t" + entry.getTitle().getValue());
+        }
+    }
+
+}

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113127.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113128.xml
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113128.xml?rev=834791&view=auto
==============================================================================
--- incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113128.xml (added)
+++ incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113128.xml Wed Nov 11 07:39:44 2009
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
+  <display-name>ProduceAtom_Abdera</display-name>
+  <welcome-file-list>
+    <welcome-file>index.jsp</welcome-file>
+  </welcome-file-list>
+  <servlet>
+    <description></description>
+    <display-name>ProduceAtom</display-name>
+    <servlet-name>ProduceAtom</servlet-name>
+    <servlet-class>myPackage.ProduceAtomUsingAbdera</servlet-class>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>ProduceAtom</servlet-name>
+    <url-pattern>/ProduceAtom</url-pattern>
+  </servlet-mapping>
+</web-app>
\ No newline at end of file

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113128.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113129.java
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113129.java?rev=834791&view=auto
==============================================================================
--- incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113129.java (added)
+++ incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113129.java Wed Nov 11 07:39:44 2009
@@ -0,0 +1,28 @@
+package myPackage;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.apache.abdera.Abdera;
+import org.apache.abdera.model.Document;
+import org.apache.abdera.model.Entry;
+import org.apache.abdera.model.Feed;
+import org.apache.abdera.parser.ParseException;
+import org.apache.abdera.parser.Parser;
+
+public class ConsumeAtomUsingAbdera {
+
+    public static void main(String[] args) throws ParseException, IOException {
+        System.out.println("Consuming Atom Documents using Abdera...\n");
+        Abdera abdera = new Abdera();
+        Parser parser = abdera.getParser();
+        URL url = new URL("http://alexharden.org/blog/atom.xml");
+        Document<Feed> doc = parser.parse(url.openStream());
+        Feed feed = doc.getRoot();
+        System.out.println(feed.getTitle());
+        for (Entry entry : feed.getEntries()) {
+            System.out.println("\t" + entry.getTitle());
+        }
+    }
+
+}

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113129.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113130.java
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113130.java?rev=834791&view=auto
==============================================================================
--- incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113130.java (added)
+++ incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113130.java Wed Nov 11 07:39:44 2009
@@ -0,0 +1,65 @@
+package myPackage;
+
+import java.io.IOException;
+import java.util.Date;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.abdera.Abdera;
+import org.apache.abdera.model.Entry;
+import org.apache.abdera.model.Feed;
+
+/**
+ * Servlet implementation class ProduceAtom
+ */
+public class ProduceAtomUsingAbdera extends HttpServlet {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * @see HttpServlet#HttpServlet()
+     */
+    public ProduceAtomUsingAbdera() {
+        super();
+    }
+
+    /**
+     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
+     *      response)
+     */
+    protected void doGet(HttpServletRequest request, HttpServletResponse response)
+        throws ServletException, IOException {
+        Abdera abdera = new Abdera();
+        Feed feed = abdera.newFeed();
+
+        feed.setId("tag:example.org,2007:/foo");
+        feed.setTitle("Test Feed");
+        feed.setSubtitle("Feed subtitle");
+        feed.setUpdated(new Date());
+        feed.addAuthor("Shiva HR");
+        feed.addLink("http://example.com");
+        feed.addLink("http://example.com/foo", "self");
+
+        Entry entry = feed.addEntry();
+        entry.setId("tag:example.org,2007:/foo/entries/1");
+        entry.setTitle("Entry title");
+        entry.setSummaryAsHtml("<p>This is the entry title</p>");
+        entry.setUpdated(new Date());
+        entry.setPublished(new Date());
+        entry.addLink("http://example.com/foo/entries/1");
+
+        feed.getDocument().writeTo(response.getWriter());
+    }
+
+    /**
+     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
+     *      response)
+     */
+    protected void doPost(HttpServletRequest request, HttpServletResponse response)
+        throws ServletException, IOException {
+        doGet(request, response);
+    }
+
+}

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113130.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113131
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113131?rev=834791&view=auto
==============================================================================
--- incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113131 (added)
+++ incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113131 Wed Nov 11 07:39:44 2009
@@ -0,0 +1 @@
+myPackage.ProduceAtom
\ No newline at end of file

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113132.xml
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113132.xml?rev=834791&view=auto
==============================================================================
--- incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113132.xml (added)
+++ incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113132.xml Wed Nov 11 07:39:44 2009
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
+  <display-name>ProduceAtom_Wink</display-name>
+  <welcome-file-list>
+    <welcome-file>index.html</welcome-file>
+    <welcome-file>index.htm</welcome-file>
+    <welcome-file>index.jsp</welcome-file>
+    <welcome-file>default.html</welcome-file>
+    <welcome-file>default.htm</welcome-file>
+    <welcome-file>default.jsp</welcome-file>
+  </welcome-file-list>
+  <servlet>
+    <description></description>
+    <display-name>ProduceAtom</display-name>
+    <servlet-name>ProduceAtom</servlet-name>
+    <servlet-class>myPackage.ProduceAtomUsingWink</servlet-class>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>ProduceAtom</servlet-name>
+    <url-pattern>/ProduceAtom</url-pattern>
+  </servlet-mapping>
+</web-app>
\ No newline at end of file

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113132.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113133.xml
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113133.xml?rev=834791&view=auto
==============================================================================
--- incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113133.xml (added)
+++ incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113133.xml Wed Nov 11 07:39:44 2009
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+	id="WebApp_ID" version="2.5">
+	<display-name>ProduceAtom_Wink_Elegant</display-name>
+	<welcome-file-list>
+		<welcome-file>index.jsp</welcome-file>
+	</welcome-file-list>
+
+	<servlet>
+		<servlet-name>restSdkService</servlet-name>
+		<servlet-class>org.apache.wink.server.internal.servlet.RestServlet</servlet-class>
+		<init-param>
+			<param-name>applicationConfigLocation</param-name>
+			<param-value>/WEB-INF/application</param-value>
+		</init-param>
+	</servlet>
+
+	<servlet-mapping>
+		<servlet-name>restSdkService</servlet-name>
+		<url-pattern>/rest/*</url-pattern>
+	</servlet-mapping>
+</web-app>
\ No newline at end of file

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113133.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113134.java
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113134.java?rev=834791&view=auto
==============================================================================
--- incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113134.java (added)
+++ incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113134.java Wed Nov 11 07:39:44 2009
@@ -0,0 +1,86 @@
+package myPackage;
+
+import java.io.IOException;
+import java.util.Date;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.wink.common.model.atom.AtomEntry;
+import org.apache.wink.common.model.atom.AtomFeed;
+import org.apache.wink.common.model.atom.AtomLink;
+import org.apache.wink.common.model.atom.AtomPerson;
+import org.apache.wink.common.model.atom.AtomText;
+import org.apache.wink.common.model.atom.AtomTextType;
+
+/**
+ * Servlet implementation class ProduceAtom
+ */
+public class ProduceAtomUsingWink extends HttpServlet {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * @see HttpServlet#HttpServlet()
+     */
+    public ProduceAtomUsingWink() {
+        super();
+    }
+
+    /**
+     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
+     *      response)
+     */
+    protected void doGet(HttpServletRequest request, HttpServletResponse response)
+        throws ServletException, IOException {
+        AtomFeed feed = new AtomFeed();
+        feed.setId("tag:example.org,2007:/foo");
+        feed.setTitle(new AtomText("Test Feed"));
+        feed.setSubtitle(new AtomText("Feed subtitle"));
+        feed.setUpdated(new Date());
+
+        AtomPerson person = new AtomPerson();
+        person.setName("Shiva HR");
+        feed.getAuthors().add(person);
+
+        AtomLink link1 = new AtomLink();
+        link1.setHref("http://example.com");
+        feed.getLinks().add(link1);
+
+        AtomLink link2 = new AtomLink();
+        link2.setHref("http://example.com/foo");
+        link2.setRel("self");
+        feed.getLinks().add(link2);
+
+        AtomEntry entry = new AtomEntry();
+        entry.setId("tag:example.org,2007:/foo/entries/1");
+        entry.setTitle(new AtomText("Entry title"));
+
+        AtomText summary = new AtomText();
+        summary.setType(AtomTextType.html);
+        summary.setValue("<p>This is the entry title</p>");
+        entry.setSummary(summary);
+
+        entry.setUpdated(new Date());
+        entry.setPublished(new Date());
+
+        AtomLink link3 = new AtomLink();
+        link3.setHref("http://example.com/foo/entries/1");
+        entry.getLinks().add(link3);
+
+        feed.getEntries().add(entry);
+
+        AtomFeed.marshal(feed, response.getOutputStream());
+    }
+
+    /**
+     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
+     *      response)
+     */
+    protected void doPost(HttpServletRequest request, HttpServletResponse response)
+        throws ServletException, IOException {
+        doGet(request, response);
+    }
+
+}

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113134.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message