[ 
https://issues.apache.org/jira/browse/CXF-5309?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13823797#comment-13823797
 ] 

Sergey Beryozkin commented on CXF-5309:
---------------------------------------

Hi Andriy, many thanks, I've applied your patch with few minor updates 
(example, JAXRSInvoker would always return MessageContentsList, plus few other 
minor updates).

What I've realized, though I guess we did touch on it earlier, is that if we 
have JAX-RS Response wrapping an entity then the only thing we can do at the 
moment is to validate a non-null entity itself, assuming it has the embedded 
constraints, but we always miss on method-level annotations such as @NotNull.

When we have a null Response entity we can check if method annotations have 
@NotNull and if yes then return a custom NotNulConstraintViolation. Thus we can 
cover the NotNull validation at least. But I wonder if we can do better than 
that ? Have a look please at ValidatorProvider#validateResponse(Method m, 
Object returnV), can we iterate over all the method annotations, check for the 
ones with Constraints, if yes, then invoke the attached ConstraintValidator. 
Can that work at all ? It is not a critical issue, if it is not possible to do 
then I can add a NotNull check only and then resolve this issue

Thanks, Sergey  

> Support Bean Validation API for JAX-RS
> --------------------------------------
>
>                 Key: CXF-5309
>                 URL: https://issues.apache.org/jira/browse/CXF-5309
>             Project: CXF
>          Issue Type: Sub-task
>          Components: JAX-RS, JAX-WS Runtime
>            Reporter: Sergey Beryozkin
>         Attachments: patch-jaxrsvalidationinvoker-tests.txt, 
> patch-validation-exception-mapper.txt, 
> patch-validation-paramnameprovider.txt, patch-validation-poc.txt, 
> patch-validation-spring-tests.txt, patch-validation-tests.txt
>
>




--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to