/*
* (non-Javadoc)
* @see org.apache.axis2.jaxws.feature.WebServiceFeatureConfigurator#configure(org.apache.axis2.jaxws.description.EndpointDescription)
*/
public void configure(EndpointDescription endpointDescription) {
MTOM mtomAnnoation =
(MTOM) ((EndpointDescriptionJava) endpointDescription).getAnnoFeature(MTOMFeature.ID);
AxisService service = endpointDescription.getAxisService();
//Disable MTOM
Parameter enableMTOM = new Parameter(Constants.Configuration.ENABLE_MTOM, Boolean.FALSE);
Parameter threshold = new Parameter(Constants.Configuration.MTOM_THRESHOLD, 0);
if (mtomAnnoation == null) {
throw ExceptionFactory.
makeWebServiceException(Messages.getMessage("mtomAnnotationErr"));
}
//Enable MTOM.
if (mtomAnnoation.enabled()) {
if (log.isDebugEnabled()) {
log.debug("Enabling MTOM via annotation.");
}
enableMTOM.setValue(Boolean.TRUE);
}
//Set the threshold value.
if (mtomAnnoation.threshold() > 0) {
if (log.isDebugEnabled()) {
log.debug("Setting MTOM threshold to [" + mtomAnnoation.threshold() + "].");
}
threshold.setValue(mtomAnnoation.threshold());
}
try {
service.addParameter(enableMTOM);
service.addParameter(threshold);