}
Map customHeaders = msg.getOutboundProperty(HttpConnector.HTTP_CUSTOM_HEADERS_MAP_PROPERTY);
if (customHeaders != null)
{
throw new TransformerException(HttpMessages.customHeaderMapDeprecated(), this);
}
//attach the outbound properties to the message
for (String headerName : msg.getOutboundPropertyNames())
{
Object v = msg.getOutboundProperty(headerName);
if (v != null)
{
response.setHeader(new Header(headerName, v.toString()));
}
}
// Mule properties
String user = msg.getOutboundProperty(MuleProperties.MULE_USER_PROPERTY);
if (user != null)
{
response.setHeader(new Header(CUSTOM_HEADER_PREFIX + MuleProperties.MULE_USER_PROPERTY, user));
}
if (msg.getCorrelationId() != null)
{
response.setHeader(new Header(CUSTOM_HEADER_PREFIX + MuleProperties.MULE_CORRELATION_ID_PROPERTY,
msg.getCorrelationId()));
response.setHeader(new Header(CUSTOM_HEADER_PREFIX
+ MuleProperties.MULE_CORRELATION_GROUP_SIZE_PROPERTY,
String.valueOf(msg.getCorrelationGroupSize())));
response.setHeader(new Header(CUSTOM_HEADER_PREFIX
+ MuleProperties.MULE_CORRELATION_SEQUENCE_PROPERTY,
String.valueOf(msg.getCorrelationSequence())));
}
if (msg.getReplyTo() != null)
{
response.setHeader(new Header(CUSTOM_HEADER_PREFIX + MuleProperties.MULE_REPLY_TO_PROPERTY,
msg.getReplyTo().toString()));
}
try
{
response.setBody(msg);
}
catch (Exception e)
{
throw new TransformerException(this, e);
}
return response;
}