ValidationFeaturePage edited by Andrew RedkoChanges (1)
Full ContentBean Validation Feature IntroductionAmong 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. DependenciesBean Validation support in Apache CXF is implementation-independent and is built solely using API. As such, the only required dependency is: <dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
</dependency>
All these components may share the single instance of org.apache.cxf.validation.BeanValidationProvider which actually delegates all validation logic to available Bean Validation 1.1 implementation. Configuring Bean Validation 1.1 using JAXRSServerFactoryBeanIt's quite easy to enable bean validation support using JAXRSServerFactoryBean as following code snippet shows: JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean(); sf.setResourceClasses( ... ); sf.setResourceProvider( ... ); sf.setProvider(new ValidationExceptionMapper()); sf.setInInterceptors(Arrays.< Interceptor< ? extends Message > >asList(new new JAXRSBeanValidationInInterceptor())); sf.setOutInterceptors(Arrays.< Interceptor< ? extends Message > >asList(new JAXRSBeanValidationOutInterceptor())); sf.create();
Stop watching space
|
Change email notification preferences
View Online
|
View Changes
|
- [CONF] Apache CXF Documentation > Validat... Sergey Beryozkin (Confluence)
- [CONF] Apache CXF Documentation > Va... Andrew Redko (Confluence)
- [CONF] Apache CXF Documentation > Va... Andrew Redko (Confluence)
- [CONF] Apache CXF Documentation > Va... Andrew Redko (Confluence)
- [CONF] Apache CXF Documentation > Va... Andrew Redko (Confluence)
- [CONF] Apache CXF Documentation > Va... Andrew Redko (Confluence)
- [CONF] Apache CXF Documentation > Va... Andrew Redko (Confluence)
- [CONF] Apache CXF Documentation > Va... Andrew Redko (Confluence)
- [CONF] Apache CXF Documentation > Va... Andrew Redko (Confluence)
- [CONF] Apache CXF Documentation > Va... Andrew Redko (Confluence)
- [CONF] Apache CXF Documentation > Va... Andrew Redko (Confluence)
- [CONF] Apache CXF Documentation > Va... Daniel Kulp (Confluence)
