Author: dkulp Date: Wed Feb 13 17:09:17 2013 New Revision: 1445747 URL: http://svn.apache.org/r1445747 Log: Merged revisions 1445713 via git cherry-pick from https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes
........ r1445713 | dkulp | 2013-02-13 11:26:43 -0500 (Wed, 13 Feb 2013) | 18 lines Merged revisions 1445379 via git cherry-pick from https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes ........ r1445379 | dkulp | 2013-02-12 16:16:20 -0500 (Tue, 12 Feb 2013) | 10 lines Merged revisions 1445307 via git cherry-pick from https://svn.apache.org/repos/asf/cxf/trunk ........ r1445307 | dkulp | 2013-02-12 13:47:36 -0500 (Tue, 12 Feb 2013) | 2 lines [CXF-4814] Better selection of alternatives for outgoing response ........ ........ ........ Modified: cxf/branches/2.5.x-fixes/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java cxf/branches/2.5.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP12Constants.java cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AsymmetricBinding.java cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricBinding.java cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportBinding.java Modified: cxf/branches/2.5.x-fixes/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java?rev=1445747&r1=1445746&r2=1445747&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java (original) +++ cxf/branches/2.5.x-fixes/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java Wed Feb 13 17:09:17 2013 @@ -60,6 +60,9 @@ public class PrimitiveAssertion @Override protected Assertion clone(boolean opt) { + if (opt == this.optional) { + return this; + } return new PrimitiveAssertion(name, opt, ignorable); } Modified: cxf/branches/2.5.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java?rev=1445747&r1=1445746&r2=1445747&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java (original) +++ cxf/branches/2.5.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java Wed Feb 13 17:09:17 2013 @@ -33,6 +33,7 @@ import org.apache.cxf.endpoint.Client; import org.apache.cxf.endpoint.Endpoint; import org.apache.cxf.endpoint.Server; import org.apache.cxf.feature.AbstractFeature; +import org.apache.cxf.service.model.DescriptionInfo; import org.apache.cxf.service.model.EndpointInfo; import org.apache.cxf.ws.policy.attachment.external.ExternalAttachmentProvider; import org.apache.cxf.ws.policy.attachment.reference.ReferenceResolver; @@ -139,7 +140,7 @@ public class WSPolicyFeature extends Abs private Policy initializeEndpointPolicy(Endpoint endpoint, Bus bus) { initialize(bus); - + DescriptionInfo i = endpoint.getEndpointInfo().getDescription(); Collection<Policy> loadedPolicies = null; if (policyElements != null || policyReferenceElements != null) { loadedPolicies = new ArrayList<Policy>(); @@ -152,7 +153,7 @@ public class WSPolicyFeature extends Abs if (null != policyReferenceElements) { for (Element e : policyReferenceElements) { PolicyReference pr = builder.getPolicyReference(e); - Policy resolved = resolveReference(pr, e, builder, bus); + Policy resolved = resolveReference(pr, builder, bus, i); if (null != resolved) { loadedPolicies.add(resolved); } @@ -219,12 +220,12 @@ public class WSPolicyFeature extends Abs alternativeSelector = as; } - Policy resolveReference(PolicyReference ref, Element e, PolicyBuilder builder, Bus bus) { + Policy resolveReference(PolicyReference ref, PolicyBuilder builder, Bus bus, DescriptionInfo i) { Policy p = null; if (!ref.getURI().startsWith("#")) { - p = resolveExternal(ref, e.getBaseURI(), bus); + p = resolveExternal(ref, i.getBaseURI(), bus); } else { - p = resolveLocal(ref, e, bus); + p = resolveLocal(ref, bus, i); } if (null == p) { throw new PolicyException(new Message("UNRESOLVED_POLICY_REFERENCE_EXC", BUNDLE, ref.getURI())); @@ -233,9 +234,9 @@ public class WSPolicyFeature extends Abs return p; } - Policy resolveLocal(PolicyReference ref, Element e, final Bus bus) { + Policy resolveLocal(PolicyReference ref, final Bus bus, DescriptionInfo i) { String uri = ref.getURI().substring(1); - String absoluteURI = e.getBaseURI() + uri; + String absoluteURI = i.getBaseURI() + uri; PolicyRegistry registry = bus.getExtension(PolicyEngine.class).getRegistry(); Policy resolved = registry.lookup(absoluteURI); if (null != resolved) { Modified: cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP12Constants.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP12Constants.java?rev=1445747&r1=1445746&r2=1445747&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP12Constants.java (original) +++ cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP12Constants.java Wed Feb 13 17:09:17 2013 @@ -21,6 +21,7 @@ package org.apache.cxf.ws.security.polic import javax.xml.namespace.QName; import org.apache.cxf.common.util.StringUtils; +import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion; public final class SP12Constants extends SPConstants { @@ -346,6 +347,9 @@ public final class SP12Constants extends public static final QName ATTACHMENTS = new QName(SP12Constants.SP_NS, SPConstants.ATTACHMENTS); //////////////////////////////////////////////////////////////////////////////////////////////// + + public static final PrimitiveAssertion INCLUDE_TIMESTAMP_ASSERTION = new PrimitiveAssertion(INCLUDE_TIMESTAMP); + private SP12Constants() { } Modified: cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AsymmetricBinding.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AsymmetricBinding.java?rev=1445747&r1=1445746&r2=1445747&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AsymmetricBinding.java (original) +++ cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AsymmetricBinding.java Wed Feb 13 17:09:17 2013 @@ -24,7 +24,6 @@ import javax.xml.stream.XMLStreamExcepti import javax.xml.stream.XMLStreamWriter; import org.apache.cxf.ws.policy.PolicyBuilder; -import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion; import org.apache.cxf.ws.security.policy.SP12Constants; import org.apache.cxf.ws.security.policy.SPConstants; import org.apache.neethi.All; @@ -180,7 +179,7 @@ public class AsymmetricBinding extends S } */ if (isIncludeTimestamp()) { - all.addPolicyComponent(new PrimitiveAssertion(SP12Constants.INCLUDE_TIMESTAMP)); + all.addPolicyComponent(SP12Constants.INCLUDE_TIMESTAMP_ASSERTION); } if (getLayout() != null) { all.addPolicyComponent(getLayout()); Modified: cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricBinding.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricBinding.java?rev=1445747&r1=1445746&r2=1445747&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricBinding.java (original) +++ cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricBinding.java Wed Feb 13 17:09:17 2013 @@ -23,7 +23,6 @@ import javax.xml.stream.XMLStreamExcepti import javax.xml.stream.XMLStreamWriter; import org.apache.cxf.ws.policy.PolicyBuilder; -import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion; import org.apache.cxf.ws.security.policy.SP12Constants; import org.apache.cxf.ws.security.policy.SPConstants; import org.apache.neethi.All; @@ -128,7 +127,7 @@ public class SymmetricBinding extends Sy all.addPolicyComponent(this.getEncryptionToken()); } if (isIncludeTimestamp()) { - all.addPolicyComponent(new PrimitiveAssertion(SP12Constants.INCLUDE_TIMESTAMP)); + all.addPolicyComponent(SP12Constants.INCLUDE_TIMESTAMP_ASSERTION); } if (getLayout() != null) { all.addPolicyComponent(getLayout()); Modified: cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportBinding.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportBinding.java?rev=1445747&r1=1445746&r2=1445747&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportBinding.java (original) +++ cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportBinding.java Wed Feb 13 17:09:17 2013 @@ -23,7 +23,6 @@ import javax.xml.stream.XMLStreamExcepti import javax.xml.stream.XMLStreamWriter; import org.apache.cxf.ws.policy.PolicyBuilder; -import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion; import org.apache.cxf.ws.security.policy.SP12Constants; import org.apache.cxf.ws.security.policy.SPConstants; import org.apache.neethi.All; @@ -137,7 +136,7 @@ public class TransportBinding extends Bi all.addPolicyComponent(transportToken); } if (isIncludeTimestamp()) { - all.addPolicyComponent(new PrimitiveAssertion(SP12Constants.INCLUDE_TIMESTAMP)); + all.addPolicyComponent(SP12Constants.INCLUDE_TIMESTAMP_ASSERTION); } if (getLayout() != null) { all.addPolicyComponent(getLayout());
