cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r907765 - in /websites/production/cxf/content: cache/docs.pageCache docs/jax-rs-data-bindings.html
Date Fri, 02 May 2014 12:46:53 GMT
Author: buildbot
Date: Fri May  2 12:46:53 2014
New Revision: 907765

Log:
Production update by buildbot for cxf

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

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

Modified: websites/production/cxf/content/docs/jax-rs-data-bindings.html
==============================================================================
--- websites/production/cxf/content/docs/jax-rs-data-bindings.html (original)
+++ websites/production/cxf/content/docs/jax-rs-data-bindings.html Fri May  2 12:46:53 2014
@@ -119,11 +119,11 @@ Apache CXF -- JAX-RS Data Bindings
            <!-- Content -->
            <div class="wiki-content">
 <div id="ConfluenceContent"><p>&#160;</p><p>&#160;</p><p>&#160;</p><span
style="font-size:2em;font-weight:bold"> JAX-RS : Data Bindings </span><p>&#160;</p><p>&#160;</p><p>&#160;</p><p><style
type="text/css">/*<![CDATA[*/
-div.rbtoc1397227677692 {padding: 0px;}
-div.rbtoc1397227677692 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1397227677692 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1399034786562 {padding: 0px;}
+div.rbtoc1399034786562 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1399034786562 li {margin-left: 0px;padding-left: 0px;}
 
-/*]]>*/</style></p><div class="toc-macro rbtoc1397227677692">
+/*]]>*/</style></p><div class="toc-macro rbtoc1399034786562">
 <ul class="toc-indentation"><li><a shape="rect" href="#JAX-RSDataBindings-JAXBsupport">JAXB
support</a>
 <ul class="toc-indentation"><li><a shape="rect" href="#JAX-RSDataBindings-ConfiguringJAXBprovider">Configuring
JAXB provider</a></li><li><a shape="rect" href="#JAX-RSDataBindings-JAXBandMoxy">JAXB
and Moxy</a></li></ul>
 </li><li><a shape="rect" href="#JAX-RSDataBindings-JSONsupport">JSON support</a>
@@ -132,7 +132,7 @@ div.rbtoc1397227677692 li {margin-left: 
 </li><li><a shape="rect" href="#JAX-RSDataBindings-Jackson">Jackson</a></li></ul>
 </li><li><a shape="rect" href="#JAX-RSDataBindings-CommonJAXBandJSONconfiguration">Common
JAXB and JSON configuration</a>
 <ul class="toc-indentation"><li><a shape="rect" href="#JAX-RSDataBindings-SingleJAXBContextandextrauserclasses">Single
JAXBContext and extra user classes</a></li><li><a shape="rect" href="#JAX-RSDataBindings-AutomaticJAXBElementconversionduringserialization">Automatic
JAXBElement conversion during serialization</a></li><li><a shape="rect"
href="#JAX-RSDataBindings-HandlingJAXBbeanswithoutXmlRootElementannotations">Handling JAXB
beans without XmlRootElement annotations</a></li><li><a shape="rect"
href="#JAX-RSDataBindings-Handlingexplicitcollections">Handling explicit collections</a></li></ul>
-</li><li><a shape="rect" href="#JAX-RSDataBindings-CustomizingJAXBXMLandJSONinputandoutput">Customizing
JAXB XML and JSON input and output</a></li><li><a shape="rect" href="#JAX-RSDataBindings-ControllingLargeJAXBXMLandJSONinputpayloads">Controlling
Large JAXB XML and JSON input payloads</a></li><li><a shape="rect" href="#JAX-RSDataBindings-JSONWithPadding(JSONP)">JSON
With Padding (JSONP)</a></li><li><a shape="rect" href="#JAX-RSDataBindings-Formpayloads">Form
payloads</a></li><li><a shape="rect" href="#JAX-RSDataBindings-Atom">Atom</a></li><li><a
shape="rect" href="#JAX-RSDataBindings-AegisDataBinding">Aegis Data Binding</a></li><li><a
shape="rect" href="#JAX-RSDataBindings-XMLBeans">XMLBeans</a></li><li><a
shape="rect" href="#JAX-RSDataBindings-CXFDataBindingsasJAX-RSproviders">CXF DataBindings
as JAX-RS providers</a></li><li><a shape="rect" href="#JAX-RSDataBindings-JAXRSDataBinding">JAXRS
DataBinding</a></li><li><a shape="rect" href="#JAX-RSDataBindings-Schemavalidation">Schema
  validation</a>
+</li><li><a shape="rect" href="#JAX-RSDataBindings-CustomizingJAXBXMLandJSONinputandoutput">Customizing
JAXB XML and JSON input and output</a></li><li><a shape="rect" href="#JAX-RSDataBindings-ControllingLargeJAXBXMLandJSONinputpayloads">Controlling
Large JAXB XML and JSON input payloads</a></li><li><a shape="rect" href="#JAX-RSDataBindings-JSR-353JSONProcessing">JSR-353
JSON Processing</a></li><li><a shape="rect" href="#JAX-RSDataBindings-JSONWithPadding(JSONP)">JSON
With Padding (JSONP)</a></li><li><a shape="rect" href="#JAX-RSDataBindings-Formpayloads">Form
payloads</a></li><li><a shape="rect" href="#JAX-RSDataBindings-Atom">Atom</a></li><li><a
shape="rect" href="#JAX-RSDataBindings-AegisDataBinding">Aegis Data Binding</a></li><li><a
shape="rect" href="#JAX-RSDataBindings-XMLBeans">XMLBeans</a></li><li><a
shape="rect" href="#JAX-RSDataBindings-CXFDataBindingsasJAX-RSproviders">CXF DataBindings
as JAX-RS providers</a></li><li><a shape="rect" href="#JAX-RSDataBindings-JAXRSDataBind
 ing">JAXRS DataBinding</a></li><li><a shape="rect" href="#JAX-RSDataBindings-Schemavalidation">Schema
validation</a>
 <ul class="toc-indentation"><li><a shape="rect" href="#JAX-RSDataBindings-Supportforcatalogs">Support
for catalogs</a></li><li><a shape="rect" href="#JAX-RSDataBindings-Outputvalidation">Output
validation</a></li></ul>
 </li><li><a shape="rect" href="#JAX-RSDataBindings-BeanValidation">Bean
Validation</a></li><li><a shape="rect" href="#JAX-RSDataBindings-FastInfoset">Fast
Infoset</a></li></ul>
 </div><h1 id="JAX-RSDataBindings-JAXBsupport">JAXB support</h1><p>The
request and response can be marshalled and unmarshalled to/from Java object using JAXB.</p><p>There's
a number of ways to tell to the JAXB provider how objects can be serialized. The simplest
way is to mark a given type with @XmlRootElement annotation.</p><p>For example:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
@@ -403,7 +403,33 @@ class=&quot;org.apache.cxf.jaxrs.provide
 
 
 ]]></script>
-</div></div><h1 id="JAX-RSDataBindings-JSONWithPadding(JSONP)">JSON With
Padding (JSONP)</h1><p>One option for supporting "JSON With Padding" (<a shape="rect"
class="external-link" href="http://en.wikipedia.org/wiki/JSONP" rel="nofollow">JSONP</a>)
is to extend the default JSONProvider and override its writeTo method as follows:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+</div></div><h1 id="JAX-RSDataBindings-JSR-353JSONProcessing">JSR-353 JSON
Processing</h1><p>As per JAX-RS 2.0 specification, the support of <a shape="rect"
class="external-link" href="http://jcp.org/en/jsr/detail?id=353" rel="nofollow">JSR-353
Java API for JSON Processing</a> is mandatory requirement and implies the presence of
message body reader(s)/writer(s) for following types: <a shape="rect" class="external-link"
href="http://docs.oracle.com/javaee/7/api/javax/json/JsonStructure.html" rel="nofollow">JsonStructure</a>,
<a shape="rect" class="external-link" href="http://docs.oracle.com/javaee/7/api/javax/json/JsonArray.html"
rel="nofollow">JsonArray</a> and <a shape="rect" class="external-link" href="http://docs.oracle.com/javaee/7/api/javax/json/JsonObject.html"
rel="nofollow">JsonObject</a>. The Apache CXF provides such a support in a form of
<strong>JsrJsonpProvider</strong> provider distributed by Apache CXF JAX-RS Extensions
Providers module<strong> (cxf-rt-rs-extension-pro
 viders).</strong></p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[&lt;jaxrs:providers&gt;
+   &lt;bean class=&quot;org.apache.cxf.jaxrs.provider.jsrjsonp.JsrJsonpProvider&quot;/&gt;
+&lt;/jaxrs:providers&gt;
+]]></script>
+</div></div><p>Adding <strong>JsrJsonpProvider</strong> provider
alone (or in a combination with other providers) allows JAX-RS resources to natively use <a
shape="rect" class="external-link" href="http://docs.oracle.com/javaee/7/api/javax/json/JsonStructure.html"
rel="nofollow">JsonStructure</a>, <a shape="rect" class="external-link" href="http://docs.oracle.com/javaee/7/api/javax/json/JsonArray.html"
rel="nofollow">JsonArray</a>, <a shape="rect" class="external-link" href="http://docs.oracle.com/javaee/7/api/javax/json/JsonObject.html"
rel="nofollow">JsonObject</a> as input parameters or return values. For example:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[@GET
+@Path(&quot;/books&quot;)
+@Produces(MediaType.APPLICATION_JSON)
+public JsonArray getBooks() {
+    // Implementation here
+}
+
+@GET
+@Path(&quot;/books/{bookId}&quot;)
+@Produces(MediaType.APPLICATION_JSON)
+public JsonObject getBook(@PathParam(&quot;bookId&quot;) Long id) {
+    // Implementation here
+}
+
+@POST
+@Path(&quot;/books&quot;)
+@Consumes(MediaType.APPLICATION_JSON)
+public Response addBook(@Context final UriInfo uriInfo, JsonObject obj) {
+    // Implementation here
+}]]></script>
+</div></div><p>The <strong>JsrJsonpProvider</strong> provider
could be used on server side or on a client side. By default, the provider uses <a shape="rect"
class="external-link" href="https://jsonp.java.net/" rel="nofollow">JSR-353 Java API for
JSON Processing reference implementation</a> to read/write message bodies.</p><h1
id="JAX-RSDataBindings-JSONWithPadding(JSONP)">JSON With Padding (JSONP)</h1><p>One
option for supporting "JSON With Padding" (<a shape="rect" class="external-link" href="http://en.wikipedia.org/wiki/JSONP"
rel="nofollow">JSONP</a>) is to extend the default JSONProvider and override its
writeTo method as follows:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
 <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[@Produces(&quot;application/javascript&quot;)
 class JsonpProvider extends JSONProvider {
 		



Mime
View raw message