MtomMapUpdateProviderpublic class MtomMapUpdateProvider extends Object implements com.sun.xml.ws.policy.jaxws.spi.PolicyMapUpdateProviderGenerate an MTOM policy if MTOM was enabled. |
Fields Summary |
---|
private static final com.sun.xml.ws.policy.privateutil.PolicyLogger | logger |
Methods Summary |
---|
private com.sun.xml.ws.policy.Policy | createMtomPolicy(javax.xml.namespace.QName bindingName)Create a policy with an MTOM assertion.
ArrayList<AssertionSet> assertionSets = new ArrayList<AssertionSet>(1);
ArrayList<PolicyAssertion> assertions = new ArrayList<PolicyAssertion>(1);
assertions.add(new MtomAssertion());
assertionSets.add(AssertionSet.createAssertionSet(assertions));
return Policy.createPolicy(null, bindingName.getLocalPart() + "_MTOM_Policy", assertionSets);
| public void | update(com.sun.xml.ws.policy.PolicyMapExtender policyMapMutator, com.sun.xml.ws.policy.PolicyMap policyMap, com.sun.xml.ws.api.model.SEIModel model, com.sun.xml.ws.api.WSBinding wsBinding)Generates an MTOM policy if MTOM is enabled.
- If MTOM is enabled
- If MTOM policy does not already exist, generate
- Otherwise do nothing
- Otherwise, do nothing (that implies that we do not remove any MTOM policies if MTOM is disabled)
logger.entering(policyMapMutator, policyMap, model, wsBinding);
if (policyMap != null) {
final MTOMFeature mtomFeature = wsBinding.getFeature(MTOMFeature.class);
if (logger.isLoggable(Level.FINEST)) {
logger.finest("mtomFeature = " + mtomFeature);
}
if ((mtomFeature != null) && mtomFeature.isEnabled()) {
final PolicyMapKey endpointKey = PolicyMap.createWsdlEndpointScopeKey(model.getServiceQName(), model.getPortName());
final Policy existingPolicy = policyMap.getEndpointEffectivePolicy(endpointKey);
if ((existingPolicy == null) || ! existingPolicy.contains(OPTIMIZED_MIME_SERIALIZATION_ASSERTION)) {
final QName bindingName = model.getBoundPortTypeName();
final Policy mtomPolicy = createMtomPolicy(bindingName);
PolicySubject mtomPolicySubject = new PolicySubject(bindingName, mtomPolicy);
PolicyMapKey aKey = PolicyMap.createWsdlEndpointScopeKey(model.getServiceQName(), model.getPortName());
policyMapMutator.putEndpointSubject(aKey, mtomPolicySubject);
logger.fine("Added MTOM policy with ID \"" + mtomPolicy.getIdOrName() + "\" to binding element \"" + bindingName + "\"");
} else {
logger.fine("MTOM policy exists already, doing nothing");
}
}
} // endif policy map not null
logger.exiting();
|
|