com.sun.xml.internal.ws.api.client.SelectOptimalEncodingFeature Java Examples

The following examples show how to use com.sun.xml.internal.ws.api.client.SelectOptimalEncodingFeature. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SelectOptimalEncodingFeatureConfigurator.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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<WebServiceFeature>();
    if ((key != null) && (policyMap != null)) {
        Policy policy = policyMap.getEndpointEffectivePolicy(key);
        if (null!=policy && policy.contains(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(SELECT_OPTIMAL_ENCODING_ASSERTION.equals(assertion.getName())){
                        String value = assertion.getAttributeValue(enabled);
                        boolean isSelectOptimalEncodingEnabled = value == null || Boolean.valueOf(value.trim());
                        features.add(new SelectOptimalEncodingFeature(isSelectOptimalEncodingEnabled));
                    }
                }
            }
        }
    }
    return features;
}
 
Example #2
Source File: SelectOptimalEncodingFeatureConfigurator.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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<WebServiceFeature>();
    if ((key != null) && (policyMap != null)) {
        Policy policy = policyMap.getEndpointEffectivePolicy(key);
        if (null!=policy && policy.contains(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(SELECT_OPTIMAL_ENCODING_ASSERTION.equals(assertion.getName())){
                        String value = assertion.getAttributeValue(enabled);
                        boolean isSelectOptimalEncodingEnabled = value == null || Boolean.valueOf(value.trim());
                        features.add(new SelectOptimalEncodingFeature(isSelectOptimalEncodingEnabled));
                    }
                }
            }
        }
    }
    return features;
}
 
Example #3
Source File: SelectOptimalEncodingFeatureConfigurator.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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<WebServiceFeature>();
    if ((key != null) && (policyMap != null)) {
        Policy policy = policyMap.getEndpointEffectivePolicy(key);
        if (null!=policy && policy.contains(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(SELECT_OPTIMAL_ENCODING_ASSERTION.equals(assertion.getName())){
                        String value = assertion.getAttributeValue(enabled);
                        boolean isSelectOptimalEncodingEnabled = value == null || Boolean.valueOf(value.trim());
                        features.add(new SelectOptimalEncodingFeature(isSelectOptimalEncodingEnabled));
                    }
                }
            }
        }
    }
    return features;
}
 
Example #4
Source File: SelectOptimalEncodingFeatureConfigurator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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<WebServiceFeature>();
    if ((key != null) && (policyMap != null)) {
        Policy policy = policyMap.getEndpointEffectivePolicy(key);
        if (null!=policy && policy.contains(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(SELECT_OPTIMAL_ENCODING_ASSERTION.equals(assertion.getName())){
                        String value = assertion.getAttributeValue(enabled);
                        boolean isSelectOptimalEncodingEnabled = value == null || Boolean.valueOf(value.trim());
                        features.add(new SelectOptimalEncodingFeature(isSelectOptimalEncodingEnabled));
                    }
                }
            }
        }
    }
    return features;
}
 
Example #5
Source File: SelectOptimalEncodingFeatureConfigurator.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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<WebServiceFeature>();
    if ((key != null) && (policyMap != null)) {
        Policy policy = policyMap.getEndpointEffectivePolicy(key);
        if (null!=policy && policy.contains(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(SELECT_OPTIMAL_ENCODING_ASSERTION.equals(assertion.getName())){
                        String value = assertion.getAttributeValue(enabled);
                        boolean isSelectOptimalEncodingEnabled = value == null || Boolean.valueOf(value.trim());
                        features.add(new SelectOptimalEncodingFeature(isSelectOptimalEncodingEnabled));
                    }
                }
            }
        }
    }
    return features;
}
 
Example #6
Source File: SelectOptimalEncodingFeatureConfigurator.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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<WebServiceFeature>();
    if ((key != null) && (policyMap != null)) {
        Policy policy = policyMap.getEndpointEffectivePolicy(key);
        if (null!=policy && policy.contains(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(SELECT_OPTIMAL_ENCODING_ASSERTION.equals(assertion.getName())){
                        String value = assertion.getAttributeValue(enabled);
                        boolean isSelectOptimalEncodingEnabled = value == null || Boolean.valueOf(value.trim());
                        features.add(new SelectOptimalEncodingFeature(isSelectOptimalEncodingEnabled));
                    }
                }
            }
        }
    }
    return features;
}
 
Example #7
Source File: SelectOptimalEncodingFeatureConfigurator.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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<WebServiceFeature>();
    if ((key != null) && (policyMap != null)) {
        Policy policy = policyMap.getEndpointEffectivePolicy(key);
        if (null!=policy && policy.contains(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(SELECT_OPTIMAL_ENCODING_ASSERTION.equals(assertion.getName())){
                        String value = assertion.getAttributeValue(enabled);
                        boolean isSelectOptimalEncodingEnabled = value == null || Boolean.valueOf(value.trim());
                        features.add(new SelectOptimalEncodingFeature(isSelectOptimalEncodingEnabled));
                    }
                }
            }
        }
    }
    return features;
}
 
Example #8
Source File: SelectOptimalEncodingFeatureConfigurator.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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<WebServiceFeature>();
    if ((key != null) && (policyMap != null)) {
        Policy policy = policyMap.getEndpointEffectivePolicy(key);
        if (null!=policy && policy.contains(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(SELECT_OPTIMAL_ENCODING_ASSERTION.equals(assertion.getName())){
                        String value = assertion.getAttributeValue(enabled);
                        boolean isSelectOptimalEncodingEnabled = value == null || Boolean.valueOf(value.trim());
                        features.add(new SelectOptimalEncodingFeature(isSelectOptimalEncodingEnabled));
                    }
                }
            }
        }
    }
    return features;
}
 
Example #9
Source File: SOAPBindingCodec.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public SOAPBindingCodec(WSFeatureList features, StreamSOAPCodec xmlSoapCodec) {
    super(getSoapVersion(features), features);

    this.xmlSoapCodec = xmlSoapCodec;
    xmlMimeType = xmlSoapCodec.getMimeType();

    xmlMtomCodec = new MtomCodec(version, xmlSoapCodec, features);

    xmlSwaCodec = new SwACodec(version, features, xmlSoapCodec);

    String clientAcceptedContentTypes = xmlSoapCodec.getMimeType() + ", " +
            xmlMtomCodec.getMimeType();

    WebServiceFeature fi = features.get(FastInfosetFeature.class);
    isFastInfosetDisabled = (fi != null && !fi.isEnabled());
    if (!isFastInfosetDisabled) {
        fiSoapCodec = getFICodec(xmlSoapCodec, version);
        if (fiSoapCodec != null) {
            fiMimeType = fiSoapCodec.getMimeType();
            fiSwaCodec = new SwACodec(version, features, fiSoapCodec);
            connegXmlAccept = fiMimeType + ", " + clientAcceptedContentTypes;

            /**
             * This feature will only be present on the client side.
             *
             * Fast Infoset is enabled on the client if the service
             * explicitly supports Fast Infoset.
             */
            WebServiceFeature select = features.get(SelectOptimalEncodingFeature.class);
            if (select != null) { // if the client FI feature is set - ignore negotiation property
                ignoreContentNegotiationProperty = true;
                if (select.isEnabled()) {
                    // If the client's FI encoding feature is enabled, and server's is not disabled
                    if (fi != null) {  // if server's FI feature also enabled
                        useFastInfosetForEncoding = true;
                    }

                    clientAcceptedContentTypes = connegXmlAccept;
                } else {  // If client FI feature is disabled
                    isFastInfosetDisabled = true;
                }
            }
        } else {
            // Fast Infoset could not be loaded by the runtime
            isFastInfosetDisabled = true;
            fiSwaCodec = null;
            fiMimeType = "";
            connegXmlAccept = clientAcceptedContentTypes;
            ignoreContentNegotiationProperty = true;
        }
    } else {
        // Fast Infoset is explicitly not supported by the service
        fiSoapCodec = fiSwaCodec = null;
        fiMimeType = "";
        connegXmlAccept = clientAcceptedContentTypes;
        ignoreContentNegotiationProperty = true;
    }

    xmlAccept = clientAcceptedContentTypes;

    if(getSoapVersion(features) == null)
        throw new WebServiceException("Expecting a SOAP binding but found ");
}
 
Example #10
Source File: SOAPBindingCodec.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public SOAPBindingCodec(WSFeatureList features, StreamSOAPCodec xmlSoapCodec) {
    super(getSoapVersion(features), features);

    this.xmlSoapCodec = xmlSoapCodec;
    xmlMimeType = xmlSoapCodec.getMimeType();

    xmlMtomCodec = new MtomCodec(version, xmlSoapCodec, features);

    xmlSwaCodec = new SwACodec(version, features, xmlSoapCodec);

    String clientAcceptedContentTypes = xmlSoapCodec.getMimeType() + ", " +
            xmlMtomCodec.getMimeType();

    WebServiceFeature fi = features.get(FastInfosetFeature.class);
    isFastInfosetDisabled = (fi != null && !fi.isEnabled());
    if (!isFastInfosetDisabled) {
        fiSoapCodec = getFICodec(xmlSoapCodec, version);
        if (fiSoapCodec != null) {
            fiMimeType = fiSoapCodec.getMimeType();
            fiSwaCodec = new SwACodec(version, features, fiSoapCodec);
            connegXmlAccept = fiMimeType + ", " + clientAcceptedContentTypes;

            /**
             * This feature will only be present on the client side.
             *
             * Fast Infoset is enabled on the client if the service
             * explicitly supports Fast Infoset.
             */
            WebServiceFeature select = features.get(SelectOptimalEncodingFeature.class);
            if (select != null) { // if the client FI feature is set - ignore negotiation property
                ignoreContentNegotiationProperty = true;
                if (select.isEnabled()) {
                    // If the client's FI encoding feature is enabled, and server's is not disabled
                    if (fi != null) {  // if server's FI feature also enabled
                        useFastInfosetForEncoding = true;
                    }

                    clientAcceptedContentTypes = connegXmlAccept;
                } else {  // If client FI feature is disabled
                    isFastInfosetDisabled = true;
                }
            }
        } else {
            // Fast Infoset could not be loaded by the runtime
            isFastInfosetDisabled = true;
            fiSwaCodec = null;
            fiMimeType = "";
            connegXmlAccept = clientAcceptedContentTypes;
            ignoreContentNegotiationProperty = true;
        }
    } else {
        // Fast Infoset is explicitly not supported by the service
        fiSoapCodec = fiSwaCodec = null;
        fiMimeType = "";
        connegXmlAccept = clientAcceptedContentTypes;
        ignoreContentNegotiationProperty = true;
    }

    xmlAccept = clientAcceptedContentTypes;

    if(getSoapVersion(features) == null)
        throw new WebServiceException("Expecting a SOAP binding but found ");
}
 
Example #11
Source File: SOAPBindingCodec.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public SOAPBindingCodec(WSFeatureList features, StreamSOAPCodec xmlSoapCodec) {
    super(getSoapVersion(features), features);

    this.xmlSoapCodec = xmlSoapCodec;
    xmlMimeType = xmlSoapCodec.getMimeType();

    xmlMtomCodec = new MtomCodec(version, xmlSoapCodec, features);

    xmlSwaCodec = new SwACodec(version, features, xmlSoapCodec);

    String clientAcceptedContentTypes = xmlSoapCodec.getMimeType() + ", " +
            xmlMtomCodec.getMimeType();

    WebServiceFeature fi = features.get(FastInfosetFeature.class);
    isFastInfosetDisabled = (fi != null && !fi.isEnabled());
    if (!isFastInfosetDisabled) {
        fiSoapCodec = getFICodec(xmlSoapCodec, version);
        if (fiSoapCodec != null) {
            fiMimeType = fiSoapCodec.getMimeType();
            fiSwaCodec = new SwACodec(version, features, fiSoapCodec);
            connegXmlAccept = fiMimeType + ", " + clientAcceptedContentTypes;

            /**
             * This feature will only be present on the client side.
             *
             * Fast Infoset is enabled on the client if the service
             * explicitly supports Fast Infoset.
             */
            WebServiceFeature select = features.get(SelectOptimalEncodingFeature.class);
            if (select != null) { // if the client FI feature is set - ignore negotiation property
                ignoreContentNegotiationProperty = true;
                if (select.isEnabled()) {
                    // If the client's FI encoding feature is enabled, and server's is not disabled
                    if (fi != null) {  // if server's FI feature also enabled
                        useFastInfosetForEncoding = true;
                    }

                    clientAcceptedContentTypes = connegXmlAccept;
                } else {  // If client FI feature is disabled
                    isFastInfosetDisabled = true;
                }
            }
        } else {
            // Fast Infoset could not be loaded by the runtime
            isFastInfosetDisabled = true;
            fiSwaCodec = null;
            fiMimeType = "";
            connegXmlAccept = clientAcceptedContentTypes;
            ignoreContentNegotiationProperty = true;
        }
    } else {
        // Fast Infoset is explicitly not supported by the service
        fiSoapCodec = fiSwaCodec = null;
        fiMimeType = "";
        connegXmlAccept = clientAcceptedContentTypes;
        ignoreContentNegotiationProperty = true;
    }

    xmlAccept = clientAcceptedContentTypes;

    if(getSoapVersion(features) == null)
        throw new WebServiceException("Expecting a SOAP binding but found ");
}
 
