org.araneaframework.framework.container
Class ExceptionHandlingFlowContainerWidget

java.lang.Object
  extended by org.araneaframework.core.BaseComponent
      extended by org.araneaframework.core.BaseService
          extended by org.araneaframework.core.BaseWidget
              extended by org.araneaframework.core.BaseApplicationWidget
                  extended by org.araneaframework.framework.container.StandardFlowContainerWidget
                      extended by org.araneaframework.framework.container.ExceptionHandlingFlowContainerWidget
All Implemented Interfaces:
Serializable, Component, Composite, Composite.CompositeComponent, Composite.CompositeService, Composite.CompositeWidget, ApplicationComponent, ApplicationService, ApplicationWidget, FlowContext, FlowContextWidget, Service, Viewable, Viewable.ViewableComponent, Viewable.ViewableService, Viewable.ViewableWidget, Widget
Direct Known Subclasses:
BaseMenuWidget, OverlayRootWidget.OverlayFlowContainer

public abstract class ExceptionHandlingFlowContainerWidget
extends StandardFlowContainerWidget

This flow container widget also handles any exceptions that may occur during any child widget processing. Any sub-class will have to provide implementation for the renderExceptionHandler(OutputData, Exception) method, that allows custom handling for given exception. To define the page that renders the exception to the user, one can use following solution:


 ServletUtil.include("/WEB-INF/jsp/error.jsp", this, output);
 
The page would be rendered as any other page inside this container.

Also note that this widget declares three events in its init() method to let users handle the situation:

If you wish to use these events, make sure that when you override the init() method, also include the super.init(); line to that method.

Author:
Jevgeni Kabanov (ekabanov at araneaframework dot org)
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.araneaframework.framework.container.StandardFlowContainerWidget
StandardFlowContainerWidget.CallFrame, StandardFlowContainerWidget.CancelClosure, StandardFlowContainerWidget.FinishClosure, StandardFlowContainerWidget.FlowReference, StandardFlowContainerWidget.ReplaceClosure, StandardFlowContainerWidget.ResetClosure, StandardFlowContainerWidget.StandardTransitionHandler, StandardFlowContainerWidget.StartClosure
 
Nested classes/interfaces inherited from class org.araneaframework.core.BaseApplicationWidget
BaseApplicationWidget.CompositeImpl, BaseApplicationWidget.ViewableImpl, BaseApplicationWidget.ViewModel
 
Nested classes/interfaces inherited from class org.araneaframework.core.BaseWidget
BaseWidget.WidgetImpl
 
Nested classes/interfaces inherited from class org.araneaframework.core.BaseService
BaseService.ServiceImpl
 
Nested classes/interfaces inherited from class org.araneaframework.core.BaseComponent
BaseComponent.ComponentImpl
 
Nested classes/interfaces inherited from interface org.araneaframework.framework.FlowContext
FlowContext.Configurator, FlowContext.Handler, FlowContext.TransitionHandler
 
Nested classes/interfaces inherited from interface org.araneaframework.Widget
Widget.Interface
 
Nested classes/interfaces inherited from interface org.araneaframework.core.ApplicationWidget
ApplicationWidget.WidgetViewModel
 
Nested classes/interfaces inherited from interface org.araneaframework.core.ApplicationService
ApplicationService.ServiceViewModel
 
Nested classes/interfaces inherited from interface org.araneaframework.core.ApplicationComponent
ApplicationComponent.ComponentViewModel
 
Nested classes/interfaces inherited from interface org.araneaframework.Composite
Composite.CompositeComponent, Composite.CompositeService, Composite.CompositeWidget
 
Nested classes/interfaces inherited from interface org.araneaframework.Viewable
Viewable.ViewableComponent, Viewable.ViewableService, Viewable.ViewableWidget
 
Nested classes/interfaces inherited from interface org.araneaframework.Composite
Composite.CompositeComponent, Composite.CompositeService, Composite.CompositeWidget
 
Nested classes/interfaces inherited from interface org.araneaframework.Viewable
Viewable.ViewableComponent, Viewable.ViewableService, Viewable.ViewableWidget
 
Nested classes/interfaces inherited from interface org.araneaframework.Composite
Composite.CompositeComponent, Composite.CompositeService, Composite.CompositeWidget
 
Nested classes/interfaces inherited from interface org.araneaframework.Viewable
Viewable.ViewableComponent, Viewable.ViewableService, Viewable.ViewableWidget
 
Field Summary
protected  Exception exception
          The exception that occurs is stored in this variable.
 
Fields inherited from class org.araneaframework.framework.container.StandardFlowContainerWidget
callStack, finishable, top
 
Fields inherited from class org.araneaframework.core.BaseService
currentInputData, currentOutputData
 
Fields inherited from interface org.araneaframework.framework.FlowContext
TRANSITION_CANCEL, TRANSITION_FINISH, TRANSITION_REPLACE, TRANSITION_RESET, TRANSITION_START
 
Fields inherited from interface org.araneaframework.core.ApplicationWidget
EVENT_HANDLER_ID_KEY, EVENT_PARAMETER_KEY, EVENT_PATH_KEY
 
Fields inherited from interface org.araneaframework.core.ApplicationService
ACTION_HANDLER_ID_KEY, ACTION_PARAMETER_KEY, ACTION_PATH_KEY
 
Constructor Summary
ExceptionHandlingFlowContainerWidget()
          Initializes the flow container.
ExceptionHandlingFlowContainerWidget(Widget topWidget)
          Initializes the flow container, and specifies the topWidget as its parent.
 
