public class ResponseStatusException extends NestedRuntimeException
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
reason |
private HttpStatus |
status |
Constructor and Description |
---|
ResponseStatusException(HttpStatus status)
Constructor with a response status.
|
ResponseStatusException(HttpStatus status,
java.lang.String reason)
Constructor with a response status and a reason to add to the exception
message as explanation.
|
ResponseStatusException(HttpStatus status,
java.lang.String reason,
java.lang.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 |
---|---|
java.util.Map<java.lang.String,java.lang.String> |
getHeaders()
Deprecated.
as of 5.1.13 in favor of
getResponseHeaders() |
java.lang.String |
getMessage()
Return the detail message, including the message from the nested exception
if there is one.
|
java.lang.String |
getReason()
The reason explaining the exception (potentially
null or 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, getRootCause
private final HttpStatus status
@Nullable private final java.lang.String reason
public ResponseStatusException(HttpStatus status)
status
- the HTTP status (required)public ResponseStatusException(HttpStatus status, @Nullable java.lang.String reason)
status
- the HTTP status (required)reason
- the associated reason (optional)public ResponseStatusException(HttpStatus status, @Nullable java.lang.String reason, @Nullable java.lang.Throwable cause)
status
- the HTTP status (required)reason
- the associated reason (optional)cause
- a nested exception (optional)public HttpStatus getStatus()
@Deprecated public java.util.Map<java.lang.String,java.lang.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 java.lang.String getReason()
null
or empty).public java.lang.String getMessage()
NestedRuntimeException
getMessage
in class NestedRuntimeException