INT-2837 Fix Accept Hdr for Serializable Response #685

Closed
wants to merge 3 commits into
from

Conversation

Projects
None yet
4 participants
@garyrussell
Member

garyrussell commented Nov 28, 2012

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 overriden method.

@garyrussell

This comment has been minimized.

Show comment Hide comment
@garyrussell

garyrussell Nov 30, 2012

Member

After further discussion with @markfisher , we decided to remove the default enabling of Java serialization over HTTP because adding the Accept header may cause Serialization to trump JSON in certain cases; this could inadvertently cause Java serialization to be used instead of JSON.

Pushed - see the commit comments and what's new for more information.

Member

garyrussell commented Nov 30, 2012

After further discussion with @markfisher , we decided to remove the default enabling of Java serialization over HTTP because adding the Accept header may cause Serialization to trump JSON in certain cases; this could inadvertently cause Java serialization to be used instead of JSON.

Pushed - see the commit comments and what's new for more information.

@artembilan

View changes

...gframework/integration/http/config/OutboundResponseTypeTests-context.xml
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
- http://www.springframework.org/schema/integration/http http://www.springframework.org/schema/integration/http/spring-integration-http.xsd">
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd">

This comment has been minimized.

Show comment Hide comment
@artembilan

artembilan Nov 30, 2012

Member

Hi, Gary!
Hardcoded version: may cause issue with Spring 3.0 (or the even 3.2) build

@artembilan

artembilan Nov 30, 2012

Member

Hi, Gary!
Hardcoded version: may cause issue with Spring 3.0 (or the even 3.2) build

garyrussell added some commits Nov 28, 2012

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 overriden 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.
@garyrussell

This comment has been minimized.

Show comment Hide comment
@garyrussell

garyrussell Nov 30, 2012

Member

Good catch - one of these days I'll figure how to make STS select the unversioned schema by default.

Rebased and pushed.

Member

garyrussell commented Nov 30, 2012

Good catch - one of these days I'll figure how to make STS select the unversioned schema by default.

Rebased and pushed.

+ 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>

This comment has been minimized.

Show comment Hide comment
@ghillert

ghillert Nov 30, 2012

Member

We should document the change also in the HTTP Chapter.

@ghillert

ghillert Nov 30, 2012

Member

We should document the change also in the HTTP Chapter.

@markfisher

This comment has been minimized.

Show comment Hide comment
@markfisher

markfisher Nov 30, 2012

Member

LGTM; merged (Gunnar will be adding a note to the HTTP ref doc chapter)

Member

markfisher commented Nov 30, 2012

LGTM; merged (Gunnar will be adding a note to the HTTP ref doc chapter)

@markfisher markfisher closed this Nov 30, 2012

markfisher added a commit to markfisher/spring-integration that referenced this pull request Nov 30, 2012

Merge pull request #685 from garyrussell/INT-2837a
* INT-2837a:
  INT-2837 Fix Accept Hdr for Serializable Response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment