Java Code Examples for javax.xml.ws.WebServiceFeature#isEnabled()

The following examples show how to use javax.xml.ws.WebServiceFeature#isEnabled() . 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: WebServiceFeatureList.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 * @param endpointClass web service impl class
 */
public void parseAnnotations(Class<?> endpointClass) {
    for (Annotation a : endpointClass.getAnnotations()) {
        WebServiceFeature ftr = getFeature(a);
        if (ftr != null) {
            if (ftr instanceof MTOMFeature) {
                // check conflict with @BindingType
                BindingID bindingID = BindingID.parse(endpointClass);
                MTOMFeature bindingMtomSetting = bindingID.createBuiltinFeatureList().get(MTOMFeature.class);
                if (bindingMtomSetting != null && bindingMtomSetting.isEnabled() ^ ftr.isEnabled()) {
                    throw new RuntimeModelerException(
                        ModelerMessages.RUNTIME_MODELER_MTOM_CONFLICT(bindingID, ftr.isEnabled()));
                }
            }
            add(ftr);
        }
    }
}
 
Example 2
Source File: WebServiceFeatureList.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 * @param endpointClass web service impl class
 */
public void parseAnnotations(Class<?> endpointClass) {
    for (Annotation a : endpointClass.getAnnotations()) {
        WebServiceFeature ftr = getFeature(a);
        if (ftr != null) {
            if (ftr instanceof MTOMFeature) {
                // check conflict with @BindingType
                BindingID bindingID = BindingID.parse(endpointClass);
                MTOMFeature bindingMtomSetting = bindingID.createBuiltinFeatureList().get(MTOMFeature.class);
                if (bindingMtomSetting != null && bindingMtomSetting.isEnabled() ^ ftr.isEnabled()) {
                    throw new RuntimeModelerException(
                        ModelerMessages.RUNTIME_MODELER_MTOM_CONFLICT(bindingID, ftr.isEnabled()));
                }
            }
            add(ftr);
        }
    }
}
 
Example 3
Source File: WebServiceFeatureList.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 * @param endpointClass web service impl class
 */
public void parseAnnotations(Class<?> endpointClass) {
    for (Annotation a : endpointClass.getAnnotations()) {
        WebServiceFeature ftr = getFeature(a);
        if (ftr != null) {
            if (ftr instanceof MTOMFeature) {
                // check conflict with @BindingType
                BindingID bindingID = BindingID.parse(endpointClass);
                MTOMFeature bindingMtomSetting = bindingID.createBuiltinFeatureList().get(MTOMFeature.class);
                if (bindingMtomSetting != null && bindingMtomSetting.isEnabled() ^ ftr.isEnabled()) {
                    throw new RuntimeModelerException(
                        ModelerMessages.RUNTIME_MODELER_MTOM_CONFLICT(bindingID, ftr.isEnabled()));
                }
            }
            add(ftr);
        }
    }
}
 
Example 4
Source File: JaxWsEndpointImpl.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void checkRespectBindingFeature(List<ExtensibilityElement> bindingExtensors) {
    if (bindingExtensors != null) {
        Iterator<ExtensibilityElement> extensionElements = bindingExtensors.iterator();
        while (extensionElements.hasNext()) {
            ExtensibilityElement ext = extensionElements.next();
            if (ext instanceof UnknownExtensibilityElement && Boolean.TRUE.equals(ext.getRequired())
                && this.wsFeatures != null) {
                for (WebServiceFeature feature : this.wsFeatures) {
                    if (feature instanceof RespectBindingFeature && feature.isEnabled()) {

                        org.apache.cxf.common.i18n.Message message =
                            new org.apache.cxf.common.i18n.Message("UNKONWN_REQUIRED_WSDL_BINDING", LOG);
                        LOG.severe(message.toString());
                        throw new WebServiceException(message.toString());
                    }
                }
            }
        }
    }

}
 
Example 5
Source File: WebServiceFeatureList.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 * @param endpointClass web service impl class
 */
