Author: buildbot
Date: Fri Jun 23 13:47:25 2017
New Revision: 1014391

Log:
Production update by buildbot for cxf

Modified:
    websites/production/cxf/content/cache/docs.pageCache
    websites/production/cxf/content/docs/jax-rs-basics.html

Modified: websites/production/cxf/content/cache/docs.pageCache
==============================================================================
Binary files - no diff available.

Modified: websites/production/cxf/content/docs/jax-rs-basics.html
==============================================================================
--- websites/production/cxf/content/docs/jax-rs-basics.html (original)
+++ websites/production/cxf/content/docs/jax-rs-basics.html Fri Jun 23 13:47:25 
2017
@@ -117,12 +117,15 @@ Apache CXF -- JAX-RS Basics
          <td height="100%">
            <!-- Content -->
            <div class="wiki-content">
-<div id="ConfluenceContent"><p><span class="inline-first-p" 
style="font-size:2em;font-weight:bold">JAX-RS : Understanding the 
Basics</span>&#160;</p><p>&#160;</p><p><style type="text/css">/*<![CDATA[*/
-div.rbtoc1472204820621 {padding: 0px;}
-div.rbtoc1472204820621 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1472204820621 li {margin-left: 0px;padding-left: 0px;}
+<div id="ConfluenceContent"><p><span 
style="font-size:2em;font-weight:bold">JAX-RS : Understanding the Basics</span>
 
-/*]]>*/</style></p><div class="toc-macro rbtoc1472204820621">
+
+&#160;</p><p>&#160;</p><p><style type="text/css">/*<![CDATA[*/
+div.rbtoc1498225612721 {padding: 0px;}
+div.rbtoc1498225612721 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1498225612721 li {margin-left: 0px;padding-left: 0px;}
+
+/*]]>*/</style></p><div class="toc-macro rbtoc1498225612721">
 <ul class="toc-indentation"><li><a shape="rect" 
href="#JAX-RSBasics-WhatisNewinJAX-RS2.0">What is New in JAX-RS 2.0</a>
 <ul class="toc-indentation"><li><a shape="rect" 
href="#JAX-RSBasics-Filters">Filters</a>
 <ul class="toc-indentation"><li><a shape="rect" 
