| Modifier and Type | Class and Description |
|---|---|
| public static interface |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv String | |
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv boolean | |
| public static final String | |
| public static final String | |
| public static final String | |
| private static final Logger |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public ByteBuffer | Returns: The content as a ByteBuffer, or null for no body.The error code that will be sent status, String The reason for the error code (may be null) reason, HttpFields.The header fields that will be sent with the response. fieldsBad Message Error body Generate an error response body to be sent for a bad message. |
| public boolean | |
| protected void | generateAcceptableResponse(ServletContextRequest
The base request baseRequest, HttpServletRequest The servlet request (may be wrapped) request, HttpServletResponse The response (may be wrapped) response, int the http error code code, String the http error message message)Generate an acceptable error response. |
| protected void | generateAcceptableResponse(ServletContextRequest
The base request baseRequest, HttpServletRequest The servlet request (may be wrapped) request, HttpServletResponse The response (may be wrapped) response, int the http error code code, String the http error message message, String The mimetype to generate (may be */*or other wildcard) contentType)Generate an acceptable error response for a mime type. |
| protected Writer | Returns: AWriter if there is a known acceptable charset or nullThe base request baseRequest, HttpServletRequest The servlet request (may be wrapped) request, HttpServletResponse The response (may be wrapped) response)
Deprecated
Returns an acceptable writer for an error page.
|
| public String | |
| public static Request. | |
| public boolean | |
| public boolean | handle(Request
the HTTP request to handle request, Response the HTTP response to handle response, Callback the callback to complete when the handling is complete callback)Implements org. Invoked to handle the passed HTTP request and response. |
| protected void | |
| private void | |
| public boolean | |
| public boolean | |
| public void | setCacheControl(String
the cacheControl header to set on error responses. cacheControl)Set the cacheControl. |
| public void | setShowMessageInTitle(boolean
if true, the error message appears in page title showMessageInTitle)Set if true, the error message appears in page title. |
| public void | setShowServlet(boolean
True if the error page will show the Servlet that generated the error showServlet)
|
| public void | |
| protected void | |
| protected void | |
| protected void | writeErrorPage(HttpServletRequest request, Writer writer, int code, String message, boolean showStacks)
|
| protected void | writeErrorPageBody(HttpServletRequest request, Writer writer, int code, String message, boolean showStacks)
|
| protected void | |
| protected void | writeErrorPageMessage(HttpServletRequest request, Writer writer, int code, String message, String uri)
|
| protected void | |
| protected void |
| _cacheControl | back to summary |
|---|---|
| pack-priv String _cacheControl | |
| _disableStacks | back to summary |
|---|---|
| pack-priv boolean _disableStacks | |
| _showMessageInTitle | back to summary |
|---|---|
| pack-priv boolean _showMessageInTitle | |
| _showServlet | back to summary |
|---|---|
| pack-priv boolean _showServlet | |
| _showStacks | back to summary |
|---|---|
| pack-priv boolean _showStacks | |
| ERROR_CHARSET | back to summary |
|---|---|
| public static final String ERROR_CHARSET | |
| ERROR_CONTEXT | back to summary |
|---|---|
| public static final String ERROR_CONTEXT | |
| ERROR_PAGE | back to summary |
|---|---|
| public static final String ERROR_PAGE | |
| LOG | back to summary |
|---|---|
| private static final Logger LOG | |
| ErrorHandler | back to summary |
|---|---|
| public ErrorHandler() | |
| badMessageError | back to summary |
|---|---|
| public ByteBuffer badMessageError(int status, String reason, HttpFields. Bad Message Error body Generate an error response body to be sent for a bad message. In this case there is something wrong with the request, so either a request cannot be built, or it is not safe to build a request. This method allows for a simple error page body to be returned and some response headers to be set.
| |
| errorPageForMethod | back to summary |
|---|---|
| public boolean errorPageForMethod(String method) | |
| generateAcceptableResponse | back to summary |
|---|---|
| protected void generateAcceptableResponse(ServletContextRequest baseRequest, HttpServletRequest request, HttpServletResponse response, int code, String message) throws IOException Generate an acceptable error response. This method is called to generate an Error page of a mime type that is
acceptable to the user-agent. The Accept header is evaluated in
quality order and the method
| |
| generateAcceptableResponse | back to summary |
|---|---|
| protected void generateAcceptableResponse(ServletContextRequest baseRequest, HttpServletRequest request, HttpServletResponse response, int code, String message, String contentType) throws IOException Generate an acceptable error response for a mime type. This method is called for each mime type in the users agent's
The default implementation handles "text/html", "text/*" and "*/*". The method can be overridden to handle other types. Implementations must immediate produce a response and may not be async.
| |
| getAcceptableWriter | back to summary |
|---|---|
| protected Writer getAcceptableWriter(Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
Deprecated
Returns an acceptable writer for an error page. Uses the user-agent's
| |
| getCacheControl | back to summary |
|---|---|
| public String getCacheControl() Get the cacheControl.
| |
| getErrorHandler | back to summary |
|---|---|
| public static Request. | |
| getShowMessageInTitle | back to summary |
|---|---|
| public boolean getShowMessageInTitle() | |
| handle | back to summary |
|---|---|
| public boolean handle(Request request, Response response, Callback callback) throws Exception Implements org. Doc from org. Invoked to handle the passed HTTP request and response. The request is accepted by returning true, then handling must be concluded by completing the passed callback. The handling may be asynchronous, i.e. this method may return true and complete the given callback later, possibly from a different thread. If this method returns false, then the callback must not be invoked and any mutation on the response reversed. Exceptions thrown by this method may be subsequently handled by an error The simplest implementation is:
public boolean handle(Request request, Response response, Callback callback)
{
callback.succeeded();
return true;
}
A HelloWorld implementation is:
public boolean handle(Request request, Response response, Callback callback)
{
response.write(true, ByteBuffer.wrap("Hello World\n".getBytes(StandardCharsets.UTF_8)), callback);
return true;
}
| |
| handleErrorPage | back to summary |
|---|---|
| protected void handleErrorPage(HttpServletRequest request, Writer writer, int code, String message) throws IOException | |
| htmlRow | back to summary |
|---|---|
| private void htmlRow(Writer writer, String tag, Object value) throws IOException | |
| isShowServlet | back to summary |
|---|---|
public boolean isShowServlet()
| |
| isShowStacks | back to summary |
|---|---|
public boolean isShowStacks()
| |
| setCacheControl | back to summary |
|---|---|
| public void setCacheControl(String cacheControl) Set the cacheControl.
| |
| setShowMessageInTitle | back to summary |
|---|---|
| public void setShowMessageInTitle(boolean showMessageInTitle) Set if true, the error message appears in page title.
| |
| setShowServlet | back to summary |
|---|---|
public void setShowServlet(boolean showServlet)
| |
| setShowStacks | back to summary |
|---|---|
public void setShowStacks(boolean showStacks)
| |
| write | back to summary |
|---|---|
| protected void write(Writer writer, String string) throws IOException | |
| writeErrorJson | back to summary |
|---|---|
| protected void writeErrorJson(HttpServletRequest request, PrintWriter writer, int code, String message) | |
| writeErrorPage | back to summary |
|---|---|
| protected void writeErrorPage(HttpServletRequest request, Writer writer, int code, String message, boolean showStacks) throws IOException | |
| writeErrorPageBody | back to summary |
|---|---|
| protected void writeErrorPageBody(HttpServletRequest request, Writer writer, int code, String message, boolean showStacks) throws IOException | |
| writeErrorPageHead | back to summary |
|---|---|
| protected void writeErrorPageHead(HttpServletRequest request, Writer writer, int code, String message) throws IOException | |
| writeErrorPageMessage | back to summary |
|---|---|
| protected void writeErrorPageMessage(HttpServletRequest request, Writer writer, int code, String message, String uri) throws IOException | |
| writeErrorPageStacks | back to summary |
|---|---|
| protected void writeErrorPageStacks(HttpServletRequest request, Writer writer) throws IOException | |
| writeErrorPlain | back to summary |
|---|---|
| protected void writeErrorPlain(HttpServletRequest request, PrintWriter writer, int code, String message) | |
| Modifier and Type | Method and Description |
|---|---|
| public String |
| getErrorPage | back to summary |
|---|---|
| public String getErrorPage(HttpServletRequest request) | |