cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1539384 - /cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/validation/JAXRSValidationInvoker.java
Date Wed, 06 Nov 2013 16:19:36 GMT
Author: sergeyb
Date: Wed Nov  6 16:19:36 2013
New Revision: 1539384

URL: http://svn.apache.org/r1539384
Log:
[CXF-5309] Optionally validating the service objects but only in the invoker for now

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/validation/JAXRSValidationInvoker.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/validation/JAXRSValidationInvoker.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/validation/JAXRSValidationInvoker.java?rev=1539384&r1=1539383&r2=1539384&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/validation/JAXRSValidationInvoker.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/validation/JAXRSValidationInvoker.java
Wed Nov  6 16:19:36 2013
@@ -36,6 +36,7 @@ import org.apache.cxf.validation.Validat
 public class JAXRSValidationInvoker extends JAXRSInvoker {
     private static final Logger LOG = LogUtils.getL7dLogger(JAXRSValidationInvoker.class);
     private volatile ValidationProvider provider;
+    private boolean validateServiceObject = true;
     
     @Override
     public Object invoke(Exchange exchange, final Object serviceObject, Method m, List<Object>
params) {
@@ -49,6 +50,10 @@ public class JAXRSValidationInvoker exte
         
         ValidationProvider theProvider = getProvider(message);
         
+        if (isValidateServiceObject()) {
+            theProvider.validateBean(serviceObject);
+        }
+        
         theProvider.validateParameters(serviceObject, m, params.toArray());
         
         Object response = super.invoke(exchange, serviceObject, m, params);
@@ -79,4 +84,12 @@ public class JAXRSValidationInvoker exte
     public void setProvider(ValidationProvider provider) {
         this.provider = provider;
     }
+
+    public boolean isValidateServiceObject() {
+        return validateServiceObject;
+    }
+
+    public void setValidateServiceObject(boolean validateServiceObject) {
+        this.validateServiceObject = validateServiceObject;
+    }
 }



Mime
View raw message