Author: buildbot
Date: Sat Nov 30 19:48:12 2013
New Revision: 888641
Log:
Production update by buildbot for cxf
Modified:
websites/production/cxf/content/cache/docs.pageCache
websites/production/cxf/content/docs/validationfeature.html
Modified: websites/production/cxf/content/cache/docs.pageCache
==============================================================================
Binary files - no diff available.
Modified: websites/production/cxf/content/docs/validationfeature.html
==============================================================================
--- websites/production/cxf/content/docs/validationfeature.html (original)
+++ websites/production/cxf/content/docs/validationfeature.html Sat Nov 30
19:48:12 2013
@@ -132,7 +132,7 @@ Apache CXF -- ValidationFeature
<div id="ConfluenceContent"><p><span style="font-size:2em;font-weight:bold">
Bean Validation Feature </span></p>
<div>
-<ul><ul><li><a shape="rect"
href="#ValidationFeature-Introduction">Introduction</a></li><li><a shape="rect"
href="#ValidationFeature-Dependencies">Dependencies</a></li><ul><li><a
shape="rect"
href="#ValidationFeature-UsingHibernateValidatorasbeanvalidationprovider">Using
Hibernate Validator as bean validation provider</a></li><li><a shape="rect"
href="#ValidationFeature-UsingApacheBValasbeanvalidationprovider">Using Apache
BVal as bean validation provider</a></li></ul></ul><li><a shape="rect"
href="#ValidationFeature-BeanValidation1.1andJAXRS2.0integration">Bean
Validation 1.1 and JAX-RS 2.0 integration</a></li><ul><li><a shape="rect"
href="#ValidationFeature-ConfiguringBeanValidation1.1usingJAXRSServerFactoryBean">Configuring
Bean Validation 1.1 using JAXRSServerFactoryBean</a></li></ul></ul></div>
+<ul><ul><li><a shape="rect"
href="#ValidationFeature-Introduction">Introduction</a></li><li><a shape="rect"
href="#ValidationFeature-Dependencies">Dependencies</a></li><ul><li><a
shape="rect"
href="#ValidationFeature-UsingHibernateValidatorasbeanvalidationprovider">Using
Hibernate Validator as bean validation provider</a></li><li><a shape="rect"
href="#ValidationFeature-UsingApacheBValasbeanvalidationprovider">Using Apache
BVal as bean validation provider</a></li></ul></ul><li><a shape="rect"
href="#ValidationFeature-BeanValidation1.1andJAXRS2.0integration">Bean
Validation 1.1 and JAX-RS 2.0 integration</a></li><ul><li><a shape="rect"
href="#ValidationFeature-ConfiguringBeanValidation1.1usingJAXRSServerFactoryBean">Configuring
Bean Validation 1.1 using JAXRSServerFactoryBean</a></li><li><a shape="rect"
href="#ValidationFeature-ConfiguringBeanValidation1.1usingSpringbeandefinitionsXML">Configuring
Bean Validation 1.1 using Spring bean definitions XML</a></li><li><a
shape="rect" href=
"#ValidationFeature-ValidationExceptionsandHTTPstatuscodes">Validation
Exceptions and HTTP status codes</a></li></ul></ul></div>
<h2><a shape="rect" name="ValidationFeature-Introduction"></a>Introduction</h2>
<p>Among many other features, JAX-RS 2.0 specification introduces Bean
Validation 1.1 support as a mandatory part of implementation. In an effort to
fulfill this requirement, Apache CXF provides full-fledge validation support
for JAX-RS / JAX-WS endpoints, both for request parameters and response
values.</p>
@@ -213,7 +213,47 @@ sf.setOutInterceptors(Arrays.< Interc
sf.create();
]]></script>
</div></div>
-</div>
+
+<h2><a shape="rect"
name="ValidationFeature-ConfiguringBeanValidation1.1usingSpringbeandefinitionsXML"></a>Configuring
Bean Validation 1.1 using Spring bean definitions XML</h2>
+
+<p>Following the similar approach as for JAXRSServerFactoryBean, in case of
Spring respective bean definitions should be added under
<jaxrs:outInterceptors>, <jaxrs:inInterceptors> and
<jaxrs:providers> sections, f.e.:</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
+<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[
+<jaxrs:server address="/">
+ <jaxrs:inInterceptors>
+ <ref bean="validationInInterceptor" />
+ </jaxrs:inInterceptors>
+
+ <jaxrs:outInterceptors>
+ <ref bean="validationOutInterceptor" />
+ </jaxrs:outInterceptors>
+
+ <jaxrs:serviceBeans>
+ ...
+ </jaxrs:serviceBeans>
+
+ <jaxrs:providers>
+ <ref bean="exceptionMapper"/>
+ </jaxrs:providers>
+</jaxrs:server>
+
+<bean id="exceptionMapper"
class="org.apache.cxf.jaxrs.validation.ValidationExceptionMapper"/>
+<bean id="validationProvider"
class="org.apache.cxf.validation.BeanValidationProvider" />
+
+<bean id="validationInInterceptor"
class="org.apache.cxf.jaxrs.validation.JAXRSBeanValidationInInterceptor">
+ <property name="provider" ref="validationProvider" />
+</bean>
+
+<bean id="validationOutInterceptor"
class="org.apache.cxf.jaxrs.validation.JAXRSBeanValidationOutInterceptor">
+ <property name="provider" ref="validationProvider" />
+</bean>
+]]></script>
+</div></div>
+
+<h2><a shape="rect"
name="ValidationFeature-ValidationExceptionsandHTTPstatuscodes"></a>Validation
Exceptions and HTTP status codes</h2>
+
+<p>As per JAX-RS 2.0 specification, any input parameter validation violation
is mapped to HTTP status code 400 Bad Request and any return value validation
violation (or internal validation violation) is mapped to HTTP status code 500
Internal Server Error. This is essentially what
org.apache.cxf.jaxrs.validation.ValidationExceptionMapper does.</p>
+<div class="panelMacro"><table class="noteMacro"><colgroup span="1"><col
span="1" width="24"><col span="1"></colgroup><tr><td colspan="1" rowspan="1"
valign="top"><img align="middle"
src="https://cwiki.apache.org/confluence/images/icons/emoticons/warning.gif"
width="16" height="16" alt="" border="0"></td><td colspan="1" rowspan="1">At
the moment, the details of validation exceptions are not included into the
response. The reason why is that error reporting logic is application-specific
and may vary from application to application (f.e. it could be simple
'text/html' with error message, or 'application/json', or HTTP custom headers,
...). Application developers are encouraged to provide own implementation of
this particular functionality.</td></tr></table></div></div>
</div>
<!-- Content -->
</td>