oracle.cabo.servlet.event
Class BasePageFlowEngine
java.lang.Object
|
+--oracle.cabo.servlet.event.BasePageFlowEngine
- All Implemented Interfaces:
- PageFlowEngine
- Direct Known Subclasses:
- TrivialPageFlowEngine
- public abstract class BasePageFlowEngine
- extends java.lang.Object
- implements PageFlowEngine
Base implementation of PageFlowEngine.
Field Summary |
static java.lang.String |
FORWARD_EVENT_PROPERTY
Page property constant for specifying an event string. |
static java.lang.String |
FORWARD_PAGE_PROPERTY
Page property constant attached to the login page when redirecting to it. |
Method Summary |
protected EventResult |
checkPageAccess(BajaContext context, Page sourcePage, PageEvent event)
Verifies that the current page can be accessed. |
void |
destroy()
Destroys the page flow engine, freeing any state as needed. |
protected abstract Page |
getPage(BajaContext context, Page sourcePage, PageEvent event, EventResult result)
Given the result of an event, determine which Page should be rendered. |
Page |
handleRequest(BajaContext context, Page sourcePage, PageEvent event, EventHandler handler)
Handles a request for a page. |
void |
init(javax.servlet.Servlet servlet, javax.servlet.ServletConfig config)
Initializes the page flow engine. |
protected Page |
processForwardRequest(BajaContext context, Page sourcePage, Page targetPage)
Processes any forward request on the original source page. |
static void |
setForwardRequest(BajaContext context, Page targetPage, Page forwardPage, PageEvent forwardEvent)
Attaches a forwarding request to a page. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FORWARD_PAGE_PROPERTY
public static final java.lang.String FORWARD_PAGE_PROPERTY
- Page property constant attached to the login page when redirecting to it.
FORWARD_EVENT_PROPERTY
public static final java.lang.String FORWARD_EVENT_PROPERTY
- Page property constant for specifying an event string. This property is attached to the login page when redirecting to it, if the redirected request includes an event. The value is in query string format - ie. "event=eventname¶m1=val1¶m2=val2"
BasePageFlowEngine
public BasePageFlowEngine()
setForwardRequest
public static void setForwardRequest(BajaContext context,
Page targetPage,
Page forwardPage,
PageEvent forwardEvent)
- Attaches a forwarding request to a page. This is used to indicate that the target page should render on this pass, but events fired from that target page should lead to the "forwardPage" page.
init
public void init(javax.servlet.Servlet servlet,
javax.servlet.ServletConfig config)
- Initializes the page flow engine. Developers should not call this method; PageBroker will call it automatically.
-
- Specified by:
init
in interface PageFlowEngine
destroy
public void destroy()
- Destroys the page flow engine, freeing any state as needed. Developers should not call this method; PageBroker will call it automatically.
-
- Specified by:
destroy
in interface PageFlowEngine
handleRequest
public Page handleRequest(BajaContext context,
Page sourcePage,
PageEvent event,
EventHandler handler)
throws PageEventException
- Handles a request for a page.
-
- Specified by:
handleRequest
in interface PageFlowEngine
-
- Parameters:
context
- the current BajaContext
sourcePage
- the page of the request
event
- the event being fired on that page
handler
- the EventHandler that should process the event
- Returns:
- the page that should be rendered in response
checkPageAccess
protected EventResult checkPageAccess(BajaContext context,
Page sourcePage,
PageEvent event)
- Verifies that the current page can be accessed. If it can, the method must return null. Otherwise, it should return an EventResult that will be interpreted to determine the page to forward to.
getPage
protected abstract Page getPage(BajaContext context,
Page sourcePage,
PageEvent event,
EventResult result)
throws PageEventException
- Given the result of an event, determine which Page should be rendered. It is assumed that the sourcePage is considered acceptable - that is, checkPageAccess() would accept it. It is also assumed that the page returned is also acceptable.
-
- Parameters:
context
- the current BajaContext
sourcePage
- the page on which the event was processed
event
- the event just processed
result
- the result of that event
processForwardRequest
protected Page processForwardRequest(BajaContext context,
Page sourcePage,
Page targetPage)
throws PageEventException
- Processes any forward request on the original source page.
-
- Parameters:
context
- the current BajaContext
sourcePage
- the page on with the event was processed
targetPage
- the presumed target page
- Returns:
- the correct page to display