org.springframework.web.bind.annotation
Annotation Type ResponseStatus


@Target(value={TYPE,METHOD})
@Retention(value=RUNTIME)
@Documented
public @interface ResponseStatus

Marks a method or exception class with the status code and reason that should be returned. The status code is applied to the HTTP response when the handler method is invoked, or whenever said exception is thrown.

Since:
3.0
Author:
Arjen Poutsma
See Also:
ResponseStatusExceptionResolver

Required Element Summary
 HttpStatus value
          The status code to use for the response.
 
Optional Element Summary
 String reason
          The reason to be used for the response.
 

Element Detail

value

public abstract HttpStatus value
The status code to use for the response.

See Also:
HttpServletResponse.setStatus(int)

reason

public abstract String reason
The reason to be used for the response.

If this element is not set, it will default to the standard status message for the status code.

See Also:
HttpServletResponse.sendError(int, String)
Default:
""