You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2013/02/12 22:16:21 UTC
svn commit: r1445379 - in /cxf/branches/2.7.x-fixes:
rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/
rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builder/primitive/
rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/
rt/ws/secur...
Author: dkulp
Date: Tue Feb 12 21:16:20 2013
New Revision: 1445379
URL: http://svn.apache.org/r1445379
Log:
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.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java
cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java
cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP12Constants.java
cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AsymmetricBinding.java
cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricBinding.java
cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportBinding.java
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/algsuite/AlgorithmSuiteTest.java
Modified: cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java?rev=1445379&r1=1445378&r2=1445379&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java (original)
+++ cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java Tue Feb 12 21:16:20 2013
@@ -34,6 +34,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;
@@ -136,7 +137,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>();
@@ -149,7 +150,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);
}
@@ -216,12 +217,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()));
@@ -230,9 +231,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.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java?rev=1445379&r1=1445378&r2=1445379&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java (original)
+++ cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java Tue Feb 12 21:16:20 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.7.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.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP12Constants.java?rev=1445379&r1=1445378&r2=1445379&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP12Constants.java (original)
+++ cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP12Constants.java Tue Feb 12 21:16:20 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.7.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.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AsymmetricBinding.java?rev=1445379&r1=1445378&r2=1445379&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AsymmetricBinding.java (original)
+++ cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AsymmetricBinding.java Tue Feb 12 21:16:20 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.7.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.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricBinding.java?rev=1445379&r1=1445378&r2=1445379&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricBinding.java (original)
+++ cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricBinding.java Tue Feb 12 21:16:20 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.7.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.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportBinding.java?rev=1445379&r1=1445378&r2=1445379&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportBinding.java (original)
+++ cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportBinding.java Tue Feb 12 21:16:20 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());
Modified: cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/algsuite/AlgorithmSuiteTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/algsuite/AlgorithmSuiteTest.java?rev=1445379&r1=1445378&r2=1445379&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/algsuite/AlgorithmSuiteTest.java (original)
+++ cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/algsuite/AlgorithmSuiteTest.java Tue Feb 12 21:16:20 2013
@@ -112,7 +112,6 @@ public class AlgorithmSuiteTest extends
}
@org.junit.Test
- @org.junit.Ignore
public void testCombinedPolicy() throws Exception {
if (!SecurityTestUtil.checkUnrestrictedPoliciesInstalled()) {