cxf-commits mailing list archives

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

URL: http://svn.apache.org/r1539489
Log:
[CXF-5309] Validating Response values only if Valid annotation is present: updating the invoker
too

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=1539489&r1=1539488&r2=1539489&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 22:45:34 2013
@@ -22,6 +22,7 @@ import java.lang.reflect.Method;
 import java.util.List;
 import java.util.logging.Logger;
 
+import javax.validation.Valid;
 import javax.validation.ValidationException;
 import javax.ws.rs.core.Response;
 
@@ -59,8 +60,11 @@ public class JAXRSValidationInvoker exte
         Object response = super.invoke(exchange, serviceObject, m, params);
         
         if (response != null) {
-            if (response instanceof Response && ((Response)response).getEntity()
!= null) {
-                theProvider.validateReturnValue(((Response)response).getEntity());
+            if (response instanceof Response) {
+                Object entity = ((Response)response).getEntity();
+                if (entity != null && m.getAnnotation(Valid.class) != null) {
+                    theProvider.validateReturnValue(entity);    
+                }
             } else {
                 theProvider.validateReturnValue(serviceObject, m, response);
             }



Mime
View raw message