public void parseAnnotations(Class<?> endpointClass) {
    for (Annotation a : endpointClass.getAnnotations()) {
        WebServiceFeature ftr = getFeature(a);
        if (ftr != null) {
            if (ftr instanceof MTOMFeature) {
                // check conflict with @BindingType
                BindingID bindingID = BindingID.parse(endpointClass);
                MTOMFeature bindingMtomSetting = bindingID.createBuiltinFeatureList().get(MTOMFeature.class);
                if (bindingMtomSetting != null && bindingMtomSetting.isEnabled() ^ ftr.isEnabled()) {
                    throw new RuntimeModelerException(
                        ModelerMessages.RUNTIME_MODELER_MTOM_CONFLICT(bindingID, ftr.isEnabled()));
                }
            }
            add(ftr);
        }
    }
}
 
Example 6
Source File: WebServiceFeatureList.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Merges the extra features that are not already set on binding.
 * i.e, if a feature is set already on binding through some other API
 * the corresponding wsdlFeature is not set.
 *
 * @param features          Web Service features that need to be merged with already configured features.
 * @param reportConflicts   If true, checks if the feature setting in WSDL (wsdl extension or
 *                          policy configuration) conflicts with feature setting in Deployed Service and
 *                          logs warning if there are any conflicts.
 */
public void mergeFeatures(@NotNull Iterable<WebServiceFeature> features, boolean reportConflicts) {
    for (WebServiceFeature wsdlFtr : features) {
        if (get(wsdlFtr.getClass()) == null) {
            add(wsdlFtr);
        } else if (reportConflicts) {
            if (isEnabled(wsdlFtr.getClass()) != wsdlFtr.isEnabled()) {
                LOGGER.warning(ModelerMessages.RUNTIME_MODELER_FEATURE_CONFLICT(
                                   get(wsdlFtr.getClass()), wsdlFtr));
            }
        }
    }
}
 
Example 7
Source File: WebServiceFeatureList.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Merges the extra features that are not already set on binding.
 * i.e, if a feature is set already on binding through some other API
 * the corresponding wsdlFeature is not set.
 *
 * @param features          Web Service features that need to be merged with already configured features.
 * @param reportConflicts   If true, checks if the feature setting in WSDL (wsdl extension or
 *                          policy configuration) conflicts with feature setting in Deployed Service and
 *                          logs warning if there are any conflicts.
 */
public void mergeFeatures(@NotNull Iterable<WebServiceFeature> features, boolean reportConflicts) {
    for (WebServiceFeature wsdlFtr : features) {
        if (get(wsdlFtr.getClass()) == null) {
            add(wsdlFtr);
        } else if (reportConflicts) {
            if (isEnabled(wsdlFtr.getClass()) != wsdlFtr.isEnabled()) {
                LOGGER.warning(ModelerMessages.RUNTIME_MODELER_FEATURE_CONFLICT(
                                   get(wsdlFtr.getClass()), wsdlFtr));
            }
        }
    }
}
 
Example 8
Source File: WebServiceFeatureList.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Merges the extra features that are not already set on binding.
 * i.e, if a feature is set already on binding through some other API
 * the corresponding wsdlFeature is not set.
 *
 * @param features          Web Service features that need to be merged with already configured features.
 * @param reportConflicts   If true, checks if the feature setting in WSDL (wsdl extension or
 *                          policy configuration) conflicts with feature setting in Deployed Service and
 *                          logs warning if there are any conflicts.
 */
public void mergeFeatures(@NotNull Iterable<WebServiceFeature> features, boolean reportConflicts) {
    for (WebServiceFeature wsdlFtr : features) {
        if (get(wsdlFtr.getClass()) == null) {
            add(wsdlFtr);
        } else if (reportConflicts) {
            if (isEnabled(wsdlFtr.getClass()) != wsdlFtr.isEnabled()) {
                LOGGER.warning(ModelerMessages.RUNTIME_MODELER_FEATURE_CONFLICT(
                                   get(wsdlFtr.getClass()), wsdlFtr));
            }
        }
    }
}
 
