INT-3002 Fix Content-Type Mapping

https://jira.springsource.org/browse/INT-3002

The AMQP outbound endpoint behaves differently when configured
as a gateway compared to when it is configured an adapter.

With the adapter, the header mapper is invoked after the message
converter (via the MPP callback).

With the gateway, the mapper is invoked before the converter.

The SimpleMessageConverter unconditionally sets the content-type,
overriding any mapped content type.

Change the code to invoke the header mapper after the converter
to match the adapter logic.

Remove the TODO. The method now exists, but Using a MPP in the
gateway case does not provide access to headers on the reply.

Add test cases.
This commit is contained in:
Gary Russell
2013-05-02 12:18:27 -04:00
committed by Mark Fisher
parent 23856828a7
commit 81bfaeb8a9
3 changed files with 130 additions and 2 deletions

View File

@@ -144,6 +144,24 @@
before sending the request. For more information see <xref linkend="http"/>.
</para>
</section>
<section id="3.0-amqp-mapping">
<title>AMQP Outbound Gateway Header Mapping</title>
<para>
Previously, the &lt;int-amqp:outbound-gateway/&gt; mapped headers before invoking the message
converter, and the converter could overwrite headers such as <code>content-type</code>. The
outbound adapter maps the headers after the conversion, which means headers like
<code>content-type</code> from the outbound <code>Message</code> (if present) are used.
</para>
<para>
Starting with this release, the gateway now maps the headers after the message conversion,
consistent with the adapter. If your application relies on the previous behavior (where the
converter's headers overrode the mapped headers), you either need to filter those headers
(before the message reaches the gateway)
or set them appropriately. The headers affected by the <classname>SimpleMessageConverter</classname>
are <code>content-type</code> and <code>content-encoding</code>. Custom message converters
may set other headers.
</para>
</section>
</section>
</chapter>