Skip to content

Update WebMvcConfigurationSupport.java - #70

Closed
allnightlong wants to merge 1 commit into
spring-projects:masterfrom
allnightlong:patch-1
Closed

allnightlong wants to merge 1 commit into
spring-projects:masterfrom
allnightlong:patch-1

Conversation

@allnightlong

Copy link
Copy Markdown

We should place rss & atom converters before jackson converter, because currently com.sun.syndication.feed.rss.Channel and com.sun.syndication.feed.atom.Feed and converted to json by default which isn't quite right and intuitive.

…nfig/annotation/WebMvcConfigurationSupport.java
@cbeams

cbeams commented Apr 20, 2012

Copy link
Copy Markdown
Contributor

Thanks for the submission. Please read and follow the instructions in the contributor guidelines and we'll take a look at this.

@rstoyanchev

Copy link
Copy Markdown
Contributor

Could you provide a little more detail? Actually open a JIRA ticket and elaborate on your scenario. The Atom and RSS converters support requests for Accept type of application/atom+xml and application/rss+xml respectively. As long as the Accept header is set appropriately there shouldn't be any ambiguity.

Things can get more complicated if the Accept header includes a number of media types including */*, which is why it would help to elaborate. If an Accept header is not present or it comes down to */* then I don't see why returning JSON based on the order of declaration is not intuitive. Also consider that in Spring 3.1 we added a produces condition to @RequestMapping which allows you to control the content type that should be used. Another option worth knowing about is you can easily change the order in which converters are declared by implementing this method in your @Configuration class that extends WebMvcConfigurerAdapter or WebMvcConfigurationSupport:

public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {

}

@rstoyanchev

Copy link
Copy Markdown
Contributor

OK I see the ticket now https://jira.springsource.org/browse/SPR-9336 and I've added my comments there.

@allnightlong

Copy link
Copy Markdown
Author

Here is jira ticket https://jira.springsource.org/browse/SPR-9336

My main point is: when I'm returning com.sun.syndication.feed.rss.Channel from controller method, it should convert to rss view by default. It may also convert to json, but only if I set corresponding accept-type. Currently in coverter list MappingJacksonHttpMessageConverter stands before RssChannelHttpMessageConverter, so by default com.sun.syndication.feed.rss.Channel converting to json rether rss.

@ghost ghost assigned rstoyanchev May 1, 2012
@cbeams cbeams closed this May 1, 2012
@cbeams

cbeams commented May 1, 2012

Copy link
Copy Markdown
Contributor

Closing this pull request as the submitter indicated he won't be signing the SpringSource CLA this time around and making the other necessary modifications as specified in the contributor guidelines. @rstoyanchev will take the implementation from here in the linked JIRA issue (which is scheduled for 3.2 M1). In any case, thanks @allnightlong for bringing this to our attention!

rwinch pushed a commit to rwinch/spring-framework that referenced this pull request Jun 20, 2016
Some important issues have been fixed in recent SNAPSHOT versions.

See spring-projects#78 and spring-projects#70
rwinch pushed a commit to rwinch/spring-framework that referenced this pull request Jul 13, 2016
Some important issues have been fixed in recent SNAPSHOT versions.

See spring-projects#78 and spring-projects#70
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants