Closed
Description
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:
- all supported media types.png (158.23 kB)
- producible media types.png (151.89 kB)
- requested media types.png (150.90 kB)
Backported to: 3.1.4