Example #12
Source File: SOAPBindingCodec.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public SOAPBindingCodec(WSFeatureList features, StreamSOAPCodec xmlSoapCodec) {
    super(getSoapVersion(features), features);

    this.xmlSoapCodec = xmlSoapCodec;
    xmlMimeType = xmlSoapCodec.getMimeType();

    xmlMtomCodec = new MtomCodec(version, xmlSoapCodec, features);

    xmlSwaCodec = new SwACodec(version, features, xmlSoapCodec);

    String clientAcceptedContentTypes = xmlSoapCodec.getMimeType() + ", " +
            xmlMtomCodec.getMimeType();

    WebServiceFeature fi = features.get(FastInfosetFeature.class);
    isFastInfosetDisabled = (fi != null && !fi.isEnabled());
    if (!isFastInfosetDisabled) {
        fiSoapCodec = getFICodec(xmlSoapCodec, version);
        if (fiSoapCodec != null) {
            fiMimeType = fiSoapCodec.getMimeType();
            fiSwaCodec = new SwACodec(version, features, fiSoapCodec);
            connegXmlAccept = fiMimeType + ", " + clientAcceptedContentTypes;

            /**
             * This feature will only be present on the client side.
             *
             * Fast Infoset is enabled on the client if the service
             * explicitly supports Fast Infoset.
             */
            WebServiceFeature select = features.get(SelectOptimalEncodingFeature.class);
            if (select != null) { // if the client FI feature is set - ignore negotiation property
                ignoreContentNegotiationProperty = true;
                if (select.isEnabled()) {
                    // If the client's FI encoding feature is enabled, and server's is not disabled
                    if (fi != null) {  // if server's FI feature also enabled
                        useFastInfosetForEncoding = true;
                    }

                    clientAcceptedContentTypes = connegXmlAccept;
                } else {  // If client FI feature is disabled
                    isFastInfosetDisabled = true;
                }
            }
        } else {
            // Fast Infoset could not be loaded by the runtime
            isFastInfosetDisabled = true;
            fiSwaCodec = null;
            fiMimeType = "";
            connegXmlAccept = clientAcceptedContentTypes;
            ignoreContentNegotiationProperty = true;
        }
    } else {
        // Fast Infoset is explicitly not supported by the service
        fiSoapCodec = fiSwaCodec = null;
        fiMimeType = "";
        connegXmlAccept = clientAcceptedContentTypes;
        ignoreContentNegotiationProperty = true;
    }

    xmlAccept = clientAcceptedContentTypes;

    if(getSoapVersion(features) == null)
        throw new WebServiceException("Expecting a SOAP binding but found ");
}
 
Example #13
Source File: SOAPBindingCodec.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public SOAPBindingCodec(WSFeatureList features, StreamSOAPCodec xmlSoapCodec) {
    super(getSoapVersion(features), features);

    this.xmlSoapCodec = xmlSoapCodec;
    xmlMimeType = xmlSoapCodec.getMimeType();

    xmlMtomCodec = new MtomCodec(version, xmlSoapCodec, features);

    xmlSwaCodec = new SwACodec(version, features, xmlSoapCodec);

    String clientAcceptedContentTypes = xmlSoapCodec.getMimeType() + ", " +
            xmlMtomCodec.getMimeType();

    WebServiceFeature fi = features.get(FastInfosetFeature.class);
    isFastInfosetDisabled = (fi != null && !fi.isEnabled());
    if (!isFastInfosetDisabled) {
        fiSoapCodec = getFICodec(xmlSoapCodec, version);
        if (fiSoapCodec != null) {
            fiMimeType = fiSoapCodec.getMimeType();
            fiSwaCodec = new SwACodec(version, features, fiSoapCodec);
            connegXmlAccept = fiMimeType + ", " + clientAcceptedContentTypes;

            /**
             * This feature will only be present on the client side.
             *
             * Fast Infoset is enabled on the client if the service
             * explicitly supports Fast Infoset.
             */
            WebServiceFeature select = features.get(SelectOptimalEncodingFeature.class);
            if (select != null) { // if the client FI feature is set - ignore negotiation property
                ignoreContentNegotiationProperty = true;
                if (select.isEnabled()) {
                    // If the client's FI encoding feature is enabled, and server's is not disabled
                    if (fi != null) {  // if server's FI feature also enabled
                        useFastInfosetForEncoding = true;
                    }

                    clientAcceptedContentTypes = connegXmlAccept;
                } else {  // If client FI feature is disabled
                    isFastInfosetDisabled = true;
                }
            }
        } else {
            // Fast Infoset could not be loaded by the runtime
            isFastInfosetDisabled = true;
            fiSwaCodec = null;
            fiMimeType = "";
            connegXmlAccept = clientAcceptedContentTypes;
            ignoreContentNegotiationProperty = true;
        }
    } else {
        // Fast Infoset is explicitly not supported by the service
        fiSoapCodec = fiSwaCodec = null;
        fiMimeType = "";
        connegXmlAccept = clientAcceptedContentTypes;
        ignoreContentNegotiationProperty = true;
    }

    xmlAccept = clientAcceptedContentTypes;

    if(getSoapVersion(features) == null)
        throw new WebServiceException("Expecting a SOAP binding but found ");
}
 
