Return-Path: Delivered-To: apmail-incubator-cxf-dev-archive@locus.apache.org Received: (qmail 31528 invoked from network); 1 Nov 2006 03:05:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Nov 2006 03:05:26 -0000 Received: (qmail 64372 invoked by uid 500); 1 Nov 2006 03:05:37 -0000 Delivered-To: apmail-incubator-cxf-dev-archive@incubator.apache.org Received: (qmail 64325 invoked by uid 500); 1 Nov 2006 03:05:37 -0000 Mailing-List: contact cxf-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cxf-dev@incubator.apache.org Delivered-To: mailing list cxf-dev@incubator.apache.org Received: (qmail 64316 invoked by uid 99); 1 Nov 2006 03:05:37 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 Oct 2006 19:05:37 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of jliu@iona.com designates 65.223.216.181 as permitted sender) Received: from [65.223.216.181] (HELO amereast-smg1.iona.com) (65.223.216.181) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 Oct 2006 19:05:24 -0800 Received: from amer-ems1.IONAGLOBAL.COM ([10.65.6.25]) by amereast-smg1.iona.com (Switch-3.1.7/Switch-3.1.7) with ESMTP id kA134ZHQ004892 for ; Tue, 31 Oct 2006 22:04:53 -0500 (EST) X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: Interceptor Ordering Date: Tue, 31 Oct 2006 22:04:53 -0500 Message-ID: <9A4696F35B459043970EE4A85A3173900667C5@amer-ems1.IONAGLOBAL.COM> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Interceptor Ordering Thread-Index: Acb9SY6A30GIONAvS26Im9xKntEMlAAEK/Cg From: "Liu, Jervis" To: X-Virus-Checked: Checked by ClamAV on apache.org The getBefore()/getAfter does not work very well for the same phase in = my experience. Besides the problem you encountered, I also ran into a = similar problem when I was doing the saaj handlers stuff. See code = snippet below: public SOAPHandlerInterceptor(Binding binding) { super(binding); setPhase(Phase.PRE_PROTOCOL); addBefore((new StaxOutInterceptor()).getId()); } Sometimes using (new StaxOutInterceptor()).getId() is not possible as = the interceptor referred to might be in a module invisible to = SOAPHandlerInterceptor. This can happen when for example, both = interceptors from soap module and jax-ws module need to be placed in = PRE_PROTOCOL phase. In this case we have to explicitly use a string = "org.apache.cxf.interceptor.StaxOutInterceptor". IMO, the interceptor = should not be aware of any other interceptors in the chain at all. To get around this, we can have an integer IN_PHASE_ID ranged from 1 to = 999 for each interceptor, then it is the responsibility of who designs = the whole chain (us, as we have the knowledge of chain flow) to turn the = IN_PHASE_ID around to make sure interceptors in the same phase are at = the expected positions. Does this sound a better solution than = getBefore()/getAfter? or any better ideas? I am not sure if making PhaseInterceptorChain aware of direction is a = good idea. Looking into PhaseManagerImpl, the ordering of inphase and = outphase are already very different. I noticed that you have separated = RM interceptors into RMInInterceptor and RMOutInterceptor so that you = can put RM interceptors in different orders for inbout and outbound. = This should be the easiest solution. Cheers, Jervis > -----Original Message----- > From: Andrea Smyth [mailto:andrea.smyth@iona.com] > Sent: Wednesday, November 01, 2006 2:37 AM > To: cxf-dev@incubator.apache.org > Subject: Interceptor Ordering >=20 >=20 > Hi all, >=20 > I have come across a problem with ordering interceptors that=20 > belong to=20 > the same phase - specifically the logical RM and Addressing=20 > interceptors. Both are in the PRE_PROTOCOL phase but outbound the=20 > Addressing interceptor must be executed before the RM=20 > interceptor while=20 > inbound it's the other way round. > With the way the PhaseInterceptorChain uses the getBefore(),=20 > getAfter()=20 > it is not possible to use the same interceptor in and outbound. > As a workaround, I can manage the state in a third entity=20 > that is shared=20 > by the an RMInInterceptor and RMOutInterceptor, but that way=20 > configuration of the chains gets a bit more complicated:=20 > instead of just > > > > and > > > > > > > > >=20 > I would now need something like: > class=3D"org.apache.cxf.ws.rm.impl.RMEndpointManager"/> > class=3D"org.apache.cxf.ws.rm.impl.RMInInterceptor"> > > > > class=3D"org.apache.cxf.ws.rm.impl.RMOutInterceptor"> > > > >=20 > > > > > > > > >=20 > The other solution I can think of is to make=20 > PhaseInterceptorChain aware=20 > of a direction, i.e. whether it's used in inbound or outbound=20 > direction.=20 > It could then treat the getBefore(), getAfter() according to=20 > the direction. > Is that something that would be of general interest? >=20 > Any comments appreciated, > Andrea. >=20 >=20 >=20 >=20