SpringSource/spring-integration — pull request #684 by garyrussell (2012-11-28 17:36:26+00:00)
Title: INT-2837 Set Accept Hdr for Serializable Responses

The RestTemplate does not set the Accept header properly when
the expected-response-type is Serializable (unless it is String).

It passes null in as the mediaType to the
SerialingHttpMessageConverter.canRead() method, which causes it
to return false, and so the application/x-java-serialized-object
MediaType is not set in the Accept Header.

String response types are handled properly, even though they
are Serializable - the StringHttpMessageConverter returns
true to canRead() when a null MediaType is passed in.

So, for Serializable expectedResponseTypes, sets the Accept header
to application/x-java-serialized-object, UNLESS the Accept header
was already mapped from the SI message, OR the expectedResponseType
is java.lang.String.

An escape hatch is provided, to revert to the previous behavior
by setting serializableResponseMediaTypes to null.

**We should explore getting a fix for RestTemplate so it sets the header properly**