List of usage examples for javax.xml.ws.soap MTOMFeature getThreshold
public int getThreshold()
From source file:org.apache.axis2.jaxws.client.config.MTOMConfigurator.java
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);//from w ww. ja v a2 s . co m 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."); } } }