cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dan Diephouse" <...@envoisolutions.com>
Subject Re: Programatically installing interceptors per (Bus|Service|Endpoint)
Date Wed, 21 Mar 2007 19:12:04 GMT
I just added some ways to specify interceptors for your endpoint or proxy:

  <jaxws:endpoint id="epWithInterceptors"
    implementor="org.apache.cxf.jaxws.service.Hello"
    address="http://localhost:8080/test">
    <jaxws:inInterceptors>
      <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
      <bean class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor"/>
    </jaxws:inInterceptors>
    <jaxws:outInterceptors>
      <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
      <bean class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor"/>
    </jaxws:outInterceptors>
  </jaxws:endpoint>

Or on the client side (which I don't have fancy spring 2.0 support for yet)

<bean id="proxyFactory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
  <property name="address" value="http://endpoint/url"/>
  <property name="serviceClass" value="myServiceInterface"/>
  <property name="inInterceptors">
    <list>
      <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
    </list>
  </property>
</bean>

Also, I recently added an AbstractWSFeature class which I'd like to support
the loading of a plugin for a particular scenario. The idea being that you
can have a feature class - like a WSSecurityFeature - which configures your
endpoint for something - like WS-Security. And it can just become part of
the JAX-WS endpoint configuration.  I posted some examples of how this might
work in the client/EPR thread if you're interested. I'll be answering some
of the questions that arose on that shortly...

- Dan


On 3/21/07, Fred Dushin <fred@dushin.net> wrote:
>
> Thank you, Jervis and Andrea.
>
> I think probably the last part of Andrea's response comes closest to
> the sort of thing I need:
>
> > You can also have an interceptor installed at bus level which, when
> > executing, adds further interceptors to the chain, possibly on a
> > per message basis. This is done for example in
> > org.apache.cxf.ws.policy.ClientPolicyOutInterceptor.
>
> (Jervis, I see what the code you referenced is doing, but does an
> ordinary developer like myself have a hook into the creation of an
> Endpoint?  The code you reference seems to be a special case of
> installing a BindingFactory into an Endpoint, which is part of the
> CXF plumbing.  I'm looking for something more in userland, as they
> say.  Unless I'm missing something -- please correct me if I am.)
>
> The issue is that I want to programatically install these
> interceptors from plugin (i.e., spring-loaded) code, but it looks
> like there's really no way to do that.  Andrea's solution (if I
> understand it -- apologies if I'm being thick) is to install an
> interceptor during the servicing of a request, which works, though
> I'd hoped I could avoid that sort of overhead -- it's something I
> really only need to do once, at the point at which the operative
> InterceptorProvider is being set-up or established.
>
> Also, if interceptors are being added in the course of servicing a
> request, does one have to take special care of thread-safety issues?
> I understand the InterceptorProvider returns you a List by reference,
> not a copy, so you are free to add, delete, traverse elements, etc.
> But if you're in the context of a request, is there any mechanism to
> lock access to the interceptor list, so that someone else in your
> application with the same devious plan won't walk over the same data
> at the same time?  Am I completely missing something about the
> architecture, here?  It seems like modifying an interceptor list in
> flight has ConcurrentModification exceptions written all over it.
>
> Thanks,
> -Fred
>



-- 
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message