You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by bu...@apache.org on 2012/04/24 18:48:27 UTC
svn commit: r814248 - in /websites/production/cxf/content:
cache/docs.pageCache docs/jax-rs-data-bindings.html
Author: buildbot
Date: Tue Apr 24 16:48:27 2012
New Revision: 814248
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 Tue Apr 24 16:48:27 2012
@@ -124,7 +124,7 @@ Apache CXF -- JAX-RS Data Bindings
<div id="ConfluenceContent"><p><span style="font-size:2em;font-weight:bold"> JAX-RS : Data Bindings </span></p>
<div>
-<ul><li><a shape="rect" href="#JAX-RSDataBindings-JAXBsupport">JAXB support</a></li><ul><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><a shape="rect" href="#JAX-RSDataBindings-JSONsupport">JSON support</a></li><ul><li><a shape="rect" href="#JAX-RSDataBindings-Jettison">Jettison</a></li><ul><li><a shape="rect" href="#JAX-RSDataBindings-ConfiguringJSONprovider">Configuring JSON provider</a></li><li><a shape="rect" href="#JAX-RSDataBindings-DealingwithJSONarrayserializationissues">Dealing with JSON array serialization issues</a></li><li><a shape="rect" href="#JAX-RSDataBindings-BadgerFishconvention">BadgerFish convention</a></li><li><a shape="rect" href="#JAX-RSDataBindings-WrappingandUnwrappingJSONsequences">Wrapping and Unwrapping JSON sequences</a></li><li><a shape="rect" href="#JAX-RSDataBindings-TypeConverters">TypeConverters<
/a></li></ul><li><a shape="rect" href="#JAX-RSDataBindings-Jackson">Jackson</a></li></ul><li><a shape="rect" href="#JAX-RSDataBindings-CommonJAXBandJSONconfiguration">Common JAXB and JSON configuration</a></li><ul><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><a shape="rect" href="#JAX-RSDataBindings-CustomizingJAXBXMLandJSONinputandoutput">Customizing JAXB XML and JSON input and output</a></li><li><a shape="rect" href="#JAX-RSDataBindings-ControllingLarge
JAXBXMLandJSONinputpayloads">Controlling Large JAXB XML and JSON input payloads</a></li><li><a shape="rect" href="#JAX-RSDataBindings-JSONWithPadding">JSON With Padding</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-CXFDataBindingsasJAXRSproviders">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><ul><li><a shape="rect" href="#JAX-RSDataBindings-Outputvalidation">Output validation</a></li></ul><li><a shape="rect" href="#JAX-RSDataBindings-FastInfoset">Fast Infoset</a></li></ul></div>
+<ul><li><a shape="rect" href="#JAX-RSDataBindings-JAXBsupport">JAXB support</a></li><ul><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><a shape="rect" href="#JAX-RSDataBindings-JSONsupport">JSON support</a></li><ul><li><a shape="rect" href="#JAX-RSDataBindings-Jettison">Jettison</a></li><ul><li><a shape="rect" href="#JAX-RSDataBindings-ConfiguringJSONprovider">Configuring JSON provider</a></li><li><a shape="rect" href="#JAX-RSDataBindings-DealingwithJSONarrayserializationissues">Dealing with JSON array serialization issues</a></li><li><a shape="rect" href="#JAX-RSDataBindings-BadgerFishconvention">BadgerFish convention</a></li><li><a shape="rect" href="#JAX-RSDataBindings-WrappingandUnwrappingJSONsequences">Wrapping and Unwrapping JSON sequences</a></li><li><a shape="rect" href="#JAX-RSDataBindings-TypeConverters">TypeConverters<
/a></li></ul><li><a shape="rect" href="#JAX-RSDataBindings-Jackson">Jackson</a></li></ul><li><a shape="rect" href="#JAX-RSDataBindings-CommonJAXBandJSONconfiguration">Common JAXB and JSON configuration</a></li><ul><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><a shape="rect" href="#JAX-RSDataBindings-CustomizingJAXBXMLandJSONinputandoutput">Customizing JAXB XML and JSON input and output</a></li><li><a shape="rect" href="#JAX-RSDataBindings-ControllingLarge
JAXBXMLandJSONinputpayloads">Controlling Large JAXB XML and JSON input payloads</a></li><li><a shape="rect" href="#JAX-RSDataBindings-JSONWithPadding">JSON With Padding</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-CXFDataBindingsasJAXRSproviders">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><ul><li><a shape="rect" href="#JAX-RSDataBindings-Outputvalidation">Output validation</a></li></ul><li><a shape="rect" href="#JAX-RSDataBindings-FastInfoset">Fast Infoset</a></li></ul></div>
<h1><a shape="rect" name="JAX-RSDataBindings-JAXBsupport"></a>JAXB support</h1>
@@ -565,7 +565,7 @@ Typically one would delegate to a super
<h1><a shape="rect" name="JAX-RSDataBindings-ControllingLargeJAXBXMLandJSONinputpayloads"></a>Controlling Large JAXB XML and JSON input payloads</h1>
-<p>Starting from CXF 2.6.0 it is possible to control the depth of large XML and JSON payloads on the per-endpoint basis in order to limit the risk of the denial of service attacks. Please see <a shape="rect" class="external-link" href="https://cwiki.apache.org/confluence/display/CXF20DOC/Security#Security-XML">this section</a> on how to use a new DepthRestrictingInterceptor in order to control XML payloads.</p>
+<p>Starting from CXF 2.6.0 it is possible to control the depth of large XML and JSON payloads on the per-endpoint basis in order to limit the risk of the denial of service attacks. Please see <a shape="rect" class="external-link" href="https://cwiki.apache.org/confluence/display/CXF20DOC/Security#Security-XML">this section</a> on how to use a new DepthRestrictingInterceptor in order to control XML payloads which are read either by JAXBElementProvider or SourceProvider (which supports JAXP Source and DOM Document types).</p>
<p>Additionally it is possible to configure JAXBElementProvider or JSONProvider with contextual properties or <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/cxf/trunk/api/src/main/java/org/apache/cxf/staxutils/DocumentDepthProperties.java">DocumentDepthProperties</a>:</p>
@@ -685,11 +685,39 @@ class JsonpProvider <span class="code-ke
</pre>
</div></div>
+<h1><a shape="rect" name="JAX-RSDataBindings-Formpayloads"></a>Form payloads</h1>
+<p>Form payload is a sequence of name and value pairs, example, "name=Barry&age=20".<br clear="none">
+One can capture the form data by using either JAX-RS FormParam annotation or MultivaluedMap, for example:</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">
+
+<span class="code-keyword">import</span> javax.ws.rs.FormParam;
+<span class="code-keyword">import</span> javax.ws.rs.MultivaluedMap;
+
+@Path(<span class="code-quote">"resource"</span>)
+<span class="code-keyword">public</span> class FormResource {
+ @POST
+ @Path(<span class="code-quote">"/form1"</span>)
+ @Consumes(<span class="code-quote">"application/x-www-form-urlencoded"</span>)
+ <span class="code-keyword">public</span> void form1(@FormParam(<span class="code-quote">"name"</span>) <span class="code-object">String</span> name, @FormParam(<span class="code-quote">"age"</span>) <span class="code-object">int</span> age) {
+ }
+
+ @POST
+ @Path(<span class="code-quote">"/form2"</span>)
+ @Consumes(<span class="code-quote">"application/x-www-form-urlencoded"</span>)
+ <span class="code-keyword">public</span> void form1(MultivaluedMap<<span class="code-object">String</span>, <span class="code-object">String</span>> params) {
+ <span class="code-object">String</span> name = params.getFirst(<span class="code-quote">"name"</span>);
+ <span class="code-object">String</span> age = params.getFirst(<span class="code-quote">"age"</span>);
+ }
+}
+</pre>
+</div></div>
+<p>Note that it is possible to control the maximum number of the expected form parameters by setting a "maxFormParameterCount" contextual property (set within the jaxrs:properties). The client will receive HTTP 413 if the limit is reached.</p>
<h1><a shape="rect" name="JAX-RSDataBindings-Atom"></a>Atom</h1>