Example #14
Source File: SOAPBindingCodec.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public SOAPBindingCodec(WSFeatureList features, StreamSOAPCodec xmlSoapCodec) {
    super(getSoapVersion(features), features);

    this.xmlSoapCodec = xmlSoapCodec;
    xmlMimeType = xmlSoapCodec.getMimeType();

    xmlMtomCodec = new MtomCodec(version, xmlSoapCodec, features);

    xmlSwaCodec = new SwACodec(version, features, xmlSoapCodec);

    String clientAcceptedContentTypes = xmlSoapCodec.getMimeType() + ", " +
            xmlMtomCodec.getMimeType();

    WebServiceFeature fi = features.get(FastInfosetFeature.class);
    isFastInfosetDisabled = (fi != null && !fi.isEnabled());
    if (!isFastInfosetDisabled) {
        fiSoapCodec = getFICodec(xmlSoapCodec, version);
        if (fiSoapCodec != null) {
            fiMimeType = fiSoapCodec.getMimeType();
            fiSwaCodec = new SwACodec(version, features, fiSoapCodec);
            connegXmlAccept = fiMimeType + ", " + clientAcceptedContentTypes;

            /**
             * This feature will only be present on the client side.
             *
             * Fast Infoset is enabled on the client if the service
             * explicitly supports Fast Infoset.
             */
            WebServiceFeature select = features.get(SelectOptimalEncodingFeature.class);
            if (select != null) { // if the client FI feature is set - ignore negotiation property
                ignoreContentNegotiationProperty = true;
                if (select.isEnabled()) {
                    // If the client's FI encoding feature is enabled, and server's is not disabled
                    if (fi != null) {  // if server's FI feature also enabled
                        useFastInfosetForEncoding = true;
                    }

                    clientAcceptedContentTypes = connegXmlAccept;
                } else {  // If client FI feature is disabled
                    isFastInfosetDisabled = true;
                }
            }
        } else {
            // Fast Infoset could not be loaded by the runtime
            isFastInfosetDisabled = true;
            fiSwaCodec = null;
            fiMimeType = "";
            connegXmlAccept = clientAcceptedContentTypes;
            ignoreContentNegotiationProperty = true;
        }
    } else {
        // Fast Infoset is explicitly not supported by the service
        fiSoapCodec = fiSwaCodec = null;
        fiMimeType = "";
        connegXmlAccept = clientAcceptedContentTypes;
        ignoreContentNegotiationProperty = true;
    }

    xmlAccept = clientAcceptedContentTypes;

    if(getSoapVersion(features) == null)
        throw new WebServiceException("Expecting a SOAP binding but found ");
}
 
