-
Jan 26th, 2011, 09:41 AM
#1
Outbound Http Gateway: How to set Header Content-Type
Hi,
I implemented a HeaderMapper that subclasses DefaultHttpHeaderMapper. (Impl below). In mine I set the Content-Type to text/html. We have a partner who rejects the default encoding of application/x-www-form-urlencoded and only accepts text/html for the messages we send.
What I am doing with the header mapper isn't working. How do I tell the gateway to set this content-type? Here is my code:
public class HttpHeaderMapper extends DefaultHttpHeaderMapper {
private static final Logger LOGGER =
LoggerFactory.getLogger(HttpHeaderMapper.class);
private Map<String, String> headersToAdd;
public void setHeadersToAdd(Map<String, String> headersToAdd)
{
this.headersToAdd = headersToAdd;
}
public void fromHeaders(MessageHeaders headers, HttpHeaders target)
{
for ( String headerName : this.headersToAdd.keySet() )
{
target.add(headerName, this.headersToAdd.get(headerName));
}
}
}
-
Jan 26th, 2011, 11:39 AM
#2
Found a reference to a bug report where the outbound http gateway was overwriting the header mapper's values. Upgraded to SI 2.0.1.RELEASE and it solved my problem.
Cheers!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules