You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Kevin Conaway <ke...@gmail.com> on 2009/06/16 00:39:18 UTC
Servlet In Interceptors
My application both receives incoming web service requests using the CXF
Servlet over Jetty and makes outgoing web service requests using the JAX-WS
dynamic dispatch API.
I have an "in" interceptor that I would like to be invoked only on requests
that come over the CXF Servlet. However, the way I have it configured
ensures that it gets called by both incoming requests and the response from
outgoing JAX-WS dynamic dispatch calls:
<cxf:bus>
<cxf:inInterceptors>
<bean class="com.mycompany.MyInterceptor"/>
</cxf:inInterceptors>
</cxf:bus>
Is there a way to configure the interceptor in Spring to only be applied to
incoming web service calls over the CXF servlet?
Thanks
Re: Servlet In Interceptors
Posted by Daniel Kulp <dk...@apache.org>.
There really are two options:
1) You can add the interceptors to the individual services that are deployed
on the servlet. Each "<jaxws:endpoint>" has inInterceptor configuration as
well. If there are only a few services, that's probably the easiest.
2) You can create a second Bus and reset the default bus for the thread around
the client/dispatch creation calls. Kind of like:
private Bus clientBus = BusFactory.newInstance().createBus();
...
Bus orig = BusFactory.getThreadDefaultBus();
try {
BusFactory.setThreadDefaultBus(clientBus);
... do all the dispatch stuff ...
} finally {
// set back the orig which should be the Bus that the servlet is using
BusFactory.setThreadDefaultBus(orig);
}
Dan
On Mon June 15 2009 6:39:18 pm Kevin Conaway wrote:
> My application both receives incoming web service requests using the CXF
> Servlet over Jetty and makes outgoing web service requests using the JAX-WS
> dynamic dispatch API.
>
> I have an "in" interceptor that I would like to be invoked only on
> requests that come over the CXF Servlet. However, the way I have it
> configured ensures that it gets called by both incoming requests and the
> response from outgoing JAX-WS dynamic dispatch calls:
>
> <cxf:bus>
> <cxf:inInterceptors>
> <bean class="com.mycompany.MyInterceptor"/>
> </cxf:inInterceptors>
> </cxf:bus>
>
> Is there a way to configure the interceptor in Spring to only be applied to
> incoming web service calls over the CXF servlet?
>
> Thanks
--
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog