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

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

Hi, here are some more comments; I need to finish some pending work and then I 
will join but in meantime please try to do/experiment with the following:

- ValidationInInterceptor: I wonder if it was correct to start with 
interceptors after all; we can definitely make the code getting a Method 
neutral between the various frontends but the issue is that an actual service 
instance is really usually available at the invoker level; For example, in this 
case, if we have a per-request JAX-RS instance then asking a resource provider 
to get us an instance will lead to JAXRSInvoker creating a duplicate instance 
later.
JAXRSInvoker may also inject path/form/etc parameters into service objects if 
it is per-request life-cycle, so the validation would miss those parameters if 
we do it early.

I guess similarly is the case with various JAX-WS invokers, lets keep it as is 
for now, but we will need to revisit this issue and I feel that may be the 
invoker will need to be done in the end - it is as pluggable as interceptors 
are.

- Please add  ValidationOutInterceptor, method return values have to be 
validated too. May be we will end up with the using the invoker in the end, but 
lets continue with the interceptors for now, I can do the invoker code myself 
when I work on applying the patch

- Can you experiment with ValidationProvider caching the introspection info ? 
I'm not exactly sure what form it will take in the end but for now please have 
ValidationInInterceptor & ValidationOutInterceptor injected with  
ValidationProvider instead of creating it in ValidationInInterceptor, and may 
be have a sync block in ValidationProvider which will do the introspection of 
BeanValidation metadata / EL expressions if it is not there and then use it; 
May be we will do it later at the endpoint creation time to avoid the 
synchronization, but for now lets try the POC way :-)

- Right now I thinking that the initial step for JAX-RS at least is that users 
will need to register validation exception mappers and invoker (or 
interceptors) manually,  in order to avoid the compile deps on the validation 
API - we will have to revisit this issue later; or may be it will end up in the 
other module, will depend if we want CXF to ship the API deps, to be discussed

I guess this is it for now; hope the above sounds reasonable. I'm going to help 
ASAP, need to resolve few pending work items first, thanks

> 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-validation-poc.txt
>
>




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

Reply via email to