cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Redko (Confluence)" <conflue...@apache.org>
Subject [CONF] Apache CXF Documentation > ValidationFeature
Date Sat, 30 Nov 2013 17:41:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/en/2176/1/1/_/styles/combined.css?spaceKey=CXF20DOC&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/CXF20DOC/ValidationFeature">ValidationFeature</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~reta">Andrew
Redko</a>
    </h4>
        <br/>
                         <h4>Changes (1)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" > <br>{toc} <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">
<br>h2. Introduction <br>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. <br> <br>h2. Dependencies <br>Bean
Validation support in Apache CXF is implementation-independent and is built solely using API.
As such, the only required dependency is: <br>{noformat} <br>&lt;dependency&gt;
<br>    &lt;groupId&gt;javax.validation&lt;/groupId&gt; <br> 
  &lt;artifactId&gt;validation-api&lt;/artifactId&gt; <br>    &lt;version&gt;1.1.0.Final&lt;/version&gt;
<br>&lt;/dependency&gt; <br>{noformat} <br> <br>API doesn&#39;t
provide implementation but there are couple of choices to pick from. Please notice that bean
validation implementation is taken from the ones present in classpath. If no implementation
is detected, bean validation is not available for use and constraints validation won&#39;t
have any effect.  <br> <br>h3. Using Hibernate Validator as bean validation provider
<br>http://www.hibernate.org/subprojects/validator.html <br> <br>Hibernate
Validator is mature and feature-rich validation provider with full support of Bean Validation
1.1 (as of version 5.x.x which is the reference implementation for JSR 349 - Bean Validation
1.1 API). To use Hibernate Validator in your Apache CXF projects, couple of additional dependencies
should be included: <br> <br>{noformat} <br>&lt;dependency&gt; <br>
   &lt;groupId&gt;org.hibernate&lt;/groupId&gt; <br>    &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
<br>    &lt;version&gt;5.0.1.Final&lt;/version&gt; <br>&lt;/dependency&gt;
<br> <br>&lt;dependency&gt; <br>    &lt;groupId&gt;javax.el&lt;/groupId&gt;
<br>    &lt;artifactId&gt;javax.el-api&lt;/artifactId&gt; <br>
   &lt;version&gt;3.0-b02&lt;/version&gt; <br>&lt;/dependency&gt;
<br> <br>&lt;dependency&gt; <br>    &lt;groupId&gt;org.glassfish&lt;/groupId&gt;
<br>    &lt;artifactId&gt;javax.el&lt;/artifactId&gt; <br>   
&lt;version&gt;3.0-b01/version&gt; <br>&lt;/dependency&gt; <br>{noformat}
<br> <br>Hibernate Validator uses Java Expression Language 3.0 in order to provide
better validation messages support so the respective EL 3.0 API and implementation dependencies
should be included.   <br> <br>h3. Using Apache BVal as bean validation provider
<br>http://bval.apache.org/ <br> <br>Current stable version of Apache BVal
(0.5) doesn&#39;t support Bean Validation 1.1 but the upcoming 1.1.0 should have it fully
implemented (at the moment 1.1.0-alpha-SNAPSHOT could be used). <br>{noformat} <br>&lt;dependency&gt;
<br>    &lt;groupId&gt;org.apache.bval&lt;/groupId&gt; <br>  
 &lt;artifactId&gt;bval-jsr&lt;/artifactId&gt; <br>    &lt;version&gt;1.1.0-alpha-SNAPSHOT&lt;/version&gt;
<br>&lt;/dependency&gt; <br>{noformat} <br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <p><span style="font-size:2em;font-weight:bold"> Bean Validation Feature
</span></p>

<div>
<ul>
    <li><a href='#ValidationFeature-Introduction'>Introduction</a></li>
    <li><a href='#ValidationFeature-Dependencies'>Dependencies</a></li>
<ul>
    <li><a href='#ValidationFeature-UsingHibernateValidatorasbeanvalidationprovider'>Using
