INT-2837 Fix Accept Hdr for Serializable Response

When the expected-response-type was Serializable,
no Accept: header was added.

The SerializingHttpMessageConverter overrides
canRead() from the superclass.

The superclass method allows null in the mediaType
parameter to return true. RestTemplate.AcceptHeaderRequestCallback
calls canRead() with null in the mediaType, preventing
the Accept header from being completed.

Remove the overridden method.

INT-2837 Disable Java Serialization over Http

Previously, Java serialization was enabled by default by
adding the SerializingHttpMessageConverter to the converter
lists (inbound and outbound endpoints). However, there was
a problem in that the Accept header was not set properly on
outbound requests.

Correcting the header could cause other side effects, such as
existing JSON applications using Java serialization instead.

It was felt that it would be safest to disable Java serialization
by default, while retaining the ability to use Java serialization
by explicitly configuring the message converter.

Update tests to deal with the fact the converter is not
configured by default.

INT-2837 Fix Schema Version in Test

Inadvertently added a spring 3.1 schema version.
This commit is contained in:
Gary Russell
2012-11-28 17:09:27 -05:00
committed by Mark Fisher
parent 4ce08ad6dc
commit 7ef66e2e3f
10 changed files with 179 additions and 19 deletions

View File

@@ -190,6 +190,28 @@
by default. For more information see <xref linkend="transformer"/>.
</para>
</section>
<section id="httpChanges">
<title>Http Support</title>
<para>
Java serialization over http is no longer enabled by default. Previously, when
setting a <code>expected-response-type</code> to a <code>Serializable</code>
object, the <code>Accept</code> header was not properly set up. The
<classname>SerializingHttpMessageConverter</classname> has now been updated
to set the Accept header to <code>application/x-java-serialized-object</code>.
However, because this could cause incompatibility with existing applications,
it was decided to no longer automatically add this converter to the http endpoints.
</para>
<para>
If you wish to use Java serialization, you will need to add the
<classname>SerializingHttpMessageConverter</classname> to the appropriate
endpoints, using the <code>message-converters</code> attribute, when using
XML configuration, or using the <code>setMessageConverters()</code> method.
</para>
<para>
Alternatively, you may wish to consider using JSON instead which is enabled
by simply having <code>Jackson</code> on the classpath.
</para>
</section>
</section>
<section id="2.2-new-components">