|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.veriplace.web.views.AbstractStatusViewRenderer
public abstract class AbstractStatusViewRenderer
Basic implementation of StatusViewRenderer which defines a view name for
each error condition and for the "please wait" page, and automatically stores the VeriplaceState
object and callback URL in request attributes. How to display a page is left up to subclasses.
| Field Summary | |
|---|---|
protected java.lang.String |
callbackAttributeName
|
static java.lang.String |
DEFAULT_ERROR_KEY
|
static java.lang.String |
ERROR_KEY_PREFIX
|
protected java.lang.String |
stateAttributeName
|
static java.lang.String |
WAITING_KEY
|
| Constructor Summary | |
|---|---|
AbstractStatusViewRenderer()
|
|
| Method Summary | |
|---|---|
boolean |
canRenderWaitingView()
Returns true if this StatusViewRenderer is able to display content for the "please wait" condition. |
java.lang.String |
getCallbackAttributeName()
See setCallbackAttributeName(String). |
java.lang.String |
getDefaultErrorViewName()
See setDefaultErrorViewName(String). |
java.lang.String |
getErrorViewName(java.lang.Class<?> exceptionClass)
Returns the name of the error view to use for a particular exception class, as defined by setErrorViewName(Class, String). |
java.lang.String |
getStateAttributeName()
See setStateAttributeName(String). |
java.util.Map<java.lang.String,java.lang.String> |
getViewMap()
See setViewMap(Map). |
java.lang.String |
getWaitingViewName()
See setWaitingViewName(String). |
protected java.lang.Class<?> |
matchExceptionClass(java.lang.String name)
|
boolean |
renderErrorView(HttpServletRequest request,
HttpServletResponse response,
VeriplaceState state,
java.lang.Exception exception)
Displays an appropriate error response for a given exception. |
protected abstract boolean |
renderViewInternal(HttpServletRequest request,
HttpServletResponse response,
VeriplaceState state,
java.lang.String viewName)
Override this method to implement displaying a page based on a view name. |
boolean |
renderWaitingView(HttpServletRequest request,
HttpServletResponse response,
VeriplaceState state,
java.lang.String callbackUrl)
Displays appropriate content for the "please wait" condition. |
void |
setCallbackAttributeName(java.lang.String callbackAttributeName)
Specifies that when the framework is displaying a "please wait" view, or any view that includes an automatic redirect, the redirect URL should be stored as a request attribute (or model object, if you are using Spring) with the given name. |
void |
setDefaultErrorViewName(java.lang.String defaultErrorViewName)
Specifies the name of the view to use for error conditions that were not otherwise specified with setErrorViewName(Class, String). |
void |
setErrorViewName(java.lang.Class<?> exceptionClass,
java.lang.String viewName)
Specifies the name of the view to use for error conditions that are thrown as the specified exception class. |
void |
setStateAttributeName(java.lang.String stateAttributeName)
Specifies that the framework should always store a reference to the current VeriplaceState using the given attribute name. |
void |
setViewMap(java.util.Map<java.lang.String,java.lang.String> viewMap)
Specifies the views to display for various conditions, using a list of name-value pairs. |
void |
setWaitingViewName(java.lang.String waitingViewName)
Specifies the name of the view to use for the "please wait" condition. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String WAITING_KEY
public static final java.lang.String DEFAULT_ERROR_KEY
public static final java.lang.String ERROR_KEY_PREFIX
protected java.lang.String callbackAttributeName
protected java.lang.String stateAttributeName
| Constructor Detail |
|---|
public AbstractStatusViewRenderer()
| Method Detail |
|---|
public java.util.Map<java.lang.String,java.lang.String> getViewMap()
setViewMap(Map).
public void setViewMap(java.util.Map<java.lang.String,java.lang.String> viewMap)
setErrorViewName(Class, String), you
can specify either a general exception base class or a very specific exception. setDefaultErrorViewName(String).
java.lang.IllegalArgumentException - if the key of an entry does not match one of the rules described aboveprotected java.lang.Class<?> matchExceptionClass(java.lang.String name)
public java.lang.String getWaitingViewName()
setWaitingViewName(String).
public void setWaitingViewName(java.lang.String waitingViewName)
StatusViewRenderer.renderWaitingView(HttpServletRequest, HttpServletResponse, VeriplaceState, String).
See WaitingException.
public java.lang.String getDefaultErrorViewName()
setDefaultErrorViewName(String).
public void setDefaultErrorViewName(java.lang.String defaultErrorViewName)
setErrorViewName(Class, String).
public void setErrorViewName(java.lang.Class<?> exceptionClass,
java.lang.String viewName)
This includes any exception subclasses derived from that class, if they are not covered by a more specific setErrorViewName rule. For instance, given the following configuration--
statusViewRenderer.setErrorViewName(UserDiscoveryException.class, "userFailed");
statusViewRenderer.setErrorViewName(UserDiscoveryNotPermittedException.class, "badPermission");
--a UserDiscoveryNotPermittedException will be handled with the view "badPermission", but a UserNotFoundException (which is derived from UserDiscoveryException) will be handled with the view "userFailed".
public java.lang.String getErrorViewName(java.lang.Class<?> exceptionClass)
setErrorViewName(Class, String).
public java.lang.String getCallbackAttributeName()
setCallbackAttributeName(String).
public void setCallbackAttributeName(java.lang.String callbackAttributeName)
callbackAttributeName - public java.lang.String getStateAttributeName()
setStateAttributeName(String).
public void setStateAttributeName(java.lang.String stateAttributeName)
VeriplaceState using the given attribute name. It will be
stored as an attribute on the current HttpServletRequest, and if you are using the
Spring framework, it will also be available as a model object with the same name.
public boolean canRenderWaitingView()
StatusViewRendererStatusViewRenderer.renderWaitingView(HttpServletRequest, HttpServletResponse, VeriplaceState, String)
will never be called.
canRenderWaitingView in interface StatusViewRenderer
public boolean renderWaitingView(HttpServletRequest request,
HttpServletResponse response,
VeriplaceState state,
java.lang.String callbackUrl)
throws StatusViewException,
ServletException
StatusViewRenderer
renderWaitingView in interface StatusViewRenderercallbackUrl - the URL to use for an automatic refresh
StatusViewException - if there was an error in rendering the view
ServletException
public boolean renderErrorView(HttpServletRequest request,
HttpServletResponse response,
VeriplaceState state,
java.lang.Exception exception)
throws StatusViewException,
ServletException
StatusViewRenderer
renderErrorView in interface StatusViewRendererStatusViewException - if there was an error in rendering the view
ServletException
protected abstract boolean renderViewInternal(HttpServletRequest request,
HttpServletResponse response,
VeriplaceState state,
java.lang.String viewName)
throws StatusViewException,
ServletException
ServletStatusViewRenderer
and SpringStatusViewRenderer.
request - the current HttpServletRequestresponse - the current HttpServletResponsestate - the current VeriplaceStateviewName - name of the view to display
StatusViewException - for any error that prevents the page from being displayed
ServletException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||