Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AnnotationMethodHandlerAdapter should take into account request accept header ordering [SPR-6934] #11599

Closed
spring-projects-issues opened this issue Mar 3, 2010 · 1 comment
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

Mike Youngstrom opened SPR-6934 and commented

I have a controller like so:

public class ExampleController {
	@RequestMapping(value="/secure/example", headers="accept=text/html",method=RequestMethod.GET)
	public String list(@ModelAttribute ExampleModel example, Model model) {
            ...
	}

	@RequestMapping(value="/secure/example", headers={"accept=application/xml"}, method=RequestMethod.GET)
	public List<ExampleModel> listXml() {
            ...
	}
}

If I submit a request with accept=application/xml,text/html

I would expect that my listXml() method would be resolved before list(). However, because list() is declared first in the class it ends up being the one chosen by AnnotationMethodHandlerAdapter.

It appears that RequestMappingInfoComparator doesn't take into account the order of the accept media types on the request. I believe it should.


Affects: 3.0.1

Referenced from: commits 4f4f3fa

@spring-projects-issues
Copy link
Collaborator Author

Arjen Poutsma commented

Added formatting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants