use of com.sun.xml.ws.api.client.SelectOptimalEncodingFeature in project metro-jax-ws by eclipse-ee4j.
the class SelectOptimalEncodingFeatureConfigurator method getFeatures.
/**
* Process SelectOptimalEncoding policy assertions.
*
* @param key Key that identifies the endpoint scope.
* @param policyMap The policy map.
* @throws PolicyException If retrieving the policy triggered an exception.
*/
public Collection<WebServiceFeature> getFeatures(PolicyMapKey key, PolicyMap policyMap) throws PolicyException {
final Collection<WebServiceFeature> features = new LinkedList<>();
if ((key != null) && (policyMap != null)) {
Policy policy = policyMap.getEndpointEffectivePolicy(key);
if (null != policy && policy.contains(EncodingConstants.SELECT_OPTIMAL_ENCODING_ASSERTION)) {
Iterator<AssertionSet> assertions = policy.iterator();
while (assertions.hasNext()) {
AssertionSet assertionSet = assertions.next();
Iterator<PolicyAssertion> policyAssertion = assertionSet.iterator();
while (policyAssertion.hasNext()) {
PolicyAssertion assertion = policyAssertion.next();
if (EncodingConstants.SELECT_OPTIMAL_ENCODING_ASSERTION.equals(assertion.getName())) {
String value = assertion.getAttributeValue(enabled);
boolean isSelectOptimalEncodingEnabled = value == null || Boolean.parseBoolean(value.trim());
features.add(new SelectOptimalEncodingFeature(isSelectOptimalEncodingEnabled));
}
}
}
}
}
return features;
}
Aggregations