Skip to content

AbstractMessageConverterMethodProcessor returns allSupportedMediaTypes with HttpMediaTypeNotAcceptableException [SPR-10175] #14808

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

Closed
spring-projects-issues opened this issue Jan 15, 2013 · 1 comment
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: backported An issue that has been backported to maintenance branches type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

Michael Osipov opened SPR-10175 and commented

When a Controller is able respond with a limited set of media types and the client requests a not supported media type the server respponds with a HttpMediaTypeNotAcceptableException with all supported media types.

An example request mapping:

@RequestMapping(value = "/{project:[A-Z0-9_+\\.\\(\\)=\\- ]+}", method = RequestMethod.GET)
  public ResponseEntity<Object> lookupProject(@PathVariable String project,
    @RequestParam(value = "attributes", required = false) String[] attributes,
    @RequestParam(value = "outputType", required = false, defaultValue = "hash") OutputType outputType)

Controller mapping

@Controller
@RequestMapping("/rest/db-search")
public class DbSearchController

Now, let's say a client issues this GET request:

GET /context/rest/db-search/1314136 HTTP/1.1
Host: <host>:8080
User-Agent: ...
Accept: text/csv
Accept-Encoding: gzip, deflate

The aforementioned exception is thrown. It should contain the producible media types instead of all supported ones.

See attached screenshots for runtime inspection.


Affects: 3.1.3, 3.2 GA

Attachments:

Backported to: 3.1.4

@spring-projects-issues
Copy link
Collaborator Author

Michael Osipov commented

Care to fix this for 3.1.4 too?

@spring-projects-issues spring-projects-issues added type: bug A general bug status: backported An issue that has been backported to maintenance branches in: web Issues in web modules (web, webmvc, webflux, websocket) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 3.2.1 milestone Jan 11, 2019
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) status: backported An issue that has been backported to maintenance branches type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants