@Override
protected void configureMessageProcessorsAfterTransformation(final MessageProcessorChainBuilder builder)
throws MuleException
{
// ensure properties, hence HTTP headers, are propagated both ways
final TransformerTemplate copyInboundToOutboundPropertiesTransformer = new TransformerTemplate(
new CopyInboundToOutboundPropertiesTransformerCallback());
builder.chain(copyInboundToOutboundPropertiesTransformer);
builder.chain(new ResponseMessageProcessorAdapter(copyInboundToOutboundPropertiesTransformer));
if (cachingMessageProcessor != null)
{
builder.chain(cachingMessageProcessor);
}
if (outboundEndpoint instanceof DynamicURIOutboundEndpoint)
{
// do not mess with endpoints that are already dynamic
builder.chain(outboundEndpoint);
}
else
{
// create a templated outbound endpoint to propagate extra path elements (including query parameters)
builder.chain(new TransformerTemplate(new TransformerCallback()
{
public Object doTransform(final MuleMessage message) throws Exception
{
final String pathExtension = StringUtils.substringAfter(
(String) message.getInboundProperty("http.request"),