String messageContentType = outMessage.get(Message.CONTENT_TYPE).toString();
int index = messageContentType.indexOf(";type");
if (index > 0) {
messageContentType = messageContentType.substring(0, index).trim();
}
AttachmentOutputInterceptor attInterceptor =
new AttachmentOutputInterceptor(messageContentType, rootHeaders);
outMessage.put(Message.CONTENT_TYPE, rootContentType);
Map<String, List<String>> allHeaders =
CastUtils.cast((Map<?, ?>)outMessage.get(Message.PROTOCOL_HEADERS));
if (allHeaders != null) {
allHeaders.remove(Message.CONTENT_TYPE);
}
attInterceptor.handleMessage(outMessage);
}