public class ResponseStatusException extends NestedRuntimeException
| Constructor and Description | 
|---|
| ResponseStatusException(HttpStatus status)Constructor with a response status. | 
| ResponseStatusException(HttpStatus status,
                       String reason)Constructor with a response status and a reason to add to the exception
 message as explanation. | 
| ResponseStatusException(HttpStatus status,
                       String reason,
                       Throwable cause)Constructor with a response status and a reason to add to the exception
 message as explanation, as well as a nested exception. | 
| ResponseStatusException(int rawStatusCode,
                       String reason,
                       Throwable cause)Constructor with a response status and a reason to add to the exception
 message as explanation, as well as a nested exception. | 
| Modifier and Type | Method and Description | 
|---|---|
| Map<String,String> | getHeaders()Deprecated. 
 as of 5.1.13 in favor of  getResponseHeaders() | 
| String | getMessage()Return the detail message, including the message from the nested exception
 if there is one. | 
| int | getRawStatusCode()Return the HTTP status code (potentially non-standard and not resolvable
 through the  HttpStatusenum) as an integer. | 
| String | getReason()The reason explaining the exception (potentially  nullor empty). | 
| HttpHeaders | getResponseHeaders()Return headers associated with the exception that should be added to the
 error response, e.g. | 
| HttpStatus | getStatus()Return the HTTP status associated with this exception. | 
contains, getMostSpecificCause, getRootCauseaddSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringpublic ResponseStatusException(HttpStatus status)
status - the HTTP status (required)public ResponseStatusException(HttpStatus status, @Nullable String reason)
status - the HTTP status (required)reason - the associated reason (optional)public ResponseStatusException(HttpStatus status, @Nullable String reason, @Nullable Throwable cause)
status - the HTTP status (required)reason - the associated reason (optional)cause - a nested exception (optional)public ResponseStatusException(int rawStatusCode,
                               @Nullable
                               String reason,
                               @Nullable
                               Throwable cause)
rawStatusCode - the HTTP status code valuereason - the associated reason (optional)cause - a nested exception (optional)public HttpStatus getStatus()
IllegalArgumentException - in case of an unknown HTTP status codeHttpStatus.valueOf(int)public int getRawStatusCode()
HttpStatus enum) as an integer.getStatus(), 
HttpStatus.resolve(int)@Deprecated public Map<String,String> getHeaders()
getResponseHeaders()The default implementation in this class returns an empty map.
public HttpHeaders getResponseHeaders()
The default implementation in this class returns empty headers.
@Nullable public String getReason()
null or empty).public String getMessage()
NestedRuntimeExceptiongetMessage in class NestedRuntimeException