Hibernate Validator as bean validation provider</a></li>
    <li><a href='#ValidationFeature-UsingApacheBValasbeanvalidationprovider'>Using
Apache BVal as bean validation provider</a></li>
</ul>
</ul></div>

<h2><a 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>

<h2><a name="ValidationFeature-Dependencies"></a>Dependencies</h2>
<p>Bean Validation support in Apache CXF is implementation-independent and is built
solely using API. As such, the only required dependency is:</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>&lt;dependency&gt;
    &lt;groupId&gt;javax.validation&lt;/groupId&gt;
    &lt;artifactId&gt;validation-api&lt;/artifactId&gt;
    &lt;version&gt;1.1.0.Final&lt;/version&gt;
&lt;/dependency&gt;
</pre>
</div></div>

<p>API doesn't provide implementation but there are couple of choices to pick from.
Please notice that bean validation implementation is taken from the ones present in classpath.
If no implementation is detected, bean validation is not available for use and constraints
validation won't have any effect. </p>

<h3><a name="ValidationFeature-UsingHibernateValidatorasbeanvalidationprovider"></a>Using
Hibernate Validator as bean validation provider</h3>
<p><a href="http://www.hibernate.org/subprojects/validator.html" class="external-link"
rel="nofollow">http://www.hibernate.org/subprojects/validator.html</a></p>

<p>Hibernate Validator is mature and feature-rich validation provider with full support
of Bean Validation 1.1 (as of version 5.x.x which is the reference implementation for JSR
349 - Bean Validation 1.1 API). To use Hibernate Validator in your Apache CXF projects, couple
of additional dependencies should be included:</p>

<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>&lt;dependency&gt;
    &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
    &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
    &lt;version&gt;5.0.1.Final&lt;/version&gt;
&lt;/dependency&gt;

&lt;dependency&gt;
    &lt;groupId&gt;javax.el&lt;/groupId&gt;
    &lt;artifactId&gt;javax.el-api&lt;/artifactId&gt;
    &lt;version&gt;3.0-b02&lt;/version&gt;
&lt;/dependency&gt;

&lt;dependency&gt;
    &lt;groupId&gt;org.glassfish&lt;/groupId&gt;
    &lt;artifactId&gt;javax.el&lt;/artifactId&gt;
    &lt;version&gt;3.0-b01/version&gt;
&lt;/dependency&gt;
</pre>
</div></div>

<p>Hibernate Validator uses Java Expression Language 3.0 in order to provide better
validation messages support so the respective EL 3.0 API and implementation dependencies should
be included.  </p>

<h3><a name="ValidationFeature-UsingApacheBValasbeanvalidationprovider"></a>Using
Apache BVal as bean validation provider</h3>
<p><a href="http://bval.apache.org/" class="external-link" rel="nofollow">http://bval.apache.org/</a></p>

<p>Current stable version of Apache BVal (0.5) doesn't support Bean Validation 1.1 but
the upcoming 1.1.0 should have it fully implemented (at the moment 1.1.0-alpha-SNAPSHOT could
be used).</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>&lt;dependency&gt;
    &lt;groupId&gt;org.apache.bval&lt;/groupId&gt;
    &lt;artifactId&gt;bval-jsr&lt;/artifactId&gt;
    &lt;version&gt;1.1.0-alpha-SNAPSHOT&lt;/version&gt;
&lt;/dependency&gt;
</pre>
</div></div>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;" class="grey">
                        <a href="https://cwiki.apache.org/confluence/users/removespacenotification.action?spaceKey=CXF20DOC">Stop
watching space</a>
            <span style="padding: 0px 5px;">|</span>
                <a href="https://cwiki.apache.org/confluence/users/editmyemailsettings.action">Change
email notification preferences</a>
</div>
        <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/ValidationFeature">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=34842111&revisedVersion=2&originalVersion=1">View
Changes</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message