当前位置: 首页>>代码示例>>Java>>正文


Java MTOMFeature.isEnabled方法代码示例

本文整理汇总了Java中javax.xml.ws.soap.MTOMFeature.isEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java MTOMFeature.isEnabled方法的具体用法?Java MTOMFeature.isEnabled怎么用?Java MTOMFeature.isEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.xml.ws.soap.MTOMFeature的用法示例。


在下文中一共展示了MTOMFeature.isEnabled方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shouldUseMtomOutbound

import javax.xml.ws.soap.MTOMFeature; //导入方法依赖的package包/类
private boolean shouldUseMtomOutbound() {
    //Use the getter to make sure all the logic is executed correctly
    MTOMFeature myMtomFeature = getMtomFeature();
    if(myMtomFeature != null && myMtomFeature.isEnabled()) {
        //On client, always use XOP encoding if MTOM is enabled
        //On Server, mtomAcceptable and mtomRequest will be set - use XOP encoding
        //if either request is XOP encoded (mtomRequest) or
        //client accepts XOP encoding (mtomAcceptable)
        if (getMtomAcceptable() == null && getMtomRequest() == null) {
            return true;
        } else {
            if (getMtomAcceptable() != null &&  getMtomAcceptable() && getState().equals(State.ServerResponse)) {
                return true;
            }
            if (getMtomRequest() != null && getMtomRequest() && getState().equals(State.ServerResponse)) {
                return true;
            }
            if (getMtomRequest() != null && getMtomRequest() && getState().equals(State.ClientRequest)) {
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:Packet.java

示例2: parseAnnotations

import javax.xml.ws.soap.MTOMFeature; //导入方法依赖的package包/类
/**
 *
 * @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);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:WebServiceFeatureList.java

示例3: update

import javax.xml.ws.soap.MTOMFeature; //导入方法依赖的package包/类
/**
 * Generates an MTOM policy if MTOM is enabled.
 *
 * <ol>
 * <li>If MTOM is enabled
 * <ol>
 * <li>If MTOM policy does not already exist, generate
 * <li>Otherwise do nothing
 * </ol>
 * <li>Otherwise, do nothing (that implies that we do not remove any MTOM policies if MTOM is disabled)
 * </ol>
 *
 */
public Collection<PolicySubject> update(PolicyMap policyMap, SEIModel model, WSBinding wsBinding) throws PolicyException {
    LOGGER.entering(policyMap, model, wsBinding);

    Collection<PolicySubject> subjects = new ArrayList<PolicySubject>();
    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 QName bindingName = model.getBoundPortTypeName();
            final WsdlBindingSubject wsdlSubject = WsdlBindingSubject.createBindingSubject(bindingName);
            final Policy mtomPolicy = createMtomPolicy(bindingName);
            final PolicySubject mtomPolicySubject = new PolicySubject(wsdlSubject, mtomPolicy);
            subjects.add(mtomPolicySubject);
            if (LOGGER.isLoggable(Level.FINEST)) {
                LOGGER.fine("Added MTOM policy with ID \"" + mtomPolicy.getIdOrName() + "\" to binding element \"" + bindingName + "\"");
            }
        }
    } // endif policy map not null

    LOGGER.exiting(subjects);
    return subjects;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:38,代码来源:MtomPolicyMapConfigurator.java

示例4: parseAnnotations

import javax.xml.ws.soap.MTOMFeature; //导入方法依赖的package包/类
/**
 * Reads {@link WebServiceFeatureAnnotation feature annotations} on a class
 * and adds them to the list.
 *
 * @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);
        }
    }
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:24,代码来源:WebServiceFeatureList.java

示例5: shouldUseMtomOutbound

import javax.xml.ws.soap.MTOMFeature; //导入方法依赖的package包/类
private boolean shouldUseMtomOutbound() {
    //Use the getter to make sure all the logic is executed correctly
    MTOMFeature myMtomFeature = getMtomFeature();
    if(myMtomFeature != null && myMtomFeature.isEnabled()) {
            //If the content type is set already on this outbound Packet,
            //(e.g.) through Codec.decode(InputStream, String contentType, Packet)
            //and it is a non-mtom content type, then don't use mtom to encode it
            ContentType curContentType = getInternalContentType();
            if (curContentType != null && !isMtomContentType(curContentType)) {
                    return false;
            }
        //On client, always use XOP encoding if MTOM is enabled
        //On Server, mtomAcceptable and mtomRequest will be set - use XOP encoding
        //if either request is XOP encoded (mtomRequest) or
        //client accepts XOP encoding (mtomAcceptable)
        if (getMtomAcceptable() == null && getMtomRequest() == null) {
            return true;
        } else {
            if (getMtomAcceptable() != null &&  getMtomAcceptable() && getState().equals(State.ServerResponse)) {
                return true;
            }
            if (getMtomRequest() != null && getMtomRequest() && getState().equals(State.ServerResponse)) {
                return true;
            }
            if (getMtomRequest() != null && getMtomRequest() && getState().equals(State.ClientRequest)) {
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:32,代码来源:Packet.java

示例6: checkMtomConflict

import javax.xml.ws.soap.MTOMFeature; //导入方法依赖的package包/类
private static boolean checkMtomConflict(MTOMFeature lhs, MTOMFeature rhs) {
    if (lhs == null || rhs == null) {
        return false;
    }
    return lhs.isEnabled() ^ rhs.isEnabled();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:7,代码来源:DeploymentDescriptorParser.java

示例7: publish

import javax.xml.ws.soap.MTOMFeature; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public synchronized Endpoint publish(ServiceDomain domain, final SOAPBindingModel config, final String bindingId, final InboundHandler handler, WebServiceFeature... features) {
    JBossWSEndpoint wsEndpoint = null;
    try {
        initialize(config);
        Map<String,String> map = new HashMap<String, String>();
        map.put("/" + config.getPort().getServiceName(), SEI);
        Boolean addressingEnabled = false;
        Boolean addressingRequired = false;
        Boolean mtomEnabled = false;
        Integer mtomThreshold = -1;
        for (WebServiceFeature feature : features) {
            if (feature instanceof AddressingFeature) {
                AddressingFeature addrFeature = (AddressingFeature)feature;
                addressingEnabled = addrFeature.isEnabled();
                addressingRequired = addrFeature.isRequired();
                LOGGER.info("Addressing [enabled = " + addrFeature.isEnabled() + ", required = " + addrFeature.isRequired() + "]");
            } else if (feature instanceof MTOMFeature) {
                MTOMFeature mtom = (MTOMFeature)feature;
                mtomEnabled = mtom.isEnabled();
                mtomThreshold = mtom.getThreshold();
                LOGGER.info("MTOM [enabled = " + mtom.isEnabled() + ", threshold = " + mtom.getThreshold() + "]");
            }
        }
        PortComponentMetaData portComponent = new PortComponentMetaData(config.getServiceName()
                                            + ":" + config.getPort().getServiceQName().getLocalPart()
                                            + ":" + config.getPort().getPortQName().getLocalPart(),
                                            config.getPort().getPortQName(),
                                            SEI, null, config.getPort().getServiceQName().getLocalPart(),
                                            null, "/" + config.getPort().getServiceName(),
                                            addressingEnabled, addressingRequired, "ALL", mtomEnabled, mtomThreshold,
                                            false, config.getPort().getServiceQName(), null, null);
        WebserviceDescriptionMetaData wsDescMetaData = new WebserviceDescriptionMetaData(config.getServiceName().getLocalPart(), getWsdlLocation(), null, new PortComponentMetaData[]{portComponent});
        WebservicesMetaData wsMetadata = new WebservicesMetaData(null, new WebserviceDescriptionMetaData[]{wsDescMetaData});

        wsEndpoint = new JBossWSEndpoint();
        if (config.getContextPath() != null) {
            wsEndpoint.publish(domain, getContextRoot(), map, wsMetadata, config, handler);
        } else {
            wsEndpoint.publish(domain, getContextPath(), map, wsMetadata, config, handler);
        }
    } catch (Exception e) {
        throw new WebServicePublishException(e);
    }
    return wsEndpoint;
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:49,代码来源:JBossWSEndpointPublisher.java

示例8: publish

import javax.xml.ws.soap.MTOMFeature; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public synchronized Endpoint publish(ServiceDomain domain, final SOAPBindingModel config, final String bindingId, final InboundHandler handler, WebServiceFeature... features) {
    JBossWSEndpoint wsEndpoint = null;
    try {
        initialize(config);
        Map<String,String> map = new HashMap<String, String>();
        map.put("/" + config.getPort().getServiceName(), SEI);

        Boolean addressingEnabled = false;
        Boolean addressingRequired = false;
        Boolean mtomEnabled = false;
        Integer mtomThreshold = -1;

        for (WebServiceFeature feature : features) {
            if (feature instanceof AddressingFeature) {
                AddressingFeature addrFeature = (AddressingFeature)feature;
                addressingEnabled = addrFeature.isEnabled();
                addressingRequired = addrFeature.isRequired();
                LOGGER.info("Addressing [enabled = " + addressingEnabled + ", required = " + addressingRequired + "]");
            } else if (feature instanceof MTOMFeature) {
                MTOMFeature mtom = (MTOMFeature)feature;
                mtomEnabled = mtom.isEnabled();
                mtomThreshold = mtom.getThreshold();
                LOGGER.info("MTOM [enabled = " + mtomEnabled + ", threshold = " + mtomThreshold + "]");
            }
        }
        PortComponentMetaData portComponent = new PortComponentMetaData(config.getServiceName()
                + ":" + config.getPort().getServiceQName().getLocalPart()
                + ":" + config.getPort().getPortQName().getLocalPart(),
                config.getPort().getPortQName(),
                SEI, null, config.getPort().getServiceQName().getLocalPart(),
                null, "/" + config.getPort().getServiceName(),
                addressingEnabled, addressingRequired, "ALL", mtomEnabled, mtomThreshold,
                false, config.getPort().getServiceQName(), null, null);
        WebserviceDescriptionMetaData wsDescMetaData = new WebserviceDescriptionMetaData(config.getServiceName().getLocalPart(), getWsdlLocation(), null, new PortComponentMetaData[]{portComponent});
        WebservicesMetaData wsMetadata = new WebservicesMetaData(null, new WebserviceDescriptionMetaData[]{wsDescMetaData});

        wsEndpoint = new JBossWSEndpoint();
        if (config.getContextPath() != null) {
            wsEndpoint.publish(domain, getContextRoot(), map, wsMetadata, config, handler);
        } else {
            wsEndpoint.publish(domain, getContextPath(), map, wsMetadata, config, handler);
        }
    } catch (Exception e) {
        throw new WebServicePublishException(e);
    }
    return wsEndpoint;
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:51,代码来源:JBossWSEndpointPublisher.java

示例9: configure

import javax.xml.ws.soap.MTOMFeature; //导入方法依赖的package包/类
public void configure(MessageContext messageContext, BindingProvider provider) {
    Binding bnd = (Binding) provider.getBinding();
    MTOMFeature mtomFeature = (MTOMFeature) bnd.getFeature(MTOMFeature.ID);
    Message requestMsg = messageContext.getMessage();
    
    //Disable MTOM.
    requestMsg.setMTOMEnabled(false);
            
    if (mtomFeature == null) {
        throw ExceptionFactory.
          makeWebServiceException(Messages.getMessage("mtomFeatureErr"));
    }

    //Enable MTOM if specified.
    if (mtomFeature.isEnabled()) {
        int threshold = mtomFeature.getThreshold();
        List<String> attachmentIDs = requestMsg.getAttachmentIDs();
        
        // Enable MTOM
        requestMsg.setMTOMEnabled(true);
        
        if (threshold <= 0) {
            if (log.isDebugEnabled()) {
                log.debug("Enabling MTOM with no threshold.");
            }             
        }else{
            if(log.isDebugEnabled()){
            	log.debug("MTOM Threshold Value ="+threshold);
            }
            
            //set MTOM threshold value on message context.
            //Once MTOM threshold is set on message context it will be
            //read by SOAPMessageFormatter.writeTo() while writing the attachment
            //SOAPMessageFormatter will further propogate the threshold value to
            //Axiom.OMOutputFormat. JAXBAttachmentUnmarshaller will then make 
            //decision if the attachment should be inlined or optimized.  
            messageContext.setProperty(Constants.Configuration.MTOM_THRESHOLD, new Integer(threshold));
        }
    }
    else {
        if (log.isDebugEnabled()) {
            log.debug("The MTOMFeature was found, but not enabled.");
        }
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:46,代码来源:MTOMConfigurator.java

示例10: checkMtomConflict

import javax.xml.ws.soap.MTOMFeature; //导入方法依赖的package包/类
private static boolean checkMtomConflict(MTOMFeature lhs, MTOMFeature rhs) {
    if(lhs==null || rhs==null)  return false;
    return lhs.isEnabled() ^ rhs.isEnabled();
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:5,代码来源:DeploymentDescriptorParser.java


注:本文中的javax.xml.ws.soap.MTOMFeature.isEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。