Skip to content

@RequestMapping get 406 Not Acceptable when I use MediaType.IMAGE_PNG_VALUE [SPR-17205] #21738

Closed
@spring-projects-issues

Description

@spring-projects-issues

Eduardo Cintra opened SPR-17205 and commented

I have a method in my controller that return a image, but exists some rules that can throws a exception, when this occurs I'm get a 406 error "406 Not Acceptable" instead of the Exception.

My method:

@RequestMapping(value = "/test", method = RequestMethod.GET, produces = MediaType.IMAGE_PNG_VALUE) @RequestMapping(value = "/test", method = RequestMethod.GET, produces = MediaType.IMAGE_PNG_VALUE)

public @ResponseBody byte[] test() {

throw new RuntimeException()

//code that return byte[] image
}

Can anyone help me?


Attachments:

Issue Links:

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions