public class RestException extends FormattedRuntimeException
REST methods on subclasses of RestServlet
can throw this exception to trigger an HTTP status other than the
automatically-generated 404
, 405
, and 500
statuses.
Constructor and Description |
---|
RestException(int status,
String msg,
Object... args)
Constructor.
|
RestException(int status,
Throwable cause)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
String |
getFullStackMessage(boolean scrubForXssVulnerabilities)
Returns all error messages from all errors in this stack.
|
int |
getOccurrence()
Returns the number of times this exception occurred on this servlet.
|
Throwable |
getRootCause()
Returns the root cause of this exception.
|
int |
getStatus()
Returns the HTTP status code.
|
int |
hashCode() |
RestException |
initCause(Throwable cause)
Sets the inner cause for this exception.
|
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
public RestException(int status, String msg, Object... args)
status
- The HTTP status code.msg
- The status message.args
- Optional MessageFormat
-style arguments.public RestException(int status, Throwable cause)
status
- The HTTP status code.cause
- The root exception.public RestException initCause(Throwable cause)
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 int getOccurrence()
@RestResource.useStackTraceHashes()
is enabled, or 0
otherwise.public int getStatus()
Copyright © 2018 Apache. All rights reserved.