@Response public class HttpException extends BasicRuntimeException
REST methods on subclasses of
Constructor and Description |
---|
HttpException(int status,
String msg,
Object... args)
Constructor.
|
HttpException(String msg)
Constructor.
|
HttpException(Throwable cause,
int status)
Constructor.
|
HttpException(Throwable cause,
int status,
String msg,
Object... args)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
String |
getFullStackMessage(boolean scrubForXssVulnerabilities)
Returns all error messages from all errors in this stack.
|
Map<String,Object> |
getHeaders()
Returns the headers associated with this exception.
|
Throwable |
getRootCause()
Returns the root cause of this exception.
|
int |
getStatus()
Returns the HTTP status code.
|
int |
hashCode() |
HttpException |
header(String name,
Object val)
Add an HTTP header to this exception.
|
HttpException |
setStatus(int status)
Set the status code on this exception.
|
String |
toString() |
getCause, getMessage
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
public HttpException(Throwable cause, int status, String msg, Object... args)
cause
- The cause of this exception.status
- The HTTP status code.msg
- The status message.args
- Optional MessageFormat
-style arguments.public HttpException(String msg)
msg
- The status message.public HttpException(Throwable cause, int status)
cause
- The root exception.status
- The HTTP status code.public HttpException(int status, String msg, Object... args)
status
- The HTTP status code.msg
- The status message.args
- Optional MessageFormat
-style arguments.public Throwable getRootCause()
The root cause is the first exception in the init-cause parent chain that's not one of the following:
public String getFullStackMessage(boolean scrubForXssVulnerabilities)
Typically useful if you want to render all the error messages in the stack, but don't want to render all the stack traces too.
scrubForXssVulnerabilities
- If public HttpException setStatus(int status)
status
- The status code.@ResponseStatus public int getStatus()
public HttpException header(String name, Object val)
name
- The header name.val
- The header value.@ResponseHeader(value="*") @BeanIgnore public Map<String,Object> getHeaders()
Copyright © 2016–2020 The Apache Software Foundation. All rights reserved.