deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From johndam...@apache.org
Subject svn commit: r1503086 - in /deltaspike/site/trunk/content: bean-validation.mdtext documentation.mdtext
Date Mon, 15 Jul 2013 00:18:50 GMT
Author: johndament
Date: Mon Jul 15 00:18:49 2013
New Revision: 1503086

URL: http://svn.apache.org/r1503086
Log:
Added bean-validation as a module.

Added:
    deltaspike/site/trunk/content/bean-validation.mdtext
Modified:
    deltaspike/site/trunk/content/documentation.mdtext

Added: deltaspike/site/trunk/content/bean-validation.mdtext
URL: http://svn.apache.org/viewvc/deltaspike/site/trunk/content/bean-validation.mdtext?rev=1503086&view=auto
==============================================================================
--- deltaspike/site/trunk/content/bean-validation.mdtext (added)
+++ deltaspike/site/trunk/content/bean-validation.mdtext Mon Jul 15 00:18:49 2013
@@ -0,0 +1,45 @@
+Title: Bean Validation Module
+Notice:    Licensed to the Apache Software Foundation (ASF) under one
+           or more contributor license agreements.  See the NOTICE file
+           distributed with this work for additional information
+           regarding copyright ownership.  The ASF licenses this file
+           to you under the Apache License, Version 2.0 (the
+           "License"); you may not use this file except in compliance
+           with the License.  You may obtain a copy of the License at
+           .
+             http://www.apache.org/licenses/LICENSE-2.0
+           .
+           Unless required by applicable law or agreed to in writing,
+           software distributed under the License is distributed on an
+           "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+           KIND, either express or implied.  See the License for the
+           specific language governing permissions and limitations
+           under the License.
+
+[TOC]
+
+***
+
+# Introduction
+
+The main feature of the Bean Validation module is to provide CDI integration in to `ConstraintValidator`s.
 This allows you to inject CDI objects, EJBs etc in to your validators.
+
+## Scoping
+
+`ConstraintValidator`s will inherit whatever scope as defined in the bean class.  Inherently,
a `ConstraintValidator` may be invoked by multiple threads so please keep that in mind when
using them.  You should consider using at least `RequestScoped` validators.
+
+## Code Requirements
+
+There are no compile dependencies to use the Bean Validation module.  You simply need to
override the factory, either in XML or in Java:
+
+    :::java
+    Validation.byDefaultProvider().configure().constraintValidatorFactory(new CDIAwareConstraintValidatorFactory()).buildValidatorFactory()
+
+    :::xml
+    <validation-config xmlns="http://jboss.org/xml/ns/javax/validation/configuration"
+     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+     xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/configuration">
+        <constraint-validator-factory>org.apache.deltaspike.beanValidation.impl.CDIAwareConstraintValidatorFactory</constraint-validator-factory>
+    </validation-config>
+
+And then you can simply build your `ConstraintValidator`s based on CDI programming rules.

Modified: deltaspike/site/trunk/content/documentation.mdtext
URL: http://svn.apache.org/viewvc/deltaspike/site/trunk/content/documentation.mdtext?rev=1503086&r1=1503085&r2=1503086&view=diff
==============================================================================
--- deltaspike/site/trunk/content/documentation.mdtext (original)
+++ deltaspike/site/trunk/content/documentation.mdtext Mon Jul 15 00:18:49 2013
@@ -349,7 +349,7 @@ Definition : A module for adding CDI sup
 Features : Allows a developer to create CDI aware `ConstraintValidator`s that can use business
objects (EJBs, ManagedBeans) to support validation needs.
 
 *
-<a class="btn" href="beanval.html">View details »</a>
+<a class="btn" href="bean-validation.html">View details »</a>
 
 # External
 



Mime
View raw message