Example 9
Source File: WebServiceFeatureList.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void mergeFeatures(WebServiceFeature[] features, boolean reportConflicts) {
    for (WebServiceFeature wsdlFtr : features) {
        if (get(wsdlFtr.getClass()) == null) {
            add(wsdlFtr);
        } else if (reportConflicts) {
            if (isEnabled(wsdlFtr.getClass()) != wsdlFtr.isEnabled()) {
                LOGGER.warning(ModelerMessages.RUNTIME_MODELER_FEATURE_CONFLICT(
                                   get(wsdlFtr.getClass()), wsdlFtr));
            }
        }
    }
}
 
Example 10
Source File: WebServiceFeatureList.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void mergeFeatures(WebServiceFeature[] features, boolean reportConflicts) {
    for (WebServiceFeature wsdlFtr : features) {
        if (get(wsdlFtr.getClass()) == null) {
            add(wsdlFtr);
        } else if (reportConflicts) {
            if (isEnabled(wsdlFtr.getClass()) != wsdlFtr.isEnabled()) {
                LOGGER.warning(ModelerMessages.RUNTIME_MODELER_FEATURE_CONFLICT(
                                   get(wsdlFtr.getClass()), wsdlFtr));
            }
        }
    }
}
 
Example 11
Source File: WebServiceFeatureList.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void mergeFeatures(WebServiceFeature[] features, boolean reportConflicts) {
    for (WebServiceFeature wsdlFtr : features) {
        if (get(wsdlFtr.getClass()) == null) {
            add(wsdlFtr);
        } else if (reportConflicts) {
            if (isEnabled(wsdlFtr.getClass()) != wsdlFtr.isEnabled()) {
                LOGGER.warning(ModelerMessages.RUNTIME_MODELER_FEATURE_CONFLICT(
                                   get(wsdlFtr.getClass()), wsdlFtr));
            }
        }
    }
}
 
Example 12
Source File: WebServiceFeatureList.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Merges the extra features that are not already set on binding.
 * i.e, if a feature is set already on binding through some other API
 * the corresponding wsdlFeature is not set.
 *
 * @param features          Web Service features that need to be merged with already configured features.
 * @param reportConflicts   If true, checks if the feature setting in WSDL (wsdl extension or
 *                          policy configuration) conflicts with feature setting in Deployed Service and
 *                          logs warning if there are any conflicts.
 */
public void mergeFeatures(@NotNull Iterable<WebServiceFeature> features, boolean reportConflicts) {
    for (WebServiceFeature wsdlFtr : features) {
        if (get(wsdlFtr.getClass()) == null) {
            add(wsdlFtr);
        } else if (reportConflicts) {
            if (isEnabled(wsdlFtr.getClass()) != wsdlFtr.isEnabled()) {
                LOGGER.warning(ModelerMessages.RUNTIME_MODELER_FEATURE_CONFLICT(
                                   get(wsdlFtr.getClass()), wsdlFtr));
            }
        }
    }
}
 
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: WebServiceFeatureList.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
static public boolean isFeatureEnabled(Class<? extends WebServiceFeature> type, WebServiceFeature[] features) {
    WebServiceFeature ftr = getFeature(features, type);
    return ftr != null && ftr.isEnabled();
}
 
Example 15
Source File: FeatureListUtil.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public static boolean isFeatureEnabled(@NotNull Class<? extends WebServiceFeature> featureType,
        @Nullable WebServiceFeatureList list1, @Nullable WebServiceFeatureList list2)
        throws WebServiceException {
    final WebServiceFeature mergedFeature = mergeFeature(featureType, list1, list2);
    return (mergedFeature != null) && mergedFeature.isEnabled();
}
 
Example 16
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 17
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 18
Source File: WebServiceFeatureList.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
static public boolean isFeatureEnabled(Class<? extends WebServiceFeature> type, WebServiceFeature[] features) {
    WebServiceFeature ftr = getFeature(features, type);
    return ftr != null && ftr.isEnabled();
}
 
Example 19
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 20
Source File: WebServiceFeatureList.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public boolean isEnabled(@NotNull Class<? extends WebServiceFeature> feature) {
    WebServiceFeature ftr = get(feature);
    return ftr != null && ftr.isEnabled();
}