if (logger.isDebugEnabled())
{
logger.debug("Modified endpoint with " + scheme + " scheme to " + endpoint);
}
EndpointBuilder serviceEndpointbuilder = new EndpointURIEndpointBuilder(endpoint, muleContext);
serviceEndpointbuilder.setExchangePattern(receiver.getEndpoint().getExchangePattern());
serviceEndpointbuilder.setName(ep.getScheme() + ":" + serviceName);
// Set the transformers on the endpoint too
serviceEndpointbuilder.setTransformers(receiver.getEndpoint().getTransformers().isEmpty() ? null
: receiver.getEndpoint().getTransformers());
serviceEndpointbuilder.setResponseTransformers(receiver.getEndpoint().getResponseTransformers().isEmpty() ? null
: receiver.getEndpoint().getResponseTransformers());
// set the filter on the axis endpoint on the real receiver endpoint
serviceEndpointbuilder.addMessageProcessor(new MessageFilter(receiver.getEndpoint().getFilter()));
// set the Security filter on the axis endpoint on the real receiver
// endpoint
SecurityFilter securityFilter = receiver.getEndpoint().getSecurityFilter();
if (securityFilter != null)
{
serviceEndpointbuilder.addMessageProcessor(new SecurityFilterMessageProcessor(securityFilter));
}
// TODO Do we really need to modify the existing receiver endpoint? What happens if we don't security,
// filters and transformers will get invoked twice?
AbstractEndpointBuilder receiverEndpointBuilder = new EndpointURIEndpointBuilder(receiver.getEndpoint());
// Remove the Axis filter now
List<MessageProcessor> procs = new ArrayList(receiverEndpointBuilder.getMessageProcessors());
CollectionUtils.removeType(procs, MessageFilter.class);
CollectionUtils.removeType(procs, SecurityFilterMessageProcessor.class);
receiverEndpointBuilder.setMessageProcessors(procs);
InboundEndpoint serviceEndpoint = muleContext.getRegistry()
.lookupEndpointFactory()
.getInboundEndpoint(serviceEndpointbuilder);