href="#JAX-RSBasics-Server">Server</a></li><li><a shape="rect" 
href="#JAX-RSBasics-Client">Client</a></li></ul>
@@ -144,7 +147,7 @@ div.rbtoc1472204820621 li {margin-left:
 </li><li><a shape="rect" href="#JAX-RSBasics-MessageBodyProviders">Message 
Body Providers</a>
 <ul class="toc-indentation"><li><a shape="rect" 
href="#JAX-RSBasics-CustomMessageBodyProviders">Custom Message Body 
Providers</a></li><li><a shape="rect" 
href="#JAX-RSBasics-Registeringcustomproviders">Registering custom 
providers</a></li></ul>
 </li><li><a shape="rect" 
href="#JAX-RSBasics-Customizingmediatypesformessagebodyproviders">Customizing 
media types for message body providers</a></li><li><a shape="rect" 
href="#JAX-RSBasics-AdvancedHTTP">Advanced HTTP</a></li></ul>
-</div><h1 id="JAX-RSBasics-WhatisNewinJAX-RS2.0">What is New in JAX-RS 
2.0</h1><h2 id="JAX-RSBasics-Filters">Filters</h2><h3 
id="JAX-RSBasics-Server">Server</h3><p><a shape="rect" class="external-link" 
href="https://jax-rs-spec.java.net/nonav/2.0/apidocs/javax/ws/rs/container/ContainerRequestFilter.html";
 rel="nofollow">ContainerRequestFilter</a> and <a shape="rect" 
class="external-link" 
href="https://jax-rs-spec.java.net/nonav/2.0/apidocs/javax/ws/rs/container/ContainerResponseFilter.html";
 rel="nofollow">ContainerResponseFilter</a> are new server-side request and 
response filters which can be used to customize various properties of a given 
request and response.</p><p>ContainerRequestFilter annotated with a <a 
shape="rect" class="external-link" 
href="https://jax-rs-spec.java.net/nonav/2.0/apidocs/javax/ws/rs/container/PreMatching.html";
 rel="nofollow">PreMatching</a> annotation will be run before the runtime has 
matched a request to a specific JAX-RS root resource and method. Prematch
 ing filters can be used to affect the matching process.</p><p>The request 
filters without the PreMatching annotation will run after the JAX-RS resource 
method has been selected.</p><p>ContainerRequestFilter can be used to <a 
shape="rect" class="external-link" 
href="https://jax-rs-spec.java.net/nonav/2.0/apidocs/javax/ws/rs/container/ContainerRequestContext.html#abortWith(javax.ws.rs.core.Response)"
 rel="nofollow">block</a> a request.</p><p>The filters can be bound to 
individual resource methods only with the help of custom <a shape="rect" 
class="external-link" 
href="https://jax-rs-spec.java.net/nonav/2.0/apidocs/javax/ws/rs/NameBinding.html";
 rel="nofollow">NameBinding</a>s.</p><p>Multiple request and response filters 
can be executed in the specific order by using javax.annotation.Priority 
annotations. See <a shape="rect" class="external-link" 
href="https://jax-rs-spec.java.net/nonav/2.0/apidocs/javax/ws/rs/Priorities.html";
 rel="nofollow">Priorities</a> for more information. Request 
 filters are sorted in the ascending order, response filters - in the 
descending order.</p><h3 id="JAX-RSBasics-Client">Client</h3><p><a shape="rect" 
class="external-link" 
href="https://jax-rs-spec.java.net/nonav/2.0/apidocs/javax/ws/rs/client/ClientRequestFilter.html";
 rel="nofollow">ClientRequestFilter</a> and <a shape="rect" 
class="external-link" 
href="https://jax-rs-spec.java.net/nonav/2.0/apidocs/javax/ws/rs/client/ClientResponseFilter.html";
 rel="nofollow">ClientResponseFilter</a> are new client-side request and 
response filters which can be used to customize various properties of a given 
request and response.</p><p>ClientRequestFilter can be used to <a shape="rect" 
class="external-link" 
href="https://jax-rs-spec.java.net/nonav/2.0/apidocs/javax/ws/rs/client/ClientRequestContext.html#abortWith(javax.ws.rs.core.Response)"
 rel="nofollow">block</a> a request.</p><p>Request filters are sorted in the 
ascending order, response filters - in the descending order. See <a 
shape="rect" clas
 s="external-link" 
href="https://jax-rs-spec.java.net/nonav/2.0/apidocs/javax/ws/rs/Priorities.html";
 rel="nofollow">Priorities</a> for more information.</p><h2 
id="JAX-RSBasics-Interceptors">Interceptors</h2><p><a shape="rect" 
class="external-link" 
href="https://jax-rs-spec.java.net/nonav/2.0/apidocs/javax/ws/rs/ext/ReaderInterceptor.html";
 rel="nofollow">ReaderInterceptor</a> and <a shape="rect" class="external-link" 
href="https://jax-rs-spec.java.net/nonav/2.0/apidocs/javax/ws/rs/ext/WriterInterceptor.html";
 rel="nofollow">WriterInterceptor</a> can be used in addition to filters or on 
its own to customize requests and responses on server and client 
sides.</p><p>Interceptors can be useful to customize the reading/writing 
process and block JAX-RS MessageBodyWriter or MessageBodyReader 
providers.</p><p>The interceptors used on the server side can be bound to 
individual resource methods only with the help of custom <a shape="rect" 
class="external-link" href="https://jax-rs-spec.java.net/
 nonav/2.0/apidocs/javax/ws/rs/NameBinding.html" 
rel="nofollow">NameBinding</a>s.</p><p>All interceptors are sorted in the 
ascending order. See <a shape="rect" class="external-link" 
href="https://jax-rs-spec.java.net/nonav/2.0/apidocs/javax/ws/rs/Priorities.html";
 rel="nofollow">Priorities</a> for more information.</p><h2 
id="JAX-RSBasics-DynamicFeatures">Dynamic Features</h2><p><a shape="rect" 
class="external-link" 
href="https://jax-rs-spec.java.net/nonav/2.0/apidocs/javax/ws/rs/container/DynamicFeature.html";
 rel="nofollow">Dynamic Feature</a> is a server side feature that can be used 
to attach request and response filters as well as reader and writer 
interceptors to specific resource methods. It is an alternative approach to 
using the NameBindings and offer a finer-grained control over the binding 
process.</p><h2 id="JAX-RSBasics-Exceptions">Exceptions</h2><p>Dedicated 
exception classes representing various HTTP error or redirect conditions have 
been introduced, see the 'javax.ws.rs
 ' Package <a shape="rect" class="external-link" 
href="https://jax-rs-spec.java.net/nonav/2.0/apidocs/javax/ws/rs/package-frame.html";
 rel="nofollow">Exceptions section</a>.</p><p>For example, instead of throwing 
a "new WebApplicationException(404)" one is better to do "new 
NotFoundException()". The finer-grained exception hierarchy allows for a 
finer-grained support of exception mappers. It also opens a way to check 
WebApplicationException and all of its subclasses when catching the HTTP 
exceptions on the client side.</p><p>Note that on the client side, 
ProcessingException can be used to catch client-related exceptions while 
ResponseProcessingException can be used to narrow down the client side 
exceptions specifically related to processing the response message.</p><h2 
id="JAX-RSBasics-Suspendedinvocations">Suspended invocations</h2><p>One of the 
best JAX-RS 2.0 features is the support for server-side asynchronous 
invocations. Please see the <a shape="rect" class="external-link" href=
 
"https://jax-rs-spec.java.net/nonav/2.0/apidocs/javax/ws/rs/container/AsyncResponse.html";
 rel="nofollow">AsyncResponse</a> documentation which provides a very good 
overview of this feature.</p><p>See also this <a shape="rect" 
class="external-link" 
href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookContinuationStore.java";>test
 resource</a>.</p><p>Typically, the resource method accepting AsyncResponse 
will either store it and start a new thread to finish the request, the method 
will return and the invocation will be suspended, then eventually another 
thread (either the one which initiated an internal job or some other thread) 
will resume the suspended call. Note in this case the invocation will be 
suspended indefinitely until it is resumed.</p><p>Another approach is to have 
AsyncResponse suspended for a limited period of time only and also register a 
<a shape="rect" class="external-link" href="https://jax-rs-spec.java.net/nona
 v/2.0/apidocs/javax/ws/rs/container/TimeoutHandler.html" 
rel="nofollow">TimeoutHandler</a>. The latter will be invoked when the 
invocation is resumed by the container after the timeout has expired and the 
handler will either complete the invocation or suspend it again till it is 
ready to finish it.</p><p><a shape="rect" class="external-link" 
href="https://jax-rs-spec.java.net/nonav/2.0/apidocs/javax/ws/rs/container/CompletionCallback.html";
 rel="nofollow">CompletionCallback</a> can be registered with AsyncResponse to 
receive the notifications when the async response has been sent back.</p><p><a 
shape="rect" class="external-link" 
href="https://jax-rs-spec.java.net/nonav/2.0/apidocs/javax/ws/rs/container/ConnectionCallback.html";
 rel="nofollow">ConnectionCallback</a> is supported starting from CXF 
3.0.0-milestone2.</p><p>This feature can help developers write very 
sophisticated asynchronous applications.</p><p>Please also see the page about 
CXF <a shape="rect" href="continuations.html">
 Continuations</a> API which JAX-RS 2.0 AsyncResponse implementation is based 
upon and <br clear="none"> <a shape="rect" 
href="http://cxf.apache.org/docs/servlet-transport.html";>how to configure</a> 
CXFServlet.</p><h2 id="JAX-RSBasics-Parameterconverters">Parameter 
converters</h2><p><a shape="rect" class="external-link" 
href="https://jax-rs-spec.java.net/nonav/2.0/apidocs/javax/ws/rs/ext/ParamConverterProvider.html";
 rel="nofollow">ParamConverterProvider</a> can be used to manage the conversion 
of custom Objects to String and vice versa on the server and client sides, when 
processing JAX-RS parameters representing URI parts or headers or form elements 
and when a default conversion mechanism does not work. For example, 
java.util.Date constructor accepting a String may have to be replaced a custom 
ParamConverter.</p><h2 id="JAX-RSBasics-Beanparameters">Bean 
parameters</h2><p><a shape="rect" class="external-link" 
href="https://jax-rs-spec.java.net/nonav/2.0/apidocs/javax/ws/rs/BeanParam.
 html" rel="nofollow">BeanParam</a> can be used to get JAX-RS parameters 
representing URI parts or headers or form elements and also contexts injected 
into a single bean container.</p><p>Note the CXF extension supporting the 
injection of all the parameters of specific JAX-RS type (example, 
QueryParam("") MyBean) is different, it only allows to get all the query 
parameters injected, but it also does not require that bean properties are 
annotated with QueryParam/etc annotations.</p><h2 
id="JAX-RSBasics-ResourceInfo">ResourceInfo</h2><p><a shape="rect" 
class="external-link" 
href="https://jax-rs-spec.java.net/nonav/2.0/apidocs/javax/ws/rs/container/ResourceInfo.html";
 rel="nofollow">ResourceInfo</a> is a new JAX-RS context which can be injected 
into filters and interceptors and checked which resource class and method are 
about to be invoked.</p><h2 
id="JAX-RSBasics-Injectionintosubresources">Injection into 
subresources</h2><p>Subresources can get JAX-RS contexts injected directly into 
the
 ir fields with the help of <a shape="rect" class="external-link" 
href="https://jax-rs-spec.java.net/nonav/2.0/apidocs/javax/ws/rs/container/ResourceContext.html";
 rel="nofollow">ResourceContext</a>.</p><p>When possible, having a parent 
resource injecting the contexts into a given subresource instance via a setter 
or constructor can offer a much simpler alternative.</p><h2 
id="JAX-RSBasics-Updatestothematchingalgorithm">Updates to the matching 
algorithm</h2><p>JAX-RS 2.0 supports a proper resource method selection in 
cases where multiple root resource classes have the same Path value, for 
example:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+</div><h1 id="JAX-RSBasics-WhatisNewinJAX-RS2.0">What is New in JAX-RS 
2.0</h1><h2 id="JAX-RSBasics-Filters">Filters</h2><h3 
id="JAX-RSBasics-Server">Server</h3><p><a shape="rect" class="external-link" 
href="https://jax-rs.github.io/apidocs/2.0/javax/ws/rs/container/ContainerRequestFilter.html";
 rel="nofollow">ContainerRequestFilter</a> and <a shape="rect" 
class="external-link" 
href="https://jax-rs.github.io/apidocs/2.0/javax/ws/rs/container/ContainerResponseFilter.html";
 rel="nofollow">ContainerResponseFilter</a> are new server-side request and 
response filters which can be used to customize various properties of a given 
request and response.</p><p>ContainerRequestFilter annotated with a <a 
shape="rect" class="external-link" 
href="https://jax-rs.github.io/apidocs/2.0/javax/ws/rs/container/PreMatching.html";
 rel="nofollow">PreMatching</a> annotation will be run before the runtime has 
matched a request to a specific JAX-RS root resource and method. Prematching 
filters can be used to aff
 ect the matching process.</p><p>The request filters without the PreMatching 
annotation will run after the JAX-RS resource method has been 
selected.</p><p>ContainerRequestFilter can be used to <a shape="rect" 
class="external-link" 
href="https://jax-rs.github.io/apidocs/2.0/javax/ws/rs/container/ContainerRequestContext.html#abortWith(javax.ws.rs.core.Response)"
 rel="nofollow">block</a> a request.</p><p>The filters can be bound to 
individual resource methods only with the help of custom <a shape="rect" 
class="external-link" 
href="https://jax-rs.github.io/apidocs/2.0/javax/ws/rs/NameBinding.html"; 
rel="nofollow">NameBinding</a>s.</p><p>Multiple request and response filters 
can be executed in the specific order by using javax.annotation.Priority 
annotations. See <a shape="rect" class="external-link" 
href="https://jax-rs.github.io/apidocs/2.0/javax/ws/rs/Priorities.html"; 
rel="nofollow">Priorities</a> for more information. Request filters are sorted 
in the ascending order, response filters 
 - in the descending order.</p><h3 id="JAX-RSBasics-Client">Client</h3><p><a 
shape="rect" class="external-link" 
href="https://jax-rs.github.io/apidocs/2.0/javax/ws/rs/client/ClientRequestFilter.html";
 rel="nofollow">ClientRequestFilter</a> and <a shape="rect" 
class="external-link" 
href="https://jax-rs.github.io/apidocs/2.0/javax/ws/rs/client/ClientResponseFilter.html";
 rel="nofollow">ClientResponseFilter</a> are new client-side request and 
response filters which can be used to customize various properties of a given 
request and response.</p><p>ClientRequestFilter can be used to <a shape="rect" 
class="external-link" 
href="https://jax-rs.github.io/apidocs/2.0/javax/ws/rs/client/ClientRequestContext.html#abortWith(javax.ws.rs.core.Response)"
 rel="nofollow">block</a> a request.</p><p>Request filters are sorted in the 
ascending order, response filters - in the descending order. See <a 
shape="rect" class="external-link" 
href="https://jax-rs.github.io/apidocs/2.0/javax/ws/rs/Priorities.html"; 
 rel="nofollow">Priorities</a> for more information.</p><h2 
id="JAX-RSBasics-Interceptors">Interceptors</h2><p><a shape="rect" 
class="external-link" 
href="https://jax-rs.github.io/apidocs/2.0/javax/ws/rs/ext/ReaderInterceptor.html";
 rel="nofollow">ReaderInterceptor</a> and <a shape="rect" class="external-link" 
href="https://jax-rs.github.io/apidocs/2.0/javax/ws/rs/ext/WriterInterceptor.html";
 rel="nofollow">WriterInterceptor</a> can be used in addition to filters or on 
its own to customize requests and responses on server and client 
sides.</p><p>Interceptors can be useful to customize the reading/writing 
process and block JAX-RS MessageBodyWriter or MessageBodyReader 
providers.</p><p>The interceptors used on the server side can be bound to 
individual resource methods only with the help of custom <a shape="rect" 
class="external-link" 
href="https://jax-rs.github.io/apidocs/2.0/javax/ws/rs/NameBinding.html"; 
rel="nofollow">NameBinding</a>s.</p><p>All interceptors are sorted in the 
ascendin
 g order. See <a shape="rect" class="external-link" 
href="https://jax-rs.github.io/apidocs/2.0/javax/ws/rs/Priorities.html"; 
rel="nofollow">Priorities</a> for more information.</p><h2 
id="JAX-RSBasics-DynamicFeatures">Dynamic Features</h2><p><a shape="rect" 
class="external-link" 
href="https://jax-rs.github.io/apidocs/2.0/javax/ws/rs/container/DynamicFeature.html";
 rel="nofollow">Dynamic Feature</a> is a server side feature that can be used 
to attach request and response filters as well as reader and writer 
interceptors to specific resource methods. It is an alternative approach to 
using the NameBindings and offer a finer-grained control over the binding 
process.</p><h2 id="JAX-RSBasics-Exceptions">Exceptions</h2><p>Dedicated 
exception classes representing various HTTP error or redirect conditions have 
been introduced, see the 'javax.ws.rs' Package <a shape="rect" 
class="external-link" 
href="https://jax-rs.github.io/apidocs/2.0/javax/ws/rs/package-frame.html"; 
rel="nofollow">Exceptions s
 ection</a>.</p><p>For example, instead of throwing a "new 
WebApplicationException(404)" one is better to do "new NotFoundException()". 
The finer-grained exception hierarchy allows for a finer-grained support of 
exception mappers. It also opens a way to check WebApplicationException and all 
of its subclasses when catching the HTTP exceptions on the client 
side.</p><p>Note that on the client side, ProcessingException can be used to 
catch client-related exceptions while ResponseProcessingException can be used 
to narrow down the client side exceptions specifically related to processing 
the response message.</p><h2 id="JAX-RSBasics-Suspendedinvocations">Suspended 
invocations</h2><p>One of the best JAX-RS 2.0 features is the support for 
server-side asynchronous invocations. Please see the <a shape="rect" 
class="external-link" 
href="https://jax-rs.github.io/apidocs/2.0/javax/ws/rs/container/AsyncResponse.html";
 rel="nofollow">AsyncResponse</a> documentation which provides a very good 
overvi
 ew of this feature.</p><p>See also this <a shape="rect" class="external-link" 
href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookContinuationStore.java";>test
 resource</a>.</p><p>Typically, the resource method accepting AsyncResponse 
will either store it and start a new thread to finish the request, the method 
will return and the invocation will be suspended, then eventually another 
thread (either the one which initiated an internal job or some other thread) 
will resume the suspended call. Note in this case the invocation will be 
suspended indefinitely until it is resumed.</p><p>Another approach is to have 
AsyncResponse suspended for a limited period of time only and also register a 
<a shape="rect" class="external-link" 
href="https://jax-rs.github.io/apidocs/2.0/javax/ws/rs/container/TimeoutHandler.html";
 rel="nofollow">TimeoutHandler</a>. The latter will be invoked when the 
invocation is resumed by the container after the tim
 eout has expired and the handler will either complete the invocation or 
suspend it again till it is ready to finish it.</p><p><a shape="rect" 
class="external-link" 
href="https://jax-rs.github.io/apidocs/2.0/javax/ws/rs/container/CompletionCallback.html";
 rel="nofollow">CompletionCallback</a> can be registered with AsyncResponse to 
receive the notifications when the async response has been sent back.</p><p><a 
shape="rect" class="external-link" 
href="https://jax-rs.github.io/apidocs/2.0/javax/ws/rs/container/ConnectionCallback.html";
 rel="nofollow">ConnectionCallback</a> is supported starting from CXF 
3.0.0-milestone2.</p><p>This feature can help developers write very 
sophisticated asynchronous applications.</p><p>Please also see the page about 
CXF <a shape="rect" href="continuations.html">Continuations</a> API which 
JAX-RS 2.0 AsyncResponse implementation is based upon and <br clear="none"> <a 
shape="rect" href="http://cxf.apache.org/docs/servlet-transport.html";>how to 
configure</a> CX
 FServlet.</p><h2 id="JAX-RSBasics-Parameterconverters">Parameter 
converters</h2><p><a shape="rect" class="external-link" 
href="https://jax-rs.github.io/apidocs/2.0/javax/ws/rs/ext/ParamConverterProvider.html";
 rel="nofollow">ParamConverterProvider</a> can be used to manage the conversion 
of custom Objects to String and vice versa on the server and client sides, when 
processing JAX-RS parameters representing URI parts or headers or form elements 
and when a default conversion mechanism does not work. For example, 
java.util.Date constructor accepting a String may have to be replaced a custom 
ParamConverter.</p><h2 id="JAX-RSBasics-Beanparameters">Bean 
parameters</h2><p><a shape="rect" class="external-link" 
href="https://jax-rs.github.io/apidocs/2.0/javax/ws/rs/BeanParam.html"; 
rel="nofollow">BeanParam</a> can be used to get JAX-RS parameters representing 
URI parts or headers or form elements and also contexts injected into a single 
bean container.</p><p>Note the CXF extension supporting 
 the injection of all the parameters of specific JAX-RS type (example, 
QueryParam("") MyBean) is different, it only allows to get all the query 
parameters injected, but it also does not require that bean properties are 
annotated with QueryParam/etc annotations.</p><h2 
id="JAX-RSBasics-ResourceInfo">ResourceInfo</h2><p><a shape="rect" 
class="external-link" 
href="https://jax-rs.github.io/apidocs/2.0/javax/ws/rs/container/ResourceInfo.html";
 rel="nofollow">ResourceInfo</a> is a new JAX-RS context which can be injected 
into filters and interceptors and checked which resource class and method are 
about to be invoked.</p><h2 
id="JAX-RSBasics-Injectionintosubresources">Injection into 
subresources</h2><p>Subresources can get JAX-RS contexts injected directly into 
their fields with the help of <a shape="rect" class="external-link" 
href="https://jax-rs.github.io/apidocs/2.0/javax/ws/rs/container/ResourceContext.html";
 rel="nofollow">ResourceContext</a>.</p><p>When possible, having a parent resou
 rce injecting the contexts into a given subresource instance via a setter or 
constructor can offer a much simpler alternative.</p><h2 
id="JAX-RSBasics-Updatestothematchingalgorithm">Updates to the matching 
algorithm</h2><p>JAX-RS 2.0 supports a proper resource method selection in 
cases where multiple root resource classes have the same Path value, for 
example:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
 <pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">@Path("/")
 public class Root1 {
    @Path("/1")
@@ -159,7 +162,7 @@ public class Root2 {
    public Response get() {...}
 }
 </pre>
-</div></div><p>In JAX-RS 1.1 a request with URI such as "/1" is not guaranteed 
to be matched and in CXF 2.7.x or earlier the use of CXF specific 
ResourceComparator is required to ensure Root1 and its get() method gets 
selected. In CXF 3.0.0 Root1 get() will always be correctly selected. Note 
ResourceComparator may still be of help in some cases even in CXF 3.0.0.</p><h2 
id="JAX-RSBasics-Link">Link</h2><p><a shape="rect" class="external-link" 
href="https://jax-rs-spec.java.net/nonav/2.0/apidocs/javax/ws/rs/core/Link.html";
 rel="nofollow">Link</a> is a utility class for building HTTP links as HTTP 
Link headers or application data links. <br clear="none"> UriInfo, UriBuilder, 
Response and ResponseBuilder classes have been enhanced to support Link.</p><h2 
id="JAX-RSBasics-ClientAPI">Client API</h2><p>JAX-RS 2.0 Client API has been 
completely implemented in CXF 3.0.0, please see the <a shape="rect" 
href="http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-JAXRS2.0ClientAPI";>
 Client API page</a> for more information.</p><h1 
id="JAX-RSBasics-Resourceclass">Resource class</h1><p>A resource class is a 
Java class annotated with JAX-RS annotations to represent a Web resource. Two 
types of resource classes are available: root resource classes and subresource 
classes. A root resource class is annotated with at least a @Path annotation, 
while subresource classes typically have no root @Path values. A typical root 
resource class in JAX-RS looks like this below:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>In JAX-RS 1.1 a request with URI such as "/1" is not guaranteed 
to be matched and in CXF 2.7.x or earlier the use of CXF specific 
ResourceComparator is required to ensure Root1 and its get() method gets 
selected. In CXF 3.0.0 Root1 get() will always be correctly selected. Note 
ResourceComparator may still be of help in some cases even in CXF 3.0.0.</p><h2 
id="JAX-RSBasics-Link">Link</h2><p><a shape="rect" class="external-link" 
href="https://jax-rs.github.io/apidocs/2.0/javax/ws/rs/core/Link.html"; 
rel="nofollow">Link</a> is a utility class for building HTTP links as HTTP Link 
headers or application data links. <br clear="none"> UriInfo, UriBuilder, 
Response and ResponseBuilder classes have been enhanced to support Link.</p><h2 
id="JAX-RSBasics-ClientAPI">Client API</h2><p>JAX-RS 2.0 Client API has been 
completely implemented in CXF 3.0.0, please see the <a shape="rect" 
href="http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-JAXRS2.0ClientAPI";>Client
 API
  page</a> for more information.</p><h1 
id="JAX-RSBasics-Resourceclass">Resource class</h1><p>A resource class is a 
Java class annotated with JAX-RS annotations to represent a Web resource. Two 
types of resource classes are available: root resource classes and subresource 
classes. A root resource class is annotated with at least a @Path annotation, 
while subresource classes typically have no root @Path values. A typical root 
resource class in JAX-RS looks like this below:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">package demo.jaxrs.server;
 
 import java.util.HashMap;
@@ -255,7 +258,7 @@ import java.lang.annotation.Target;
 public @interface PATCH { 
 }
 </pre>
-</div></div><h2 id="JAX-RSBasics-DefaultHttpMethod">Default Http 
Method</h2><p>CXF 3.0.4 introduces a new extension, a 
org.apache.cxf.jaxrs.ext.DefaultMethod annotation. It can be used to match 
arbitrary HTTP methods on a single resource method. This can be used in some 
advanced scenarious for integrating the CXF JAX-RS runtime into non-JAX-RS 
environments as well as in cases where it is awkward/difficult to have every 
HTTP method listed for a given path segment. CXF users need to be aware using 
this option will lead to a non-portable JAX-RS code.</p><p>&#160;</p><h1 
id="JAX-RSBasics-Returntypes">Return types</h1><p>Either 
javax.ws.rs.core.Response or custom type can be returned. 
javax.ws.rs.core.Response can be used to set the HTTP response code, headers 
and entity. JAX-RS MessageBodyWriters (see below) are in charge of serializing 
the response entities, those which are returned directly or as part of 
javax.ws.rs.core.Response.</p><h1 id="JAX-RSBasics-ResponseStreaming">Response 
St
 reaming&#160;</h1><h2 id="JAX-RSBasics-JAX-RSStreamingOutput">JAX-RS 
StreamingOutput</h2><p><a shape="rect" class="external-link" 
href="https://jax-rs-spec.java.net/nonav/2.0/apidocs/javax/ws/rs/core/StreamingOutput.html";
 rel="nofollow">StreamingOutput</a> can be used to stream the data to the 
client, for example:</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
+</div></div><h2 id="JAX-RSBasics-DefaultHttpMethod">Default Http 
Method</h2><p>CXF 3.0.4 introduces a new extension, a 
org.apache.cxf.jaxrs.ext.DefaultMethod annotation. It can be used to match 
arbitrary HTTP methods on a single resource method. This can be used in some 
advanced scenarious for integrating the CXF JAX-RS runtime into non-JAX-RS 
environments as well as in cases where it is awkward/difficult to have every 
HTTP method listed for a given path segment. CXF users need to be aware using 
this option will lead to a non-portable JAX-RS code.</p><p>&#160;</p><h1 
id="JAX-RSBasics-Returntypes">Return types</h1><p>Either 
javax.ws.rs.core.Response or custom type can be returned. 
javax.ws.rs.core.Response can be used to set the HTTP response code, headers 
and entity. JAX-RS MessageBodyWriters (see below) are in charge of serializing 
the response entities, those which are returned directly or as part of 
javax.ws.rs.core.Response.</p><h1 id="JAX-RSBasics-ResponseStreaming">Response 
St
 reaming&#160;</h1><h2 id="JAX-RSBasics-JAX-RSStreamingOutput">JAX-RS 
StreamingOutput</h2><p><a shape="rect" class="external-link" 
href="https://jax-rs.github.io/apidocs/2.0/javax/ws/rs/core/StreamingOutput.html";
 rel="nofollow">StreamingOutput</a> can be used to stream the data to the 
client, for example:</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
 <pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">@GET
 @Path("/books/pdf")
 @Produces("application/pdf")


Reply via email to