Skip to content

@ResponseStatus does not work with @ExceptionHandler [SPR-6961] #11626

Closed

Description

@spring-projects-issues

Florent Ramiere opened SPR-6961 and commented

When this method is executed

@ExceptionHandler(RuntimeException.class)
@ResponseStatus(value = HttpStatus.NOT_FOUND)
public void toto(OutputStream output) throws IOException {
  ...
}

The specified response status is not sent to the client.

Linked to #11567


Affects: 3.0.1

Issue Links:

Activity

  1. spring-projects-issues commented on Mar 9, 2010

    @spring-projects-issues
    CollaboratorAuthor

    Arjen Poutsma commented

    In my tests, @ReponseStatus does work on @ExceptionHandler methods.

  2. spring-projects-issues commented on Mar 9, 2010

    @spring-projects-issues
    CollaboratorAuthor

    Florent Ramiere commented

    You are correct, I found the reason why the response status was not returned: I closed the OutputStream in my method.

  3. added
    type: bug
    in: web
    on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: web

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions