cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r867253 [19/46] - in /websites/production/cxf/content: ./ 2008/04/28/ 2008/06/20/ 2009/02/10/ 2009/08/04/ cache/ docs/ docs/cxf-architecture.thumbs/ docs/cxf-dependency-graphs.thumbs/ docs/logbrowser-configuration.thumbs/ docs/logbrowser-so...
Date Mon, 24 Jun 2013 17:10:57 GMT
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 Mon Jun 24 17:10:51 2013
@@ -25,6 +25,18 @@
 <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
 <meta name="keywords" content="business integration, EAI, SOA, Service Oriented Architecture, web services, SOAP, JBI, JMS, WSDL, XML, EDI, Electronic Data Interchange, standards support, integration standards, application integration, middleware, software, solutions, services, CXF, open source">
 <meta name="description" content="Apache CXF, Services Framework - JAX-RS Basics">
+
+  <link href='http://cxf.apache.org/resources/highlighter/styles/shCore.css' rel='stylesheet' type='text/css' />
+  <link href='http://cxf.apache.org/resources/highlighter/styles/shThemeCXF.css' rel='stylesheet' type='text/css' />
+  <script src='http://cxf.apache.org/resources/highlighter/scripts/shCore.js' type='text/javascript'></script>
+  <script src='http://cxf.apache.org/resources/highlighter/scripts/shBrushJava.js' type='text/javascript'></script>
+  <script src='http://cxf.apache.org/resources/highlighter/scripts/shBrushXml.js' type='text/javascript'></script>
+  
+  <script type="text/javascript">
+  SyntaxHighlighter.defaults['toolbar'] = false;
+  SyntaxHighlighter.all();
+  </script>
+ 
     <title>
 Apache CXF -- JAX-RS Basics
     </title>
@@ -42,19 +54,15 @@ Apache CXF -- JAX-RS Basics
     <td id="cell-1-0">&nbsp;</td>
     <td id="cell-1-1">&nbsp;</td>
     <td id="cell-1-2">
-      <div style="padding: 5px;">
-        <div id="banner">
-          <!-- Banner -->
-<div id="banner-content">
+      <!-- Banner -->
+<div class="banner" id="banner"><p>
 <table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td align="left" colspan="1" nowrap>
 <a shape="rect" href="http://cxf.apache.org/" title="Apache CXF"><span style="font-weight: bold; font-size: 170%; color: white">Apache CXF</span></a>
 </td><td align="right" colspan="1" nowrap>
 <a shape="rect" href="http://www.apache.org/" title="The Apache Sofware Foundation"><img border="0" alt="ASF Logo" src="http://cxf.apache.org/images/asf-logo.png"></a>
 </td></tr></table>
-</div>
-          <!-- Banner -->
-        </div>
-      </div>
+</p></div>
+      <!-- Banner -->
       <div id="top-menu">
         <table border="0" cellpadding="1" cellspacing="0" width="100%">
           <tr>
@@ -94,7 +102,7 @@ Apache CXF -- JAX-RS Basics
 
 
 <hr>
-<ul class="alternate" type="square"><li>Search
+<ul class="alternate" type="square"><li>Search<br clear="none">
 
 <form enctype="application/x-www-form-urlencoded" method="get" id="cse-search-box" action="http://www.google.com/cse">
   <div>
@@ -146,62 +154,62 @@ Apache CXF -- JAX-RS Basics
 
 <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" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-<span class="code-keyword">package</span> demo.jaxrs.server;
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+package demo.jaxrs.server;
 
-<span class="code-keyword">import</span> java.util.HashMap;
-<span class="code-keyword">import</span> java.util.Map;
+import java.util.HashMap;
+import java.util.Map;
 
-<span class="code-keyword">import</span> javax.ws.rs.GET;
-<span class="code-keyword">import</span> javax.ws.rs.Path;
-<span class="code-keyword">import</span> javax.ws.rs.PathParam;
-<span class="code-keyword">import</span> javax.ws.rs.Produces;
-<span class="code-keyword">import</span> javax.ws.rs.core.Response;
-
-@Path(<span class="code-quote">"/customerservice/"</span>)
-@Produces(<span class="code-quote">"application/xml"</span>)
-<span class="code-keyword">public</span> class CustomerService {
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Response;
+
+@Path("/customerservice/")
+@Produces("application/xml")
+public class CustomerService {
 
-    <span class="code-keyword">public</span> CustomerService() {
+    public CustomerService() {
     }
 
     @GET
-    <span class="code-keyword">public</span> Customers getCustomers() {
+    public Customers getCustomers() {
         ......
     }
 
     @GET
-    @Path(<span class="code-quote">"/customers/{id}"</span>)
-    @Produces(<span class="code-quote">"application/json"</span>)
-    <span class="code-keyword">public</span> Customer getCustomer(@PathParam(<span class="code-quote">"id"</span>) <span class="code-object">String</span> id) {
+    @Path("/customers/{id}")
+    @Produces("application/json")
+    public Customer getCustomer(@PathParam("id") String id) {
         ......
     }
 
     @PUT
-    @Path(<span class="code-quote">"/customers/{id}"</span>)
-    @Consumes(<span class="code-quote">"application/xml"</span>)
-    <span class="code-keyword">public</span> Response updateCustomer(@PathParam(<span class="code-quote">"id"</span>) <span class="code-object">Long</span> id, Customer customer) {
+    @Path("/customers/{id}")
+    @Consumes("application/xml")
+    public Response updateCustomer(@PathParam("id") Long id, Customer customer) {
         ......
     }
 
     @POST
-    @Path(<span class="code-quote">"/customers"</span>)
-    <span class="code-keyword">public</span> Response addCustomer(Customer customer) {
+    @Path("/customers")
+    public Response addCustomer(Customer customer) {
         ......
     }
 
     @DELETE
-    @Path(<span class="code-quote">"/customers/{id}/"</span>)
-    <span class="code-keyword">public</span> Response deleteCustomer(@PathParam(<span class="code-quote">"id"</span>) <span class="code-object">String</span> id) {
+    @Path("/customers/{id}/")
+    public Response deleteCustomer(@PathParam("id") String id) {
         ......
     }
 
-    @Path(<span class="code-quote">"/orders/{orderId}/"</span>)
-    <span class="code-keyword">public</span> Order getOrder(@PathParam(<span class="code-quote">"orderId"</span>) <span class="code-object">String</span> orderId) {
+    @Path("/orders/{orderId}/")
+    public Order getOrder(@PathParam("orderId") String orderId) {
        ......
     }
 }
-</pre>
+]]></script>
 </div></div>
 
 <p>Customer resource class can handle requests starting from /customerservice. When /customerservice requests are matched to this class, its getCustomers() method will be selected. updateCustomer(), deleteCustomer() and addCustomer() are used to serve POST, PUT and DELETE requests starting from /customerservice/customer, while getOrder() method delegates the handling of requests like /customerservice/orders/1 to a subresource locator Order.</p>
@@ -215,32 +223,32 @@ Apache CXF -- JAX-RS Basics
 <p>The @Path annotation is applied to resource classes or methods. The value of @Path annotation is a relative URI path and follows the URI Template format and may include arbitrary regular expressions. When not available on the resource method, it's inherited from a class. For example:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-@Path(<span class="code-quote">"/customers/{id}"</span>)
-<span class="code-keyword">public</span> class CustomerResource {
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+@Path("/customers/{id}")
+public class CustomerResource {
 
     @GET
-    <span class="code-keyword">public</span> Customer getCustomer(@PathParam(<span class="code-quote">"id"</span>) <span class="code-object">Long</span> id) {
+    public Customer getCustomer(@PathParam("id") Long id) {
         ......
     }
 
     @GET
-    @Path(<span class="code-quote">"/order/{orderid}"</span>)
-    <span class="code-keyword">public</span> Order getOrder(@PathParam(<span class="code-quote">"id"</span>) <span class="code-object">Long</span> customerId, @PathParam(<span class="code-quote">"orderid"</span>) <span class="code-object">Long</span> orderId) {
+    @Path("/order/{orderid}")
+    public Order getOrder(@PathParam("id") Long customerId, @PathParam("orderid") Long orderId) {
         ......
     }
 
     @GET
-    @Path(<span class="code-quote">"/order/{orderid}/{search:.*}"</span>)
-    <span class="code-keyword">public</span> Item findItem(@PathParam(<span class="code-quote">"id"</span>) <span class="code-object">Long</span> customerId, 
-                         @PathParam(<span class="code-quote">"orderid"</span>) <span class="code-object">Long</span> orderId,
-                         @PathParam(<span class="code-quote">"search"</span>) <span class="code-object">String</span> searchString,
-                         @PathParam(<span class="code-quote">"search"</span>) List&lt;PathSegment&gt; searchList) {
+    @Path("/order/{orderid}/{search:.*}")
+    public Item findItem(@PathParam("id") Long customerId, 
+                         @PathParam("orderid") Long orderId,
+                         @PathParam("search") String searchString,
+                         @PathParam("search") List&lt;PathSegment&gt; searchList) {
         ......
     }
 }
 
-</pre>
+]]></script>
 </div></div> 
 
 <p>This example is similar to the one above it, but it also shows that an {id} template variable specified as part of the root @Path expression is reused by resource methods and a custom regular expression is specified by a findItem() method (note that a variable name is separated by ':' from an actual expression).</p>
@@ -255,20 +263,20 @@ List&lt;PathSegment&gt; can be used to g
 <p>The JAX-RS specification defines a number of annotations such as @GET, @PUT, @POST and @DELETE. Using an @HttpMethod designator, one can create a custom annotation such as @Update or @Patch. For example :</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-<span class="code-keyword">package</span> org.apache.cxf.customverb;
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+package org.apache.cxf.customverb;
 
-<span class="code-keyword">import</span> java.lang.annotation.ElementType;
-<span class="code-keyword">import</span> java.lang.annotation.Retention;
-<span class="code-keyword">import</span> java.lang.annotation.RetentionPolicy;
-<span class="code-keyword">import</span> java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
 
 @Target({ElementType.METHOD})
 @Retention(RetentionPolicy.RUNTIME)
-@HttpMethod(<span class="code-quote">"PATCH"</span>)
-<span class="code-keyword">public</span> @<span class="code-keyword">interface</span> PATCH { 
+@HttpMethod("PATCH")
+public @interface PATCH { 
 }
-</pre>
+]]></script>
 </div></div>
 
 <h1><a shape="rect" name="JAX-RSBasics-Returntypes"></a>Return types</h1>
@@ -283,37 +291,37 @@ The former option may be a better one wh
 <p>For example :</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-@Path(<span class="code-quote">"/customerservice/"</span>)
-<span class="code-keyword">public</span> class CustomerService {
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+@Path("/customerservice/")
+public class CustomerService {
 
     
     @PUT
-    @Path(<span class="code-quote">"/customers/{id}"</span>)
-    <span class="code-keyword">public</span> Response updateCustomer(@PathParam(<span class="code-quote">"id"</span>) <span class="code-object">Long</span> id, Customer customer) {
-        <span class="code-keyword">return</span> Response.status(errorCode).build();
+    @Path("/customers/{id}")
+    public Response updateCustomer(@PathParam("id") Long id, Customer customer) {
+        return Response.status(errorCode).build();
     }
 
     @POST
-    @Path(<span class="code-quote">"/customers"</span>)
-    <span class="code-keyword">public</span> Customer addCustomer(Customer customer) {
-        <span class="code-keyword">throw</span> <span class="code-keyword">new</span> WebApplicationException(errorCode);
+    @Path("/customers")
+    public Customer addCustomer(Customer customer) {
+        throw new WebApplicationException(errorCode);
     }
 
 }
-</pre>
+]]></script>
 </div></div>
 
 <p>Yet another option is to register an ExceptionMapper provider. Ex :</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-<span class="code-keyword">public</span> BookExceptionMapper <span class="code-keyword">implements</span> ExceptionMapper&lt;BookException&gt; {
-    <span class="code-keyword">public</span> Response toResponse(BookException ex) {
-        <span class="code-comment">// convert to Response
-</span>    }
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+public BookExceptionMapper implements ExceptionMapper&lt;BookException&gt; {
+    public Response toResponse(BookException ex) {
+        // convert to Response
+    }
 }
-</pre>
+]]></script>
 </div></div>
 
 <p>This allows for throwing a checked or runtime exception from an application code and map it to an HTTP response in a registered provider.</p>
@@ -342,19 +350,19 @@ Note that the custom WebApplicationExcep
 For example :</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 
-@Path(<span class="code-quote">"/customer/{id}"</span>)
-<span class="code-keyword">public</span> class CustomerService {
+@Path("/customer/{id}")
+public class CustomerService {
 
     
     @PUT
-    @Path(<span class="code-quote">"{name}"</span>)
-    <span class="code-keyword">public</span> Response updateCustomer(@PathParam(<span class="code-quote">"id"</span>) <span class="code-object">Long</span> id, @PathParam(<span class="code-quote">"name"</span>) <span class="code-object">String</span> name) {
+    @Path("{name}")
+    public Response updateCustomer(@PathParam("id") Long id, @PathParam("name") String name) {
         ...
     }
 }
-</pre>
+]]></script>
 </div></div>
 
 <p>In this case a template variable id available from a root class annotation is mapped to a parameter of type Long, while a name variable is mapped to a parameter of type String.</p>
@@ -364,33 +372,33 @@ Parameters can be of type String or of a
 Additionally CXF JAXRS checks for static fromString(String s) method, so types with no valueOf(String) factory methods can also be dealt with:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 
-<span class="code-keyword">public</span> <span class="code-keyword">enum</span> Gender {
+public enum Gender {
    MALE,
    FEMALE;
 
-   <span class="code-keyword">public</span> <span class="code-keyword">static</span> Gender fromString(<span class="code-object">String</span> s) {
-       <span class="code-keyword">if</span> (<span class="code-quote">"1"</span>.equals(s)) {
-           <span class="code-keyword">return</span> FEMALE;
-       } <span class="code-keyword">else</span> <span class="code-keyword">if</span> (<span class="code-quote">"1"</span>.equals(s)) {
-           <span class="code-keyword">return</span> MALE;
+   public static Gender fromString(String s) {
+       if ("1".equals(s)) {
+           return FEMALE;
+       } else if ("1".equals(s)) {
+           return MALE;
        }  
-       <span class="code-keyword">return</span> valueOf(s); 
+       return valueOf(s); 
    }
 }
 
-@Path(<span class="code-quote">"/{g}"</span>)
-<span class="code-keyword">public</span> class Service {
+@Path("/{g}")
+public class Service {
 
     
     @PUT
-    @Path(<span class="code-quote">"{id}"</span>)
-    <span class="code-keyword">public</span> Response update(@PathParam(<span class="code-quote">"g"</span>) Gender g, @PathParam(<span class="code-quote">"id"</span>) UUID u) {
+    @Path("{id}")
+    public Response update(@PathParam("g") Gender g, @PathParam("id") UUID u) {
         ...
     }
 }
-</pre>
+]]></script>
 </div></div>
 
 <p>Note that on the trunk enums with fromValue() factory methods are also supported.</p>
@@ -400,22 +408,22 @@ Additionally CXF JAXRS checks for static
 <p>CXF JAXRS supports ParameterHandler extensions which can be used to deal with method parameters annotated with one of the JAXRS parameter annotations :  </p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-<span class="code-keyword">public</span> class MapHandler <span class="code-keyword">implements</span> ParameterHandler&lt;Map&gt; {
-    <span class="code-keyword">public</span> Map fromString(<span class="code-object">String</span> s) {...}
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+public class MapHandler implements ParameterHandler&lt;Map&gt; {
+    public Map fromString(String s) {...}
 }
 
-@Path(<span class="code-quote">"/map"</span>)
-<span class="code-keyword">public</span> class Service {
+@Path("/map")
+public class Service {
 
     
     @PUT
-    @Path(<span class="code-quote">"/{mapvalue:(.)+}"</span>)
-    <span class="code-keyword">public</span> Response update(@PathParam(<span class="code-quote">"mapvalue"</span>) Map m, <span class="code-object">byte</span>[] bytes) {
+    @Path("/{mapvalue:(.)+}")
+    public Response update(@PathParam("mapvalue") Map m, byte[] bytes) {
         ...
     }
 }
-</pre>
+]]></script>
 </div></div>
 
 <p>Note that ParameterHandlers can not be used to deal with parameters representing a message body, "byte[] byte" in this example. MessageBodyReaders have to deal with this task. That said, a given MessageBodyReader implementation can also implement ParameterHandler.</p>
@@ -428,20 +436,20 @@ Starting from CXF 2.5.3 the handlers wil
 Parameters can have a default value set using a DefaultValue annotation :</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 
-    <span class="code-keyword">public</span> Response updateCustomer(@DefaultValue(<span class="code-quote">"123"</span>) @QueryParam(<span class="code-quote">"id"</span>) <span class="code-object">Long</span> id, @PathParam(<span class="code-quote">"name"</span>) <span class="code-object">String</span> name) { ... }
+    public Response updateCustomer(@DefaultValue("123") @QueryParam("id") Long id, @PathParam("name") String name) { ... }
 
-</pre>
+]]></script>
 </div></div>
 
 <p>JAX-RS mandates that only a single method parameter which is not annotated with JAXRS annotations applicable to method parameters is allowed in a resource method. For example :</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-<span class="code-keyword">public</span> Response <span class="code-keyword">do</span>(@PathParam(<span class="code-quote">"id"</span>) <span class="code-object">String</span> id, <span class="code-object">String</span> body) {
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+public Response do(@PathParam("id") String id, String body) {
 }
-</pre>
+]]></script>
 </div></div>
 
 <p>Parameters like 'String body' are expected to represent the request body/input stream. It's the job of JAX-RS MessageBodyReaders to deserialize the request body into an object of the expected type.</p>
@@ -451,27 +459,27 @@ Parameters can have a default value set 
 <p>It's also possible to inject all types of parameters into fields or through dedicated setters. For example, the first code fragment in this section can be rewritten like this:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-@Path(<span class="code-quote">"/customer/{id}"</span>)
-<span class="code-keyword">public</span> class CustomerService {
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+@Path("/customer/{id}")
+public class CustomerService {
 
-    @PathParam(<span class="code-quote">"id"</span>)
-    <span class="code-keyword">private</span> <span class="code-object">Long</span> id; 
+    @PathParam("id")
+    private Long id; 
     
-    <span class="code-keyword">private</span> <span class="code-object">String</span> name;
+    private String name;
 
-    @PathParam(<span class="code-quote">"name"</span>)
-    <span class="code-keyword">public</span> setName(<span class="code-object">String</span> name) {
-        <span class="code-keyword">this</span>.name = name;
+    @PathParam("name")
+    public setName(String name) {
+        this.name = name;
     } 
 
     @PUT
-    @Path(<span class="code-quote">"{name}"</span>)
-    <span class="code-keyword">public</span> Response updateCustomer() {
-        <span class="code-comment">// use id and name
-</span>    }
+    @Path("{name}")
+    public Response updateCustomer() {
+        // use id and name
+    }
 }
-</pre>
+]]></script>
 </div></div>
 
 <h2><a shape="rect" name="JAX-RSBasics-Parameterbeans"></a>Parameter beans</h2>
@@ -479,46 +487,46 @@ Parameters can have a default value set 
 <p>There's a CXF extension which makes it possible to inject a sequence of @PathParam, @QueryParam, @FormParam or @MatrixParam parameters into a bean. For example:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 
-@Path(<span class="code-quote">"/customer/{id}"</span>)
-<span class="code-keyword">public</span> class CustomerService {
+@Path("/customer/{id}")
+public class CustomerService {
 
     
     @PUT
-    @Path(<span class="code-quote">"{name}"</span>)
-    <span class="code-keyword">public</span> Response updateCustomer(@PathParam("") Customer customer) {
+    @Path("{name}")
+    public Response updateCustomer(@PathParam("") Customer customer) {
         ...
     }
 
     @GET
-    @Path(<span class="code-quote">"/order"</span>)
-    <span class="code-keyword">public</span> Response getCustomerOrder(@PathParam(<span class="code-quote">"id"</span>) <span class="code-object">int</span> customerId, 
+    @Path("/order")
+    public Response getCustomerOrder(@PathParam("id") int customerId, 
                                      @QueryParam("") OrderBean bean,
                                      @MatrixParam("") OrderBean bean) {
         ...
     }
 
     @POST
-    <span class="code-keyword">public</span> Response addCustomerOrder(@PathParam(<span class="code-quote">"id"</span>) <span class="code-object">int</span> customerId,
+    public Response addCustomerOrder(@PathParam("id") int customerId,
                                      @FormParam("") OrderBean bean) {
         ...
     }
 }
 
-<span class="code-keyword">public</span> class Customer {
-   <span class="code-keyword">public</span> void setId(<span class="code-object">Long</span> id) {...}
-   <span class="code-keyword">public</span> void setName(<span class="code-object">String</span> s) {...}  
+public class Customer {
+   public void setId(Long id) {...}
+   public void setName(String s) {...}  
 }
 
-<span class="code-keyword">public</span> class OrderBean {
-   <span class="code-keyword">public</span> void setId(<span class="code-object">Long</span> id) {...}
-   <span class="code-keyword">public</span> void setWeight(<span class="code-object">int</span> w) {...}  
+public class OrderBean {
+   public void setId(Long id) {...}
+   public void setWeight(int w) {...}  
 }
 
 
 
-</pre>
+]]></script>
 </div></div>
 
 <p>Note that there's a single @PathParam with an empty value in updateCustomer() - this is an extension bit. The value for a template variable 'id' is injected into Customer.setId(Long id), while the value for 'name' is injected into Customer.setName(String s). The setter methods should have a single parameter, the conversion from the actual value to the parameter instance follows the same procedure as outlined above.</p>
@@ -528,32 +536,32 @@ Parameters can have a default value set 
 <p>Nested beans are also supported, which among other things, makes it possible to formulate advanced search queries. For example, given the following bean definitions:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 class Name {
-    <span class="code-object">String</span> first;
-    <span class="code-object">String</span> last;
+    String first;
+    String last;
 }
 
 class Address {
-    <span class="code-object">String</span> city;
-    <span class="code-object">String</span> state;
+    String city;
+    String state;
 }
 
 class Person {
     Name legalName;
     Address homeAddr;
-    <span class="code-object">String</span> race;
-    <span class="code-object">String</span> sex;
+    String race;
+    String sex;
     Date birthDate;
 }
 
 class MyService
 {
     @GET
-    @Path(<span class="code-quote">"/getPerson"</span>)
+    @Path("/getPerson")
     Person getPerson(@QueryParam("") Person person);
 } 
-</pre>
+]]></script>
 </div></div>
 
 <p>a query like</p>
@@ -570,13 +578,13 @@ Note that JAXRS MessageBodyWriter and Me
 <p>Classes with prototype scopes can get JAXRS contexts or parameters injected at construction time:</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 PerRequestResourceClass {
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+@Path("/")
+public class PerRequestResourceClass {
 
-   <span class="code-keyword">public</span> PerRequestResourceClass(@Context HttpHeaders headers, @QueryParam(<span class="code-quote">"id"</span>) <span class="code-object">Long</span> id) {}
+   public PerRequestResourceClass(@Context HttpHeaders headers, @QueryParam("id") Long id) {}
 }
-</pre>
+]]></script>
 </div></div> 
 
 <p>Classes with singleton scopes can only have contexts injected at the construction time and it is only a CXFNonSpringJaxrsServlet which can do it. In most cases you can have contexts injected as bean properties right after construction time.</p>
@@ -592,16 +600,16 @@ Note that JAXRS MessageBodyWriter and Me
 <p>When multiple resource classes match a given URI request, the following algorithm is used :<br clear="none">
 1. Prefer the resource class which has more literal characters in its @Path annotation.</p>
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-@Path(<span class="code-quote">"/bar/{id}"</span>)
-<span class="code-keyword">public</span> class Test1 {}
-@Path(<span class="code-quote">"/bar/{id}/baz"</span>)
-<span class="code-keyword">public</span> class Test2 {}
-@Path(<span class="code-quote">"/foo"</span>)
-<span class="code-keyword">public</span> class Test3 {}
-@Path(<span class="code-quote">"/foo/"</span>)
-<span class="code-keyword">public</span> class Test4 {}
-</pre>
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+@Path("/bar/{id}")
+public class Test1 {}
+@Path("/bar/{id}/baz")
+public class Test2 {}
+@Path("/foo")
+public class Test3 {}
+@Path("/foo/")
+public class Test4 {}
+]]></script>
 </div></div> 
 
 <p>Both classes match /bar/1/baz requests but Test2 will be selected as it has 9 Path literal characters compared to 5 in Test1. Similarly, Test4 wins against Test3 when a /foo/ request arrives. </p>
@@ -609,12 +617,12 @@ Note that JAXRS MessageBodyWriter and Me
 <p>2. Prefer the resource class which has more capturing groups in its @Path annotation.</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-@Path(<span class="code-quote">"/bar/{id}/"</span>)
-<span class="code-keyword">public</span> class Test1 {}
-@Path(<span class="code-quote">"/bar/{id}/{id2}"</span>)
-<span class="code-keyword">public</span> class Test2 {}
-</pre>
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+@Path("/bar/{id}/")
+public class Test1 {}
+@Path("/bar/{id}/{id2}")
+public class Test2 {}
+]]></script>
 </div></div>
 
 <p>Both classes match /bar/1/2 requests and both have the same number of literal characters but Test2 will be selected as it has 2 Path capturing groups (id and id1) as opposed to 1 in Test1. </p>
@@ -622,12 +630,12 @@ Note that JAXRS MessageBodyWriter and Me
 <p>3. Prefer the resource class which has more capturing groups with arbitrary regular expressions in its @Path annotation.</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-@Path(<span class="code-quote">"/bar/{id:.+}/baz/{id2}"</span>)
-<span class="code-keyword">public</span> class Test1 {}
-@Path(<span class="code-quote">"/bar/{id}/bar/{id2}"</span>)
-<span class="code-keyword">public</span> class Test2 {}
-</pre>
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+@Path("/bar/{id:.+}/baz/{id2}")
+public class Test1 {}
+@Path("/bar/{id}/bar/{id2}")
+public class Test2 {}
+]]></script>
 </div></div>
 
 <p>Both classes match /bar/1/baz/2 requests and both have the same number of literal characters and capturing groups but Test1 will be selected as it has 1 Path capturing groups with the arbitrary regular expression (id) as opposed to 0 in Test2. </p>
@@ -639,26 +647,26 @@ Note that JAXRS MessageBodyWriter and Me
 <p>4. Prefer a resource method to a subresource locator method</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 Test1 {
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+@Path("/")
+public class Test1 {
 
- @Path(<span class="code-quote">"/bar"</span>)
+ @Path("/bar")
  @GET
- <span class="code-keyword">public</span> Order getOrder() {...}
+ public Order getOrder() {...}
 
- @Path(<span class="code-quote">"/bar"</span>)
- <span class="code-keyword">public</span> Order getOrderFromSubresource() {...}
+ @Path("/bar")
+ public Order getOrderFromSubresource() {...}
 }
 
-<span class="code-keyword">public</span> class Order {
+public class Order {
 
- @Path(<span class="code-quote">"/"</span>)
+ @Path("/")
  @GET
- <span class="code-keyword">public</span> Order getOrder() { <span class="code-keyword">return</span> <span class="code-keyword">this</span>; }
+ public Order getOrder() { return this; }
 
 }
-</pre>
+]]></script>
 </div></div>
 
 <p>Both getOrderFromSubresource() and getOrder() methods can be used to serve a /bar request. However, getOrder() wins. </p>
@@ -668,24 +676,24 @@ Note that JAXRS MessageBodyWriter and Me
 <p>Consider this resource class with 2 resource methods :</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 Test1 {
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+@Path("/")
+public class Test1 {
 
- @Path(<span class="code-quote">"/bar"</span>)
+ @Path("/bar")
  @POST 
- @Consumes(<span class="code-quote">"application/json"</span>)
- @Produces(<span class="code-quote">"application/json"</span>)
- <span class="code-keyword">public</span> Order addOrderJSON(OrderDetails details) {...}
+ @Consumes("application/json")
+ @Produces("application/json")
+ public Order addOrderJSON(OrderDetails details) {...}
 
- @Path(<span class="code-quote">"/bar"</span>)
+ @Path("/bar")
  @POST
- @Consumes(<span class="code-quote">"application/xml"</span>)
- @Produces(<span class="code-quote">"application/xml"</span>)
- <span class="code-keyword">public</span> Order getOrderXML(OrderDetails details) {...}
+ @Consumes("application/xml")
+ @Produces("application/xml")
+ public Order getOrderXML(OrderDetails details) {...}
  
 }
-</pre>
+]]></script>
 </div></div>
 
 <p>Both methods match /bar requests. If in a given request both Content-Type and Accept are set to application/xml then getOrderXML will be selected. If both Content-Type and Accept are set to application/json then getOrderJSON will be chosen instead.</p>
@@ -695,18 +703,18 @@ Note that JAXRS MessageBodyWriter and Me
 <p>The above code can be replaced with this one :</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 Test1 {
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+@Path("/")
+public class Test1 {
 
- @Path(<span class="code-quote">"/bar"</span>)
+ @Path("/bar")
  @POST 
- @Consumes({<span class="code-quote">"application/json"</span>, <span class="code-quote">"application/xml"</span>})
- @Produces({<span class="code-quote">"application/json"</span>, <span class="code-quote">"application/xml"</span>})
- <span class="code-keyword">public</span> Order addOrder(OrderDetails details) {...}
+ @Consumes({"application/json", "application/xml"})
+ @Produces({"application/json", "application/xml"})
+ public Order addOrder(OrderDetails details) {...}
 
 }
-</pre>
+]]></script>
 </div></div>
 
 
@@ -726,49 +734,49 @@ Note that JAXRS MessageBodyWriter and Me
 A custom ResourceComparator can be used when this limitation is considered to be problematic. For example, the following shows one such implementation:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 
-<span class="code-keyword">import</span> java.io.UnsupportedEncodingException;
-<span class="code-keyword">import</span> java.net.URLDecoder;
-<span class="code-keyword">import</span> java.util.HashSet;
-<span class="code-keyword">import</span> java.util.List;
-<span class="code-keyword">import</span> java.util.Set;
-
-<span class="code-keyword">import</span> javax.ws.rs.core.MultivaluedMap;
-
-<span class="code-keyword">import</span> org.apache.cxf.jaxrs.ext.ResourceComparator;
-<span class="code-keyword">import</span> org.apache.cxf.jaxrs.model.ClassResourceInfo;
-<span class="code-keyword">import</span> org.apache.cxf.jaxrs.model.OperationResourceInfo;
-<span class="code-keyword">import</span> org.apache.cxf.jaxrs.model.OperationResourceInfoComparator;
-<span class="code-keyword">import</span> org.apache.cxf.jaxrs.model.Parameter;
-<span class="code-keyword">import</span> org.apache.cxf.jaxrs.util.JAXRSUtils;
-<span class="code-keyword">import</span> org.apache.cxf.message.Message;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.ws.rs.core.MultivaluedMap;
+
+import org.apache.cxf.jaxrs.ext.ResourceComparator;
+import org.apache.cxf.jaxrs.model.ClassResourceInfo;
+import org.apache.cxf.jaxrs.model.OperationResourceInfo;
+import org.apache.cxf.jaxrs.model.OperationResourceInfoComparator;
+import org.apache.cxf.jaxrs.model.Parameter;
+import org.apache.cxf.jaxrs.util.JAXRSUtils;
+import org.apache.cxf.message.Message;
 
-<span class="code-keyword">public</span> class QueryResourceInfoComperator <span class="code-keyword">extends</span> OperationResourceInfoComparator <span class="code-keyword">implements</span>
+public class QueryResourceInfoComperator extends OperationResourceInfoComparator implements
          ResourceComparator {
 
-     <span class="code-keyword">public</span> QueryResourceInfoComperator() {
-         <span class="code-keyword">super</span>(<span class="code-keyword">null</span>, <span class="code-keyword">null</span>);
+     public QueryResourceInfoComperator() {
+         super(null, null);
      }
 
      @Override
-     <span class="code-keyword">public</span> <span class="code-object">int</span> compare(ClassResourceInfo cri1, ClassResourceInfo cri2, Message message) {
-         <span class="code-comment">// Leave <span class="code-object">Class</span> selection to CXF
-</span>         <span class="code-keyword">return</span> 0;
+     public int compare(ClassResourceInfo cri1, ClassResourceInfo cri2, Message message) {
+         // Leave Class selection to CXF
+         return 0;
      }
 
      @Override
-     <span class="code-keyword">public</span> <span class="code-object">int</span> compare(OperationResourceInfo oper1, OperationResourceInfo oper2, Message message) {
+     public int compare(OperationResourceInfo oper1, OperationResourceInfo oper2, Message message) {
 
-         <span class="code-comment">// Check <span class="code-keyword">if</span> CXF can make a decision
-</span>         <span class="code-object">int</span> cxfResult = <span class="code-keyword">super</span>.compare(oper1, oper2);
-         <span class="code-keyword">if</span> (cxfResult != 0)
-             <span class="code-keyword">return</span> cxfResult;
+         // Check if CXF can make a decision
+         int cxfResult = super.compare(oper1, oper2);
+         if (cxfResult != 0)
+             return cxfResult;
 
-         <span class="code-object">int</span> op1Counter = getMatchingRate(oper1, message);
-         <span class="code-object">int</span> op2Counter = getMatchingRate(oper2, message);
+         int op1Counter = getMatchingRate(oper1, message);
+         int op2Counter = getMatchingRate(oper2, message);
 
-         <span class="code-keyword">return</span> op1Counter == op2Counter
+         return op1Counter == op2Counter
                  ? 0
                  : op1Counter&lt;  op2Counter
                          ? 1
@@ -785,76 +793,76 @@ A custom ResourceComparator can be used 
       *            values.
       * @param message
       *            A message containing query from user request
-      * @<span class="code-keyword">return</span> A positive or negative number, indicating a good match between
+      * @return A positive or negative number, indicating a good match between
       *         query and method
       */
-     <span class="code-keyword">protected</span> <span class="code-object">int</span> getMatchingRate(OperationResourceInfo operation, Message message) {
+     protected int getMatchingRate(OperationResourceInfo operation, Message message) {
 
          List&lt;Parameter&gt;  params = operation.getParameters();
-         <span class="code-keyword">if</span> (params == <span class="code-keyword">null</span> || params.size() == 0)
-             <span class="code-keyword">return</span> 0;
+         if (params == null || params.size() == 0)
+             return 0;
 
-         <span class="code-comment">// Get Request QueryParams
-</span>         Set&lt;<span class="code-object">String</span>&gt;  qParams = getParams((<span class="code-object">String</span>) message.get(Message.QUERY_STRING));
+         // Get Request QueryParams
+         Set&lt;String&gt;  qParams = getParams((String) message.get(Message.QUERY_STRING));
 
-         <span class="code-object">int</span> rate = 0;
-         <span class="code-keyword">for</span> (Parameter p : params) {
-             <span class="code-keyword">switch</span> (p.getType()) {
-             <span class="code-keyword">case</span> QUERY:
-                 <span class="code-keyword">if</span> (qParams.contains(p.getName()))
+         int rate = 0;
+         for (Parameter p : params) {
+             switch (p.getType()) {
+             case QUERY:
+                 if (qParams.contains(p.getName()))
                      rate += 2;
-                 <span class="code-keyword">else</span> <span class="code-keyword">if</span> (p.getDefaultValue() == <span class="code-keyword">null</span>)
+                 else if (p.getDefaultValue() == null)
                      rate -= 1;
-                 <span class="code-keyword">break</span>;
-             <span class="code-comment">// optionally support other parameter types such as headers, etc
-</span>             <span class="code-comment">// <span class="code-keyword">case</span> HEADER:
-</span>             <span class="code-comment">//  <span class="code-keyword">break</span>;
-</span>             <span class="code-keyword">default</span>:
-                 <span class="code-keyword">break</span>;
+                 break;
+             // optionally support other parameter types such as headers, etc
+             // case HEADER:
+             //  break;
+             default:
+                 break;
              }
          }
-         <span class="code-keyword">return</span> rate;
+         return rate;
      }
 
      /**
       * @param query
       *            URL Query Example: 'key=value&amp;key2=value2'
-      * @<span class="code-keyword">return</span> A Set of all keys, contained within query.
+      * @return A Set of all keys, contained within query.
       */
-     <span class="code-keyword">protected</span> Set&lt;<span class="code-object">String</span>&gt;  getParams(<span class="code-object">String</span> query) {
-         Set&lt;<span class="code-object">String</span>&gt;  params = <span class="code-keyword">new</span> HashSet&lt;<span class="code-object">String</span>&gt;();
-         <span class="code-keyword">if</span> (query == <span class="code-keyword">null</span> || query.length() == 0)
-             <span class="code-keyword">return</span> params;
-
-         MultivaluedMap&lt;<span class="code-object">String</span>, <span class="code-object">String</span>&gt; allQueries =
-             JAXRSUtils.getStructuredParams(query, <span class="code-quote">"&amp;"</span>, <span class="code-keyword">false</span>, <span class="code-keyword">false</span>);
-         <span class="code-keyword">return</span> allQueries.keySet();
+     protected Set&lt;String&gt;  getParams(String query) {
+         Set&lt;String&gt;  params = new HashSet&lt;String&gt;();
+         if (query == null || query.length() == 0)
+             return params;
+
+         MultivaluedMap&lt;String, String&gt; allQueries =
+             JAXRSUtils.getStructuredParams(query, "&amp;", false, false);
+         return allQueries.keySet();
      }
 } 
-</pre>
+]]></script>
 </div></div>
 
 <p>Now consider this code:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-@Path(<span class="code-quote">"/paramTest"</span>)
-<span class="code-keyword">public</span> class MySimpleService {
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+@Path("/paramTest")
+public class MySimpleService {
 
       @GET
-      <span class="code-keyword">public</span> <span class="code-object">String</span> getFoo(@QueryParam(<span class="code-quote">"foo"</span>) <span class="code-object">String</span> foo){
-          <span class="code-keyword">return</span> <span class="code-quote">"foo:"</span> + foo;
+      public String getFoo(@QueryParam("foo") String foo){
+          return "foo:" + foo;
       }
 
       @GET
-      <span class="code-keyword">public</span> <span class="code-object">String</span> getFooBar(@QueryParam(<span class="code-quote">"foo"</span>) <span class="code-object">String</span> foo,
-@QueryParam(<span class="code-quote">"bar"</span>) <span class="code-object">String</span> bar){
-          <span class="code-keyword">return</span> <span class="code-quote">"foo:"</span> + foo + <span class="code-quote">" bar:"</span> + bar;
+      public String getFooBar(@QueryParam("foo") String foo,
+@QueryParam("bar") String bar){
+          return "foo:" + foo + " bar:" + bar;
       }
 
   
 } 
-</pre>
+]]></script>
 </div></div> 
 
 <p>Using the custom comparator will lead to getFoo() method accepting a single query parameter selected when a request URI has only one query parameter, and getFoo() method accepting multiple query parameters selected when a request URI has at least two query parameters. Further customizations may also be possible.   </p>
@@ -869,28 +877,28 @@ UriInfo, SecurityContext, HttpHeaders, P
 <p>Example:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-@Path(<span class="code-quote">"/customer"</span>)
-<span class="code-keyword">public</span> class CustomerService {
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+@Path("/customer")
+public class CustomerService {
     
     @Context 
-    <span class="code-keyword">private</span> org.apache.cxf.jaxrs.ext.MessageContext mc; 
+    private org.apache.cxf.jaxrs.ext.MessageContext mc; 
     @Context 
-    <span class="code-keyword">private</span> ServletContext sc;
-    <span class="code-keyword">private</span> UriInfo ui;
+    private ServletContext sc;
+    private UriInfo ui;
     
     @Context
-    <span class="code-keyword">public</span> void setUriInfo(UriInfo ui) {
-        <span class="code-keyword">this</span>.ui = ui;
+    public void setUriInfo(UriInfo ui) {
+        this.ui = ui;
     }
 
     @PUT
-    <span class="code-keyword">public</span> Response updateCustomer(@Context HttpHeaders h, Customer c) {
+    public Response updateCustomer(@Context HttpHeaders h, Customer c) {
         mc.getHttpHeaders();
     }
 }
 
-</pre>
+]]></script>
 </div></div>
 
 <p>Note that all types of supported JAX-RS providers such as MessageBodyWriter, MessageBodyReader, ExceptionMapper and ContextResolver, as well as the list of body providers which can be provided by Providers can have contexts injected too. The only exception is that no parameter level injection is supported for providers due to methods of JAXRS providers being fixed.</p>
@@ -902,31 +910,31 @@ UriInfo, SecurityContext, HttpHeaders, P
 <p>Registering a custom <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/ContextProvider.java">ContextProvider</a> implementation such as <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchContextProvider.java">SearchContextProvider</a> lets attach Context annotations to arbitrary classes which can be helpful when some of the information representing the current request needs to be optimized or specialized, example:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-<span class="code-keyword">package</span> resources;
-<span class="code-keyword">import</span> org.apache.cxf.jaxrs.ext.search.SearchContext;
-@Path(<span class="code-quote">"/"</span>)
-<span class="code-keyword">public</span> class RootResource {
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+package resources;
+import org.apache.cxf.jaxrs.ext.search.SearchContext;
+@Path("/")
+public class RootResource {
     @Context
-    <span class="code-keyword">private</span>  SearchContext sc;
-    <span class="code-comment">// the <span class="code-keyword">rest</span> of the code
-</span>}
-</pre>
+    private  SearchContext sc;
+    // the rest of the code
+}
+]]></script>
 </div></div> 
 
 <p>and</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-xml">
-<span class="code-tag">&lt;jaxrs:server&gt;</span>
-  <span class="code-tag">&lt;serviceBeans&gt;</span>
-    <span class="code-tag">&lt;bean class=<span class="code-quote">"resources.RootResource"</span>/&gt;</span>
-  <span class="code-tag">&lt;/serviceBeans&gt;</span>
-  <span class="code-tag">&lt;jaxrs:providers&gt;</span>
-    <span class="code-tag">&lt;bean class=<span class="code-quote">"org.apache.cxf.jaxrs.ext.search.SearchContextProvider"</span>/&gt;</span>
-  <span class="code-tag">&lt;/jaxrs:providers&gt;</span>
-<span class="code-tag">&lt;/jaxrs:server&gt;</span>
-</pre>
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[
+&lt;jaxrs:server&gt;
+  &lt;serviceBeans&gt;
+    &lt;bean class="resources.RootResource"/&gt;
+  &lt;/serviceBeans&gt;
+  &lt;jaxrs:providers&gt;
+    &lt;bean class="org.apache.cxf.jaxrs.ext.search.SearchContextProvider"/&gt;
+  &lt;/jaxrs:providers&gt;
+&lt;/jaxrs:server&gt;
+]]></script>
 </div></div>
 
 <p>Custom Context implementations may get all the information about the HTTP request from the current CXF message.</p>
@@ -937,59 +945,59 @@ UriInfo, SecurityContext, HttpHeaders, P
 <p>Mapping of a particular URI to a service that returns some resource is straightforward using the @Path annotation. However RESTful services are often connected: one service returns data that is used as the key in another service. Listing entities and accessing a particular entity is a typical example:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-@Path(<span class="code-quote">"/customers"</span>)
-<span class="code-keyword">public</span> class CustomerService {
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+@Path("/customers")
+public class CustomerService {
 
     @GET
-    <span class="code-keyword">public</span> Customers getCustomers() {
+    public Customers getCustomers() {
         ......
     }
 
     @GET
-    @Path(<span class="code-quote">"/{id}"</span>)
-    <span class="code-keyword">public</span> Customer getCustomer(@PathParam(<span class="code-quote">"id"</span>) <span class="code-object">String</span> id) {
+    @Path("/{id}")
+    public Customer getCustomer(@PathParam("id") String id) {
         ......
     }
 
 }
-</pre>
+]]></script>
 </div></div>
 
 <p>For this service we can assume that the returned list of customers exposes only basic attributes and more details is returned using the second method which uses the customer id as the key.  Something like this:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-GET http:<span class="code-comment">//foobar.com/api/customers
-</span>
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+GET http://foobar.com/api/customers
+
 &lt;customers&gt;
-    &lt;customer id=<span class="code-quote">"1005"</span>&gt;John Doe&lt;/customer&gt;
-    &lt;customer id=<span class="code-quote">"1006"</span>&gt;Jane Doe&lt;/customer&gt;
+    &lt;customer id="1005"&gt;John Doe&lt;/customer&gt;
+    &lt;customer id="1006"&gt;Jane Doe&lt;/customer&gt;
     ...
 &lt;/customers&gt;
     
-GET http:<span class="code-comment">//foobar.com/api/customers/1005
-</span>
-&lt;customer id=<span class="code-quote">"1005"</span>&gt;
+GET http://foobar.com/api/customers/1005
+
+&lt;customer id="1005"&gt;
     &lt;first-name&gt;John&lt;/first-name&gt;
     &lt;last-name&gt;Doe&lt;/last-name&gt;
     ...
 &lt;/customer&gt;
-</pre>
+]]></script>
 </div></div>
 
 <p>How does a client of this service know how to get from list of customers to given customer? A trivial approach would be to expect the client to compute the proper URI. But wouldn't it be better to have the services provide full URIs in the response that can be used directly? This way the client would be more decoupled from the service itself (which may change URI format over time). A client could be provided the following on response, for example:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-GET http:<span class="code-comment">//foobar.com/api/customers
-</span>
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+GET http://foobar.com/api/customers
+
 &lt;customers-list&gt;
-    &lt;customer id=<span class="code-quote">"1005"</span> url=<span class="code-quote">"http:<span class="code-comment">//foobar.com/api/customers/1005"</span>&gt;John Doe&lt;/customer&gt;
-</span>    &lt;customer id=<span class="code-quote">"1006"</span> url=<span class="code-quote">"http:<span class="code-comment">//foobar.com/api/customers/1006"</span>&gt;Jane Doe&lt;/customer&gt;
-</span>    ...
+    &lt;customer id="1005" url="http://foobar.com/api/customers/1005"&gt;John Doe&lt;/customer&gt;
+    &lt;customer id="1006" url="http://foobar.com/api/customers/1006"&gt;Jane Doe&lt;/customer&gt;
+    ...
 &lt;/customers-list&gt;
-</pre>
+]]></script>
 </div></div>
 
 <p>The problem for the service is how to determine these URIs when the paths come from @Path annotations. It gets more complicated as we consider paths with templates (variables) on multiple levels or sub-resources introducing dynamic routing to different URIs.</p>
@@ -997,31 +1005,31 @@ GET http:<span class="code-comment">//fo
 <p>The core part of the solution is to inject the <a shape="rect" class="external-link" href="https://jsr311.dev.java.net/nonav/javadoc/javax/ws/rs/core/UriInfo.html" rel="nofollow">UriInfo</a> object into method "getCustomers". This helper object allows for extracting useful information about the current URI context, but more importantly allows for getting the <a shape="rect" class="external-link" href="https://jsr311.dev.java.net/nonav/javadoc/javax/ws/rs/core/UriBuilder.html" rel="nofollow">UriBuilder</a> object. UriBuilder has multiple appender methods for building the URI for each object; in our case to the stem URI we can append path in multiple ways, providing it as a string (which we actually want to avoid here) or a resource (class or method) to extract the @Path value. Finally UriBuilder must have values bound to its template variables to render the actual URI. This case in action looks like this:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-@Path(<span class="code-quote">"/customers"</span>)
-<span class="code-keyword">public</span> class CustomerService {
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+@Path("/customers")
+public class CustomerService {
 
     @GET
-    <span class="code-keyword">public</span> Customers getCustomers(@Context UriInfo ui) {
+    public Customers getCustomers(@Context UriInfo ui) {
         ......
-        <span class="code-comment">// builder starts with current URI and has the path of the getCustomer method appended to it
-</span>        UriBuilder ub = ui.getAbsolutePathBuilder().path(<span class="code-keyword">this</span>.getClass(), <span class="code-quote">"getCustomer"</span>);
-        <span class="code-keyword">for</span> (Customer customer: customers) {
-            <span class="code-comment">// builder has {id} variable that must be filled in <span class="code-keyword">for</span> each customer
-</span>            URI uri = ub.build(customer.getId());
+        // builder starts with current URI and has the path of the getCustomer method appended to it
+        UriBuilder ub = ui.getAbsolutePathBuilder().path(this.getClass(), "getCustomer");
+        for (Customer customer: customers) {
+            // builder has {id} variable that must be filled in for each customer
+            URI uri = ub.build(customer.getId());
             c.setUrl(uri);
         }
-        <span class="code-keyword">return</span> customers;
+        return customers;
     }
 
     @GET
-    @Path(<span class="code-quote">"/{id}"</span>)
-    <span class="code-keyword">public</span> Customer getCustomer(@PathParam(<span class="code-quote">"id"</span>) <span class="code-object">String</span> id) {
+    @Path("/{id}")
+    public Customer getCustomer(@PathParam("id") String id) {
         ......
     }
 
 }
-</pre>
+]]></script>
 </div></div>
 
 
@@ -1030,34 +1038,34 @@ GET http:<span class="code-comment">//fo
 <p>Most of the JAX-RS annotations can be inherited from either an interface or a superclass. For example:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 
-<span class="code-keyword">public</span> <span class="code-keyword">interface</span> CustomerService {
+public interface CustomerService {
 
     @PUT
-    @Path(<span class="code-quote">"/customers/{id}"</span>)
-    Response updateCustomer(@PathParam(<span class="code-quote">"id"</span>) <span class="code-object">Long</span> id, Customer customer);
+    @Path("/customers/{id}")
+    Response updateCustomer(@PathParam("id") Long id, Customer customer);
 
     @POST
-    @Path(<span class="code-quote">"/customers"</span>)
+    @Path("/customers")
     Customer addCustomer(Customer customer);
 
 }
 
-@Path(<span class="code-quote">"/customerservice/"</span>)
-<span class="code-keyword">public</span> class Customers <span class="code-keyword">implements</span> CustomerService {
+@Path("/customerservice/")
+public class Customers implements CustomerService {
 
     
-    <span class="code-keyword">public</span> Response updateCustomer(<span class="code-object">Long</span> id, Customer customer) {
-        <span class="code-keyword">return</span> Response.status(errorCode).build();
+    public Response updateCustomer(Long id, Customer customer) {
+        return Response.status(errorCode).build();
     }
 
-    <span class="code-keyword">public</span> Customer addCustomer(Customer customer) {
-        <span class="code-keyword">throw</span> <span class="code-keyword">new</span> WebApplicationException(errorCode);
+    public Customer addCustomer(Customer customer) {
+        throw new WebApplicationException(errorCode);
     }
 
 }
-</pre>
+]]></script>
 </div></div>
 
 <p>Similarly, annotations can be inherited from super-classes. In CXF, the resource class will inherit the class-level annotations from both its implemented interfaces and any class it extends.</p>
@@ -1068,47 +1076,47 @@ GET http:<span class="code-comment">//fo
 
 <p>In the example below, getOrder method is a sub-resource locator:</p>
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-@Path(<span class="code-quote">"/customerservice/"</span>)
-<span class="code-keyword">public</span> class CustomerService {
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+@Path("/customerservice/")
+public class CustomerService {
 
-    @Path(<span class="code-quote">"/orders/{orderId}/"</span>)
-    <span class="code-keyword">public</span> Order getOrder(@PathParam(<span class="code-quote">"orderId"</span>) <span class="code-object">String</span> orderId) {
+    @Path("/orders/{orderId}/")
+    public Order getOrder(@PathParam("orderId") String orderId) {
        ......
     }
 }
 
-@XmlRootElement(name = <span class="code-quote">"Order"</span>)
-<span class="code-keyword">public</span> class Order {
-    <span class="code-keyword">private</span> <span class="code-object">long</span> id;
-    <span class="code-keyword">private</span> Items items;
+@XmlRootElement(name = "Order")
+public class Order {
+    private long id;
+    private Items items;
 
-    <span class="code-keyword">public</span> Order() {
+    public Order() {
     }
 
-    <span class="code-keyword">public</span> <span class="code-object">long</span> getId() {
-        <span class="code-keyword">return</span> id;
+    public long getId() {
+        return id;
     }
 
 
     @GET
-    @Path(<span class="code-quote">"products/{productId}/"</span>)
-    <span class="code-keyword">public</span> Product getProduct(@PathParam(<span class="code-quote">"productId"</span>)<span class="code-object">int</span> productId) {
+    @Path("products/{productId}/")
+    public Product getProduct(@PathParam("productId")int productId) {
        ......
     }
 
-    @Path(<span class="code-quote">"products/{productId}/items"</span>)
-    <span class="code-keyword">public</span> Order getItems(@PathParam(<span class="code-quote">"productId"</span>) <span class="code-object">int</span> productId) {
-       <span class="code-keyword">return</span> <span class="code-keyword">this</span>;
+    @Path("products/{productId}/items")
+    public Order getItems(@PathParam("productId") int productId) {
+       return this;
     }
 
     @GET
-    <span class="code-keyword">public</span> Items getItems() {
+    public Items getItems() {
        ......
     }
 
 }
-</pre>
+]]></script>
 </div></div>
 <p>A HTTP GET request to <a shape="rect" class="external-link" href="http://localhost:9000/customerservice/orders/223/products/323" rel="nofollow">http://localhost:9000/customerservice/orders/223/products/323</a> is dispatched to getOrder method first. If the Order resource whose id is 223 is found, the Order 223 will be used to further resolve Product resource. Eventually, a Product 323 that belongs to Order 223 will be returned.  Similarly, the request to <a shape="rect" class="external-link" href="http://localhost:9000/customerservice/orders/223/products/323/items" rel="nofollow">http://localhost:9000/customerservice/orders/223/products/323/items</a> will be delivered to the getItems(productId) method.</p>
 
@@ -1117,40 +1125,40 @@ GET http:<span class="code-comment">//fo
 <p>Note that a given subresource can be represented as an interface or some base class resolved to an actual class at runtime. In this case any resource methods which have to be invoked on an actual subresource instance are discovered dynamically at runtime:  </p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-@Path(<span class="code-quote">"/customerservice/"</span>)
-<span class="code-keyword">public</span> class CustomerService {
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+@Path("/customerservice/")
+public class CustomerService {
 
-    @Path(<span class="code-quote">"/orders/{orderId}/"</span>)
-    <span class="code-keyword">public</span> Order getOrder(@PathParam(<span class="code-quote">"orderId"</span>) <span class="code-object">String</span> orderId) {
+    @Path("/orders/{orderId}/")
+    public Order getOrder(@PathParam("orderId") String orderId) {
        ......
     }
 }
 
-<span class="code-keyword">public</span> <span class="code-keyword">interface</span> Order {
+public interface Order {
     @GET
-    @Path(<span class="code-quote">"products/{productId}/"</span>)
-    Product getProduct(@PathParam(<span class="code-quote">"productId"</span>)<span class="code-object">int</span> productId);
+    @Path("products/{productId}/")
+    Product getProduct(@PathParam("productId")int productId);
 }
 
-@XmlRootElement(name = <span class="code-quote">"Order"</span>)
-<span class="code-keyword">public</span> class OrderImpl <span class="code-keyword">implements</span> Order {
+@XmlRootElement(name = "Order")
+public class OrderImpl implements Order {
     
-    <span class="code-keyword">public</span> Product getProduct(<span class="code-object">int</span> productId) {
+    public Product getProduct(int productId) {
        ......
     }
 }
 
-@XmlRootElement(name = <span class="code-quote">"Order"</span>)
-<span class="code-keyword">public</span> class OrderImpl2 <span class="code-keyword">implements</span> Order {
+@XmlRootElement(name = "Order")
+public class OrderImpl2 implements Order {
     
-    <span class="code-comment">// overrides JAXRS annotations
-</span>    @GET
-    @Path(<span class="code-quote">"theproducts/{productId}/"</span>)
-    Product getProduct(@PathParam(<span class="code-quote">"id"</span>)<span class="code-object">int</span> productId) {...}
+    // overrides JAXRS annotations
+    @GET
+    @Path("theproducts/{productId}/")
+    Product getProduct(@PathParam("id")int productId) {...}
 }
 
-</pre>
+]]></script>
 </div></div>
 
 <h2><a shape="rect" name="JAX-RSBasics-Staticresolutionofsubresources"></a>Static resolution of subresources</h2>
@@ -1161,13 +1169,13 @@ GET http:<span class="code-comment">//fo
 
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-xml">
-<span class="code-tag">&lt;beans&gt;</span>
-<span class="code-tag">&lt;jaxrs:server staticSubresourceResolution=<span class="code-quote">"true"</span>&gt;</span>
-<span class="code-tag"><span class="code-comment">&lt;!-- more configuration --&gt;</span></span>
-<span class="code-tag">&lt;/jaxrs:server&gt;</span>
-<span class="code-tag">&lt;/beans&gt;</span>
-</pre>
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[
+&lt;beans&gt;
+&lt;jaxrs:server staticSubresourceResolution="true"&gt;
+&lt;!-- more configuration --&gt;
+&lt;/jaxrs:server&gt;
+&lt;/beans&gt;
+]]></script>
 </div></div>
 
 <p>Note - starting from CXF 2.7.2 the injection of JAX-RS contexts and parameters will also be supported if this property has been enabled.</p>
@@ -1186,57 +1194,57 @@ By default, CXF supports String, byte[],
 <p>Here's an example of a custom MessageBodyReader for InputStream:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 
-@Consumes(<span class="code-quote">"application/octet-stream"</span>)
+@Consumes("application/octet-stream")
 @Provider
-<span class="code-keyword">public</span> class InputStreamProvider <span class="code-keyword">implements</span> MessageBodyReader&lt;InputStream&gt; {
+public class InputStreamProvider implements MessageBodyReader&lt;InputStream&gt; {
 
     
-    <span class="code-keyword">public</span> <span class="code-object">boolean</span> isReadable(<span class="code-object">Class</span>&lt;InputStream&gt; type, Type genericType, Annotation[] annotations, MediaType mt) {
-        <span class="code-keyword">return</span> InputStream.class.isAssignableFrom(type);
+    public boolean isReadable(Class&lt;InputStream&gt; type, Type genericType, Annotation[] annotations, MediaType mt) {
+        return InputStream.class.isAssignableFrom(type);
     }
 
-    <span class="code-keyword">public</span> InputStream readFrom(<span class="code-object">Class</span>&lt;InputStream&gt; clazz, Type t, Annotation[] a, MediaType mt, 
-                         MultivaluedMap&lt;<span class="code-object">String</span>, <span class="code-object">String</span>&gt; headers, InputStream is) 
-        <span class="code-keyword">throws</span> IOException {
-        <span class="code-keyword">return</span> <span class="code-keyword">new</span> FilterInputStream(is) {
+    public InputStream readFrom(Class&lt;InputStream&gt; clazz, Type t, Annotation[] a, MediaType mt, 
+                         MultivaluedMap&lt;String, String&gt; headers, InputStream is) 
+        throws IOException {
+        return new FilterInputStream(is) {
              @Override
-             <span class="code-keyword">public</span> <span class="code-object">int</span> read(<span class="code-object">byte</span>[] b) <span class="code-keyword">throws</span> IOException {
-                 <span class="code-comment">// filter out some bytes
-</span>             }              
+             public int read(byte[] b) throws IOException {
+                 // filter out some bytes
+             }              
         }     
     }
 }
 
-</pre>
+]]></script>
 </div></div>
 
 <p>and here's an example of a custom MessageBodyWriter for Long objects:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 
-@Produces(<span class="code-quote">"text/plain"</span>)
+@Produces("text/plain")
 @Provider
-<span class="code-keyword">public</span> class LongProvider <span class="code-keyword">implements</span> MessageBodyWriter&lt;<span class="code-object">Long</span>&gt; {
+public class LongProvider implements MessageBodyWriter&lt;Long&gt; {
 
-    <span class="code-keyword">public</span> <span class="code-object">long</span> getSize(<span class="code-object">Long</span> l, <span class="code-object">Class</span>&lt;?&gt; type, Type genericType, Annotation[] annotations, MediaType mt) {
-        <span class="code-keyword">return</span> -1;
+    public long getSize(Long l, Class&lt;?&gt; type, Type genericType, Annotation[] annotations, MediaType mt) {
+        return -1;
     }
 
-    <span class="code-keyword">public</span> <span class="code-object">boolean</span> isWriteable(<span class="code-object">Class</span>&lt;?&gt; type, Type genericType, Annotation[] annotations, MediaType mt) {
-        <span class="code-keyword">return</span> <span class="code-object">long</span>.class.isAssignableFrom(type) || <span class="code-object">Long</span>.class.isAssignableFrom(type);
+    public boolean isWriteable(Class&lt;?&gt; type, Type genericType, Annotation[] annotations, MediaType mt) {
+        return long.class.isAssignableFrom(type) || Long.class.isAssignableFrom(type);
     }
 
-    <span class="code-keyword">public</span> void writeTo(<span class="code-object">Long</span> l, <span class="code-object">Class</span>&lt;?&gt; clazz, Type type, Annotation[] a, 
-                        MediaType mt, MultivaluedMap&lt;<span class="code-object">String</span>, <span class="code-object">Object</span>&gt; headers, OutputStream os) 
-        <span class="code-keyword">throws</span> IOException {
+    public void writeTo(Long l, Class&lt;?&gt; clazz, Type type, Annotation[] a, 
+                        MediaType mt, MultivaluedMap&lt;String, Object&gt; headers, OutputStream os) 
+        throws IOException {
         os.write(l.toString().getBytes());
         
     }
 
-</pre>
+]]></script>
 </div></div>
 
 <p>CXF ships some custom providers too, for dealing with Atom (based on Apache Abdera) and XMLObjects.  CXF also supports primitive types and their Number friends when text/plain media type is used, either on input or output.   </p>
@@ -1250,23 +1258,23 @@ By default, CXF supports String, byte[],
 <p>One can easily register a provider either from Spring configuration or programmatically:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-xml">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[
 
-<span class="code-tag">&lt;beans&gt;</span>
-<span class="code-tag">&lt;jaxrs:server id=<span class="code-quote">"customerService"</span> address=<span class="code-quote">"/"</span>&gt;</span>
-    <span class="code-tag">&lt;jaxrs:serviceBeans&gt;</span>
-      <span class="code-tag">&lt;bean class=<span class="code-quote">"org.CustomerService"</span> /&gt;</span>
-    <span class="code-tag">&lt;/jaxrs:serviceBeans&gt;</span>
-
-    <span class="code-tag">&lt;jaxrs:providers&gt;</span>
-      <span class="code-tag">&lt;ref bean=<span class="code-quote">"isProvider"</span> /&gt;</span>
-      <span class="code-tag">&lt;ref bean=<span class="code-quote">"longProvider"</span> /&gt;</span>
-    <span class="code-tag">&lt;/jaxrs:providers&gt;</span>
-    <span class="code-tag">&lt;bean id=<span class="code-quote">"isProvider"</span> class=<span class="code-quote">"com.bar.providers.InputStreamProvider"</span>/&gt;</span>
-    <span class="code-tag">&lt;bean id=<span class="code-quote">"longProvider"</span> class=<span class="code-quote">"com.bar.providers.LongProvider"</span>/&gt;</span>
-<span class="code-tag">&lt;/jaxrs:server&gt;</span>
-<span class="code-tag">&lt;/beans&gt;</span>
-</pre>
+&lt;beans&gt;
+&lt;jaxrs:server id="customerService" address="/"&gt;
+    &lt;jaxrs:serviceBeans&gt;
+      &lt;bean class="org.CustomerService" /&gt;
+    &lt;/jaxrs:serviceBeans&gt;
+
+    &lt;jaxrs:providers&gt;
+      &lt;ref bean="isProvider" /&gt;
+      &lt;ref bean="longProvider" /&gt;
+    &lt;/jaxrs:providers&gt;
+    &lt;bean id="isProvider" class="com.bar.providers.InputStreamProvider"/&gt;
+    &lt;bean id="longProvider" class="com.bar.providers.LongProvider"/&gt;
+&lt;/jaxrs:server&gt;
+&lt;/beans&gt;
+]]></script>
 </div></div>
 
 <p>Note that instead of the older &lt;jaxrs:entityProviders&gt; it's now &lt;jaxrs:providers&gt;. JAX-RS supports different types of providers and having a single &lt;jaxrs:providers&gt; container is in line with the way other JAX-RS implementations discover providers by checking for @Provider annotations only. </p>
@@ -1278,47 +1286,47 @@ By default, CXF supports String, byte[],
 <p>When using the custom configuration (as shown above) provider instances of different types (handling the same format of request/response bodies) or differently configured instances of the same type can be registered with a different jaxrs:server instance. Yet another requirement might be to have only a given jaxrs:server endpoint among multiple available ones to handle requests with a given media type:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-xml">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[
 
-<span class="code-tag">&lt;beans&gt;</span>
-<span class="code-tag">&lt;jaxrs:server id=<span class="code-quote">"customerService1"</span> address=<span class="code-quote">"/1"</span>&gt;</span>
-   <span class="code-tag">&lt;bean id=<span class="code-quote">"serviceBean"</span> class=<span class="code-quote">"org.CustomerService"</span> /&gt;</span> 
-
-   <span class="code-tag">&lt;jaxrs:serviceBeans&gt;</span>
-      <span class="code-tag">&lt;ref bean=<span class="code-quote">"serviceBean"</span>/&gt;</span>
-   <span class="code-tag">&lt;/jaxrs:serviceBeans&gt;</span>
-
-   <span class="code-tag">&lt;jaxrs:providers&gt;</span>
-      <span class="code-tag">&lt;bean class=<span class="code-quote">"com.bar.providers.InputStreamProvider"</span>/&gt;</span>
-   <span class="code-tag">&lt;/jaxrs:providers&gt;</span>
-<span class="code-tag">&lt;/jaxrs:server&gt;</span>
-<span class="code-tag">&lt;jaxrs:server id=<span class="code-quote">"customerService2"</span> address=<span class="code-quote">"/2"</span>&gt;</span>
-    <span class="code-tag">&lt;jaxrs:serviceBeans&gt;</span>
-      <span class="code-tag">&lt;ref bean=<span class="code-quote">"serviceBean"</span>/&gt;</span>
-    <span class="code-tag">&lt;/jaxrs:serviceBeans&gt;</span>
-
-    <span class="code-tag">&lt;jaxrs:providers&gt;</span>
-      <span class="code-tag">&lt;bean id=<span class="code-quote">"isProvider"</span> class=<span class="code-quote">"baz.foo.jaxrsproviders.InputStreamProvider"</span>/&gt;</span>
-    <span class="code-tag">&lt;/jaxrs:providers&gt;</span>
-<span class="code-tag">&lt;/jaxrs:server&gt;</span>
-
-<span class="code-tag">&lt;jaxrs:server id=<span class="code-quote">"customerService3"</span> address=<span class="code-quote">"/3"</span>&gt;</span>
-    <span class="code-tag">&lt;jaxrs:serviceBeans&gt;</span>
-      <span class="code-tag">&lt;ref bean=<span class="code-quote">"serviceBean"</span>/&gt;</span>
-    <span class="code-tag">&lt;/jaxrs:serviceBeans&gt;</span>
-
-    <span class="code-tag">&lt;jaxrs:providers&gt;</span>
-      <span class="code-tag">&lt;ref bean=<span class="code-quote">"isProvider"</span>/&gt;</span>
-    <span class="code-tag">&lt;/jaxrs:providers&gt;</span>
-<span class="code-tag">&lt;/jaxrs:server&gt;</span>
-
-
-<span class="code-tag">&lt;bean id=<span class="code-quote">"isProvider"</span> class=<span class="code-quote">"com.bar.providers.InputStreamProvider"</span>&gt;</span>
-   <span class="code-tag">&lt;property name=<span class="code-quote">"limit"</span> value=<span class="code-quote">"5"</span>/&gt;</span>
-<span class="code-tag">&lt;/bean&gt;</span>
+&lt;beans&gt;
+&lt;jaxrs:server id="customerService1" address="/1"&gt;
+   &lt;bean id="serviceBean" class="org.CustomerService" /&gt; 
+
+   &lt;jaxrs:serviceBeans&gt;
+      &lt;ref bean="serviceBean"/&gt;
+   &lt;/jaxrs:serviceBeans&gt;
+
+   &lt;jaxrs:providers&gt;
+      &lt;bean class="com.bar.providers.InputStreamProvider"/&gt;
+   &lt;/jaxrs:providers&gt;
+&lt;/jaxrs:server&gt;
+&lt;jaxrs:server id="customerService2" address="/2"&gt;
+    &lt;jaxrs:serviceBeans&gt;
+      &lt;ref bean="serviceBean"/&gt;
+    &lt;/jaxrs:serviceBeans&gt;
+
+    &lt;jaxrs:providers&gt;
+      &lt;bean id="isProvider" class="baz.foo.jaxrsproviders.InputStreamProvider"/&gt;
+    &lt;/jaxrs:providers&gt;
+&lt;/jaxrs:server&gt;
+
+&lt;jaxrs:server id="customerService3" address="/3"&gt;
+    &lt;jaxrs:serviceBeans&gt;
+      &lt;ref bean="serviceBean"/&gt;
+    &lt;/jaxrs:serviceBeans&gt;
+
+    &lt;jaxrs:providers&gt;
+      &lt;ref bean="isProvider"/&gt;
+    &lt;/jaxrs:providers&gt;
+&lt;/jaxrs:server&gt;
+
+
+&lt;bean id="isProvider" class="com.bar.providers.InputStreamProvider"&gt;
+   &lt;property name="limit" value="5"/&gt;
+&lt;/bean&gt;
 
-<span class="code-tag">&lt;/beans&gt;</span>
-</pre>
+&lt;/beans&gt;
+]]></script>
 </div></div>
 
 <p>In this example a single service bean can be accessed through 3 different paths, /1, /2 and /3. InputStream provider is available on all the 3 paths. com.bar.providers.InputStreamProvider is used in 2 cases, while a special InputStream handler baz.foo.jaxrsproviders.InputStreamProvider from another library is also involved in one case.</p>



Mime
View raw message