You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Richard Snowden <ri...@gmail.com> on 2014/10/26 22:58:25 UTC
JAX-RS Interceptors
Hi there,
from what I understood is that I can use an AbstractPhaseInterceptor for
SOAP and for REST messages.
When doing REST web services, would you advise that I should use
ContainerRequestFilter/ContainerResponseFilter's instead?
Is there an option to set the "phase" when those Filters are triggered?
(like RECEIVE, UNMARSHAL, POST_INVOKE, etc. in an InterceptorChain)?
regards,
Richard
RE: JAX-RS Interceptors
Posted by Andrei Shakirin <as...@talend.com>.
Hi,
The general recommendation is to use ContainerRequestFilter/ContainerResponseFilter's whenever possible, because this keeps your code portable (Container filters are part of JAX-RS spec).
If you really have to use CXF interceptors for JAX-RS, the order for inbound chain will be following:
1) Servlet filters
2) CXF interceptors before UNMARSHAL phase
3) PreMatch Container Request Filter
4) CXF interceptors after UNMARSHAL phase
5) per-method specific Container Request Filters
For outbound chain:
1) CXF interceptors before MARSHAL phase
2) ContainerResponse Filters
3) CXF interceptors after MARSHAL phase
Regards,
Andrei.
> -----Original Message-----
> From: Richard Snowden [mailto:richard.t.snowden@gmail.com]
> Sent: Sonntag, 26. Oktober 2014 22:58
> To: users@cxf.apache.org
> Subject: JAX-RS Interceptors
>
> Hi there,
>
> from what I understood is that I can use an AbstractPhaseInterceptor for SOAP
> and for REST messages.
>
> When doing REST web services, would you advise that I should use
> ContainerRequestFilter/ContainerResponseFilter's instead?
>
> Is there an option to set the "phase" when those Filters are triggered?
> (like RECEIVE, UNMARSHAL, POST_INVOKE, etc. in an InterceptorChain)?
>
> regards,
> Richard