You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Sergey Beryozkin (JIRA)" <ji...@apache.org> on 2013/10/08 15:30:43 UTC

[jira] [Comment Edited] (CXF-5309) Support Bean Validation API for JAX-RS

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

Sergey Beryozkin edited comment on CXF-5309 at 10/8/13 1:28 PM:
----------------------------------------------------------------

Hi, try a custom invoker:

http://cxf.apache.org/docs/jax-rs-filters.html#JAX-RSFilters-Custominvokers

This is where you will get all the type info, and do the validation. Custom invokers can be used with and without Spring, and we will need a non-Spring validation support as well, so it will work for all users. Similar idea will also work for JAX-WS.

Or may be you can implement the validation in the input CXF interceptor, PRE-INVOKE phase, all the invocation parameters are already available there, 

{code:java}
List<Object> methodParams = MessageContentsList getContentsList(m); 
{code}

JAX-RS target method is available as "org.apache.cxf.resource.method" property. JAX-RS OperationResourceInfo class (with the access to all of JAX-RS specific info for the current method and its class owner) is available from "message.getExchange().get(OperationResourceInfo.class)". Using a CXF interceptor may make it simpler to reuse some of the code with the JAX-WS runtime at the next stage
Interceptors can also be used with/without Spring: example, an interceptor can be registered on the bus or the individual endpoints


Sergey





was (Author: sergey_beryozkin):
Hi, try a custom invoker:

http://cxf.apache.org/docs/jax-rs-filters.html#JAX-RSFilters-Custominvokers

This is where you will get all the type info, and do the validation. Custom invokers can be used with and without Spring, and we will need a non-Spring validation support as well, so it will work for all users. Similar idea will also work for JAX-WS.

Or may be you can implement the validation in the input CXF interceptor, PRE-INVOKE phase, all the invocation parameters are already available there, 

{code:java}
List<Object> methodParams = MessageContentsList getContentsList(m); 
{code}

JAX-RS target method is available as "org.apache.cxf.resource.method" property. JAX-RS OperationResourceInfo class (with the access to all of JAX-RS specific info for the current method and its class owner) is available from "message.getExchange().get(OperationResourceInfo.class)". Using a CXF interceptor may make it simpler to reuse some of the code with the JAX-WS runtime at the next stage

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
>




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