Example #15
Source File: SOAPBindingCodec.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public SOAPBindingCodec(WSFeatureList features, StreamSOAPCodec xmlSoapCodec) {
    super(getSoapVersion(features), features);

    this.xmlSoapCodec = xmlSoapCodec;
    xmlMimeType = xmlSoapCodec.getMimeType();

    xmlMtomCodec = new MtomCodec(version, xmlSoapCodec, features);

    xmlSwaCodec = new SwACodec(version, features, xmlSoapCodec);

    String clientAcceptedContentTypes = xmlSoapCodec.getMimeType() + ", " +
            xmlMtomCodec.getMimeType();

    WebServiceFeature fi = features.get(FastInfosetFeature.class);
    isFastInfosetDisabled = (fi != null && !fi.isEnabled());
    if (!isFastInfosetDisabled) {
        fiSoapCodec = getFICodec(xmlSoapCodec, version);
        if (fiSoapCodec != null) {
            fiMimeType = fiSoapCodec.getMimeType();
            fiSwaCodec = new SwACodec(version, features, fiSoapCodec);
            connegXmlAccept = fiMimeType + ", " + clientAcceptedContentTypes;

            /**
             * This feature will only be present on the client side.
             *
             * Fast Infoset is enabled on the client if the service
             * explicitly supports Fast Infoset.
             */
            WebServiceFeature select = features.get(SelectOptimalEncodingFeature.class);
            if (select != null) { // if the client FI feature is set - ignore negotiation property
                ignoreContentNegotiationProperty = true;
                if (select.isEnabled()) {
                    // If the client's FI encoding feature is enabled, and server's is not disabled
                    if (fi != null) {  // if server's FI feature also enabled
                        useFastInfosetForEncoding = true;
                    }

                    clientAcceptedContentTypes = connegXmlAccept;
                } else {  // If client FI feature is disabled
                    isFastInfosetDisabled = true;
                }
            }
        } else {
            // Fast Infoset could not be loaded by the runtime
            isFastInfosetDisabled = true;
            fiSwaCodec = null;
            fiMimeType = "";
            connegXmlAccept = clientAcceptedContentTypes;
            ignoreContentNegotiationProperty = true;
        }
    } else {
        // Fast Infoset is explicitly not supported by the service
        fiSoapCodec = fiSwaCodec = null;
        fiMimeType = "";
        connegXmlAccept = clientAcceptedContentTypes;
        ignoreContentNegotiationProperty = true;
    }

    xmlAccept = clientAcceptedContentTypes;

    if(getSoapVersion(features) == null)
        throw new WebServiceException("Expecting a SOAP binding but found ");
}
 
Example #16
Source File: SOAPBindingCodec.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public SOAPBindingCodec(WSFeatureList features, StreamSOAPCodec xmlSoapCodec) {
    super(getSoapVersion(features), features);

    this.xmlSoapCodec = xmlSoapCodec;
    xmlMimeType = xmlSoapCodec.getMimeType();

    xmlMtomCodec = new MtomCodec(version, xmlSoapCodec, features);

    xmlSwaCodec = new SwACodec(version, features, xmlSoapCodec);

    String clientAcceptedContentTypes = xmlSoapCodec.getMimeType() + ", " +
            xmlMtomCodec.getMimeType();

    WebServiceFeature fi = features.get(FastInfosetFeature.class);
    isFastInfosetDisabled = (fi != null && !fi.isEnabled());
    if (!isFastInfosetDisabled) {
        fiSoapCodec = getFICodec(xmlSoapCodec, version);
        if (fiSoapCodec != null) {
            fiMimeType = fiSoapCodec.getMimeType();
            fiSwaCodec = new SwACodec(version, features, fiSoapCodec);
            connegXmlAccept = fiMimeType + ", " + clientAcceptedContentTypes;

            /**
             * This feature will only be present on the client side.
             *
             * Fast Infoset is enabled on the client if the service
             * explicitly supports Fast Infoset.
             */
            WebServiceFeature select = features.get(SelectOptimalEncodingFeature.class);
            if (select != null) { // if the client FI feature is set - ignore negotiation property
                ignoreContentNegotiationProperty = true;
                if (select.isEnabled()) {
                    // If the client's FI encoding feature is enabled, and server's is not disabled
                    if (fi != null) {  // if server's FI feature also enabled
                        useFastInfosetForEncoding = true;
                    }

                    clientAcceptedContentTypes = connegXmlAccept;
                } else {  // If client FI feature is disabled
                    isFastInfosetDisabled = true;
                }
            }
        } else {
            // Fast Infoset could not be loaded by the runtime
            isFastInfosetDisabled = true;
            fiSwaCodec = null;
            fiMimeType = "";
            connegXmlAccept = clientAcceptedContentTypes;
            ignoreContentNegotiationProperty = true;
        }
    } else {
        // Fast Infoset is explicitly not supported by the service
        fiSoapCodec = fiSwaCodec = null;
        fiMimeType = "";
        connegXmlAccept = clientAcceptedContentTypes;
        ignoreContentNegotiationProperty = true;
    }

    xmlAccept = clientAcceptedContentTypes;

    if(getSoapVersion(features) == null)
        throw new WebServiceException("Expecting a SOAP binding but found ");
}