Skip to content

Improve defaulting of media types via ContentNegotiationManager [SPR-10513] #15144

@spring-projects-issues

Description

@spring-projects-issues

Oliver Drotbohm opened SPR-10513 and commented

The mechanism in place to configure a default media type is currently applied to default the requested media types. So it is essentially only kicking in if the client either sends no Accept header at all or an empty header. Unfortunately most clients send \*/\* to indicate they don't have a preference.

This causes FixedContentNegotiationStrategy to never get called, as Accept:\*/\* essentially causes the HeaderContentNegotiationStrategy to return a value and that skips the remaining strategies.

\*/\* in turn indicates all HttpMessageConverters being tried which might cause one being picked that doesn't reflect the requested default (e.g. imagine a class annotated with @XmlRootElement and the defaulting configured to JSON. It would still be rendered as XML as the JAXB-based converter comes before the Jackson one).


Affects: 3.2.2

Issue Links:

1 votes, 2 watchers

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions