cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1222777 - in /cxf/branches/2.4.x-fixes: ./ rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInInterceptor.java
Date Fri, 23 Dec 2011 18:22:49 GMT
Author: dkulp
Date: Fri Dec 23 18:22:49 2011
New Revision: 1222777

URL: http://svn.apache.org/viewvc?rev=1222777&view=rev
Log:
Merged revisions 1222754 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1222754 | dkulp | 2011-12-23 12:09:52 -0500 (Fri, 23 Dec 2011) | 2 lines
  
  [CXF-3996] Allow POLICY_OVERRIDE to work on server side in.
  Patch from Andrei Shakirin applied.
........

Modified:
    cxf/branches/2.4.x-fixes/   (props changed)
    cxf/branches/2.4.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInInterceptor.java

Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.4.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInInterceptor.java?rev=1222777&r1=1222776&r2=1222777&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInInterceptor.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInInterceptor.java
Fri Dec 23 18:22:49 2011
@@ -65,30 +65,34 @@ public class PolicyInInterceptor extends
         if (null == pe) {
             return;
         }
+
+        // 1. Check overridden policy
+        Policy p = (Policy)msg.getContextualProperty(PolicyConstants.POLICY_OVERRIDE);
+        if (p != null) {
+            EndpointPolicyImpl endpi = new EndpointPolicyImpl(p);
+            EffectivePolicyImpl effectivePolicy = new EffectivePolicyImpl();
+            effectivePolicy.initialise(endpi, (PolicyEngineImpl)pe, true);
+            msg.put(EffectivePolicy.class, effectivePolicy);
+            PolicyUtils.logPolicy(LOG, Level.FINEST, "Using effective policy: ", 
+                                  effectivePolicy.getPolicy());
+            
+            List<Interceptor<? extends Message>> interceptors = effectivePolicy.getInterceptors();
+            for (Interceptor<? extends Message> i : interceptors) {            
+                msg.getInterceptorChain().add(i);
+                LOG.log(Level.FINE, "Added interceptor of type {0}", i.getClass().getSimpleName());
+            }
+            Collection<Assertion> assertions = effectivePolicy.getChosenAlternative();
+            if (null != assertions && !assertions.isEmpty()) {
+                msg.put(AssertionInfoMap.class, new AssertionInfoMap(assertions));
+                msg.getInterceptorChain().add(PolicyVerificationInInterceptor.INSTANCE);
+            }
+        }
         
+        // 2. Process client policy
         if (MessageUtils.isRequestor(msg)) {
             
             BindingOperationInfo boi = exchange.get(BindingOperationInfo.class);
-            Policy p = (Policy)msg.getContextualProperty(PolicyConstants.POLICY_OVERRIDE);
-            if (p != null) {
-                EndpointPolicyImpl endpi = new EndpointPolicyImpl(p);
-                EffectivePolicyImpl effectivePolicy = new EffectivePolicyImpl();
-                effectivePolicy.initialise(endpi, (PolicyEngineImpl)pe, true);
-                msg.put(EffectivePolicy.class, effectivePolicy);
-                PolicyUtils.logPolicy(LOG, Level.FINEST, "Using effective policy: ", 
-                                      effectivePolicy.getPolicy());
-                
-                List<Interceptor<? extends Message>> interceptors = effectivePolicy.getInterceptors();
-                for (Interceptor<? extends Message> i : interceptors) {           

-                    msg.getInterceptorChain().add(i);
-                    LOG.log(Level.FINE, "Added interceptor of type {0}", i.getClass().getSimpleName());
-                }
-                Collection<Assertion> assertions = effectivePolicy.getChosenAlternative();
-                if (null != assertions && !assertions.isEmpty()) {
-                    msg.put(AssertionInfoMap.class, new AssertionInfoMap(assertions));
-                    msg.getInterceptorChain().add(PolicyVerificationInInterceptor.INSTANCE);
-                }
-            } else if (boi == null) {
+            if (boi == null) {
                 Conduit conduit = exchange.getConduit(msg);
             
                 EndpointPolicy ep = pe.getClientEndpointPolicy(ei, conduit);
@@ -100,8 +104,7 @@ public class PolicyInInterceptor extends
                     }
                 }
                 
-                // insert assertions of endpoint's vocabulary into message
-                
+                // Insert assertions of endpoint's vocabulary into message
                 Collection<Assertion> assertions = ep.getVocabulary();
                 if (null != assertions && !assertions.isEmpty()) {
                     msg.put(AssertionInfoMap.class, new AssertionInfoMap(assertions));
@@ -126,6 +129,7 @@ public class PolicyInInterceptor extends
                 }
             }
         } else {            
+            // 3. Process server policy
             Destination destination = exchange.getDestination();
             
             // We do not know the underlying message type yet - so we pre-emptively add interceptors

@@ -150,4 +154,4 @@ public class PolicyInInterceptor extends
             }
         }
     }
-}
+}
\ No newline at end of file



Mime
View raw message