Method Summary
protected  void event(Path path, InputData input)
          Overrides the event() functionality to catch and handle exceptions.
 void handleEventCancel()
          Handles the cancel event.
 void handleEventReset()
          Handles the reset event.
 void handleEventRetry()
          Handles the retry event.
protected  void handleWidgetException(Exception e)
          A widget specific handling of an exception.
protected  void init()
          Initializes the widget and declares three events to let users handle the situation: retry - retries to process the last event; cancel - cancels the last event; reset - resets the entire flow context of this container widget. If you wish to use these events, and you override the init() method, also include the super.init(); line to that method.
protected  void propagate(Message message)
          Overrides the propagate() functionality to catch and handle exceptions.
protected  void render(OutputData output)
          Overrides the render() functionality to catch and handle exceptions.
protected abstract  void renderExceptionHandler(OutputData output, Exception e)
          This method lets sub-classes implement their way to handle and display this exception.
protected  void update(InputData input)
          Overrides the update() functionality to catch and handle exceptions.
 
Methods inherited from class org.araneaframework.framework.container.StandardFlowContainerWidget
addFrameWidget, addNestedEnvironmentEntry, cancel, destroy, doCancel, doFinish, doReplace, doReset, doStart, doTransition, finish, getActiveCallFrame, getActiveFlow, getCallStack, getChildWidgetEnvironment, getCurrentReference, getTransitionHandler, isNested, makeCallFrame, putLocalEnvironmentEntries, replace, replace, reset, setFinishable, setTop, setTransitionHandler, start, start, start
 
Methods inherited from class org.araneaframework.core.BaseApplicationWidget
_getComposite, _getViewable, action, addActionListener, addEventListener, addWidget, addWidget, clearActionListeners, clearEventlisteners, clearGlobalEventListener, disableWidget, enableWidget, getActionId, getChildEnvironment, getChildren, getEnvironment, getEventId, getViewModel, getWidget, handleAction, handleEvent, handleUpdate, putViewData, putViewDataOnce, removeActionListener, removeEventListener, removeViewData, removeWidget, setGlobalEventListener
 
Methods inherited from class org.araneaframework.core.BaseWidget
_getWidget, getInputData, getOutputData
 
Methods inherited from class org.araneaframework.core.BaseService
_getService, handleServiceException
 
Methods inherited from class org.araneaframework.core.BaseComponent
_addComponent, _addComponent, _checkCall, _disableComponent, _enableComponent, _endCall, _endWaitingCall, _getChildren, _getComponent, _getDisabledChildren, _propagate, _relocateComponent, _removeComponent, _setEnvironment, _setScope, _startCall, _startWaitingCall, _strictCheckCall, _strictStartCall, _waitNoCall, disable, enable, getScope, handleException, isAlive, isDead, isInitialized
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.araneaframework.Widget
_getWidget
 
Methods inherited from interface org.araneaframework.Service
_getService
 
Methods inherited from interface org.araneaframework.Component
_getComponent, getEnvironment, getScope, isAlive
 

Field Detail

exception

protected Exception exception
The exception that occurs is stored in this variable.

Constructor Detail

ExceptionHandlingFlowContainerWidget

public ExceptionHandlingFlowContainerWidget()
Initializes the flow container.


ExceptionHandlingFlowContainerWidget

public ExceptionHandlingFlowContainerWidget(Widget topWidget)
Initializes the flow container, and specifies the topWidget as its parent.

Parameters:
topWidget - a parent widget.
Method Detail

init

protected void init()
             throws Exception
Initializes the widget and declares three events to let users handle the situation: If you wish to use these events, and you override the init() method, also include the super.init(); line to that method.

Overrides:
init in class StandardFlowContainerWidget
Throws:
Exception - Any non-specific exception that may occur.

handleEventRetry

public void handleEventRetry()
                      throws Exception
Handles the retry event.

Throws:
Exception - Any non-specific exception that may occur.

handleEventCancel

public void handleEventCancel()
                       throws Exception
Handles the cancel event.

Throws:
Exception - Any non-specific exception that may occur.

handleEventReset

public void handleEventReset()
                      throws Exception
Handles the reset event.

Throws:
Exception - Any non-specific exception that may occur.

handleWidgetException

protected void handleWidgetException(Exception e)
                              throws Exception
A widget specific handling of an exception.

Overrides:
handleWidgetException in class BaseWidget
Throws:
Exception

update

protected void update(InputData input)
               throws Exception
Overrides the update() functionality to catch and handle exceptions.

Overrides:
update in class BaseApplicationWidget
Throws:
Exception

event

protected void event(Path path,
                     InputData input)
              throws Exception
Overrides the event() functionality to catch and handle exceptions.

Overrides:
event in class BaseApplicationWidget
Throws:
Exception

propagate

protected void propagate(Message message)
                  throws Exception
Overrides the propagate() functionality to catch and handle exceptions.

Overrides:
propagate in class BaseApplicationWidget
Parameters:
message - A message to forward.
Throws:
Exception - Any runtime exception that may occur.

render

protected void render(OutputData output)
               throws Exception
Overrides the render() functionality to catch and handle exceptions.

Overrides:
render in class StandardFlowContainerWidget
Throws:
Exception

renderExceptionHandler

protected abstract void renderExceptionHandler(OutputData output,
                                               Exception e)
                                        throws Exception
This method lets sub-classes implement their way to handle and display this exception. To define the page that renders the exception to the user, one can use following solution:

 ServletUtil.include("/WEB-INF/jsp/error.jsp", this, output);
 

Parameters:
output - output data.
e - the exception that occur.
Throws:
Exception - Any non-specific exception that may occur.