public class ErrorRedirect
extends java.lang.Object
ServerPagesBundle.AppBuilder.errorPage(String)).
Only response codes >= 400 (errors) are handled, everything else considered as normal flow.
When SPA support is enabled, also intercept all 404 errors and checks if it could be SPA route (and do home redirect instead of error).
Asset errors are intercepted directly inside ServerPagesFilter.
Rest errors are intercepted with TemplateExceptionListener
and TemplateErrorResponseFilter.
| Modifier and Type | Field and Description |
|---|---|
static int |
CODE_400 |
static int |
DEFAULT_ERROR_PAGE
Special code for default error page registration
(
ServerPagesBundle.AppBuilder.errorPage(String)). |
| Constructor and Description |
|---|
ErrorRedirect(java.lang.String appMapping,
java.util.Map<java.lang.Integer,java.lang.String> pages,
SpaSupport spa) |
| Modifier and Type | Method and Description |
|---|---|
static javax.ws.rs.WebApplicationException |
getContextError()
Note: method is not supposed to be used directly as error object is directly available in model:
ErrorTemplateView.getError(). |
static java.lang.String |
getContextErrorOriginalUrl()
Returned string is
request.getRequestURI() from original request. |
static boolean |
hasContextError() |
boolean |
redirect(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.ws.rs.WebApplicationException exception)
Try to redirect error to configured error page.
|
public static final int DEFAULT_ERROR_PAGE
ServerPagesBundle.AppBuilder.errorPage(String)).public static final int CODE_400
public ErrorRedirect(java.lang.String appMapping,
java.util.Map<java.lang.Integer,java.lang.String> pages,
SpaSupport spa)
public boolean redirect(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.ws.rs.WebApplicationException exception)
request - requestresponse - responseexception - error (either simple wrapping for error code or complete stacktrace from rest)public static javax.ws.rs.WebApplicationException getContextError()
ErrorTemplateView.getError().public static java.lang.String getContextErrorOriginalUrl()
request.getRequestURI() from original request.public static boolean hasContextError()