cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrei Shakirin <>
Subject Applying dynamic policies via PolicyConstants.POLICY_OVERRIDE
Date Thu, 22 Dec 2011 09:22:58 GMT

Just to publish Dan's answers regarding applying dynamic policies.

Corresponded Jira issue with patch is created:


-----Original Message-----
From: Daniel Kulp 
Sent: 21 December 2011 19:42
To: Andrei Shakirin
Cc: Gerald Preissler
Subject: Re: FW: FW: [IABG] Applying dynamic policies via PolicyConstants.POLICY_OVERRIDE

On Wednesday, December 21, 2011 4:23:25 AM Andrei Shakirin wrote:
> Hi Dan,
> Can you remember 3 year history? :)
> You have introduced PolicyConstants.POLICY_OVERRIDE constant in 
> PolicyInInterceptor, that give the possibility to dynamically override 
> the policy. The comment of this commit was "Get the cancel stuff 
> working for sec-conv tokens". I would like to reuse this mechanism in 
> custom project to dynamically apply policies calculating in ServiceRegistry.
> Two questions:
> 1.       Do you find using of this property OK for such purposes?

Sure.   Seems OK by me. 

> If not
> what do you recommend? Use case: I have Neethi Policy object in custom 
> interceptor and just want to apply corresponded interceptors 
> registered via standard policy mechanism (PolicyInterceptorProvider and AssertionBuilder).
> Static policies isn't used in this case at all.
> 2.       Solution works fine for consumer IN/OUT and for provider OUT, but
> unfortunately doesn't work for provider IN. The reason is that code in 
> PolicyInInterceptor checks PolicyConstants.POLICY_OVERRIDE only after  
> "if (MessageUtils.isRequestor(msg))" statement. Therefore provider IN 
> messages are ignored. Do you know the reason of it? 
> PolicyOutInterceptor has no such check.

Likely just an oversight as it's not really needed for the Cancel case with the sec-conv.
 In that case, we let the PolicyIn just create the policy as normal, but when we process the
cancel, we just clean out the policy and 
assertion info map.   Feel free to log a bug.

As an aside, this should have been asked on the CXF dev list.    We need to 
get you more active there.  :-)


> Thanks for help!
> Regards,
> Andrei.
> From: Colm O Heigeartaigh
> Sent: 20 December 2011 15:21
> To: Andrei Shakirin
> Cc: Gerald Preissler; Daniel Kulp
> Subject: Re: FW: [IABG] Applying dynamic policies via 
> PolicyConstants.POLICY_OVERRIDE
> Hi Andrei,
> I'm not familiar with PolicyConstants.POLICY_OVERRIDE. CC'ing Dan.
> Colm.
> On 20/12/11 14:04, Andrei Shakirin wrote:
> Hi Colm,
> Do you know what is the purpose of PolicyConstants.POLICY_OVERRIDE  
> and is our way to apply dynamic policies correct (see below)?
> Regards,
> Andrei.
> From:
> ogleg> [] On 
> Behalf Of Andrei Shakirin Sent: 15 December 2011 13:47
> To:
> ogleg> Subject: [talend-ai-eng] [IABG] Applying dynamic 
> policies via PolicyConstants.POLICY_OVERRIDE
> Hi,
> Just would like to verify design of the following solution:
> CXF client resolves endpoint dynamically using project specific 
> ServiceRegistry. Resolving works very similar to locator, but 
> ServiceRegistry delivers not only endpoint, but also effective policy 
> dynamically calculated for this call by ServiceRegistry.
> The client should apply this EffectivePolicy to message and let CXF to 
> activate corresponded interceptors.
> On the first view I have seen that 
> PolicyInInterceptor/PolicyOutInterceptor
> check PolicyConstants.POLICY_OVERRIDE message property and if they 
> find policy there, it will be applied. Technically for me is easy way 
> to apply my dynamic policies: I just set EffectivePolicy retrieved 
> from ServiceRegistry into PolicyConstants.POLICY_OVERRIDE message and 
> it will be automatically activated by CXF.
> Basically it works, but the question is that good way to apply dynamic 
> policies? Was PolicyConstants.POLICY_OVERRIDE message property 
> introduced for such cases?
> If no, what are the alternatives?
> Regards,
> Andrei.
Daniel Kulp
VP - Open Source Development - Application Integration Talend Community Coder

View raw message