Skip to content

Commit

Permalink
Liberty change added
Browse files Browse the repository at this point in the history
  • Loading branch information
BerksanAtes committed Mar 24, 2022
1 parent 67f5491 commit 26bf5ae
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public class SwAOutInterceptor extends AbstractSoapInterceptor {
private static final Set<String> SWA_REF_NO_METHOD
= Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>(4, 0.75f, 2));

// Begin copied over from CXF 2.6.2
// Liberty change begin migration of behaviour from CXF 2.6.2
private static boolean skipHasSwaRef;

static {
Expand All @@ -101,7 +101,7 @@ public class SwAOutInterceptor extends AbstractSoapInterceptor {
skipHasSwaRef = false;
}

}// End copied over from CXF 2.6.2
}// Liberty change end

AttachmentOutInterceptor attachOut = new AttachmentOutInterceptor();

Expand Down Expand Up @@ -162,13 +162,13 @@ public void handleMessage(SoapMessage message) throws Fault {
if (bmi == null) {
return;
}
// Begin copied over from CXF 2.6.2
// Liberty change begin migration of behaviour from CXF 2.6.2
Boolean newAttachment = false;
Message exOutMsg = ex.getOutMessage();
if (exOutMsg != null) {
newAttachment = MessageUtils.isTrue(exOutMsg.getContextualProperty("cxf.add.attachments"));
LOG.log(Level.FINE, "Request context attachment property: cxf.add.attachments is set to: " + newAttachment);
} // End copied over from CXF 2.6.2
} // Liberty change end

SoapBodyInfo sbi = bmi.getExtensor(SoapBodyInfo.class);

Expand All @@ -177,6 +177,7 @@ public void handleMessage(SoapMessage message) throws Fault {
DataBinding db = s.getDataBinding();
if (db instanceof JAXBDataBinding
&& hasSwaRef((JAXBDataBinding) db)) {
// Liberty change begin migration of behaviour from CXF 2.6.2
Boolean includeAttachs = false;
Message exInpMsg = ex.getInMessage();
LOG.log(Level.FINE, "Exchange Input message: " + exInpMsg);
Expand All @@ -188,7 +189,7 @@ && hasSwaRef((JAXBDataBinding) db)) {
setupAttachmentOutput(message);
} else {
skipAttachmentOutput(message);
}
} // Liberty change end
}
return;
}
Expand Down Expand Up @@ -366,7 +367,7 @@ private Collection<Attachment> setupAttachmentOutput(SoapMessage message) {
return atts;
}

// Begin copied over from CXF 2.6.2
// Liberty change begin migration of behaviour from CXF 2.6.2
private Collection<Attachment> skipAttachmentOutput(SoapMessage message) {

Collection<Attachment> atts = message.getAttachments();
Expand All @@ -384,5 +385,5 @@ private Collection<Attachment> skipAttachmentOutput(SoapMessage message) {
}

return atts;
}// End copied over from CXF 2.6.2
}// Liberty change end
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public class PolicyEngineImpl implements PolicyEngine, BusExtension {
private boolean addedBusInterceptors;
private AlternativeSelector alternativeSelector;

// Liberty change begin migration of behaviour from CXF 2.6.2
private static boolean ignoreUnsupportedPolicy;

static {
Expand All @@ -94,7 +95,7 @@ public class PolicyEngineImpl implements PolicyEngine, BusExtension {
} else {
ignoreUnsupportedPolicy = false;
}
}
} // Liberty change end


public PolicyEngineImpl() {
Expand Down Expand Up @@ -666,13 +667,14 @@ public boolean supportsAlternative(Collection<? extends PolicyComponent> alterna
if (s.isEmpty()) {
if (doLog) {
LOG.fine("Alternative " + a.getName() + " is not supported");
// Liberty change begin migration of behaviour from CXF 2.6.2
if (ignoreUnsupportedPolicy) {
LOG.fine("WARNING: Unsupported policy assertions will be ignored because "
+ "property cxf.ignore.unsupported.policy is set to true.");
return true;
} else {
return false;
}
} // Liberty change end
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public class PolicyVerificationInInterceptor extends AbstractPolicyInterceptor {

private static final Logger LOG = LogUtils.getL7dLogger(PolicyVerificationInInterceptor.class);

// Liberty change begin migration of behaviour from CXF 2.6.2
private static boolean ignoreUnsupportedPolicy;

static {
Expand All @@ -57,7 +58,7 @@ public class PolicyVerificationInInterceptor extends AbstractPolicyInterceptor {
&& skipPolicyCheck.trim().equalsIgnoreCase("true")) {
ignoreUnsupportedPolicy = true;
}
}
}// Liberty change end

public PolicyVerificationInInterceptor() {
super(Phase.PRE_INVOKE);
Expand Down Expand Up @@ -113,14 +114,15 @@ protected void handle(Message message) {
}
}
try {
// Liberty change begin migration of behaviour from CXF 2.6.2
List<List<Assertion>> usedAlternatives = null;

if (ignoreUnsupportedPolicy) {
LOG.fine("WARNING: checkEffectivePolicy will not be called because "
+ "property cxf.ignore.unsupported.policy is set to true.");
} else {
usedAlternatives = aim.checkEffectivePolicy(effectivePolicy.getPolicy());
}
}// Liberty change end

if (usedAlternatives != null && !usedAlternatives.isEmpty() && message.getExchange() != null) {
message.getExchange().put("ws-policy.validated.alternatives", usedAlternatives);
Expand Down

0 comments on commit 26bf5ae

Please sign in to comment.