Results 1 to 2 of 2

Thread: Outbound Http Gateway: How to set Header Content-Type

  1. #1

    Default 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));
    }
    }
    }

  2. #2

    Default

    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
  •