org.apache.beehive.netui.pageflow
Class FacesBackingBean

Object
  extended by PageFlowManagedObject
      extended by FacesBackingBean
All Implemented Interfaces:
Serializable, EventListener, HttpSessionBindingListener

public abstract class FacesBackingBean
extends PageFlowManagedObject

A JavaServer Faces backing bean. An instance of this class will be created whenever a corresponding JSF path is requested (e.g., an instance of foo.MyPage will be created for the webapp-relative path "/foo/MyPage.faces"). The instance will be released (removed from the user session) when a non-matching path is requested. A faces backing bean can hold component references and event/command handlers, and it can raise actions with normal JSF command event handlers that are annotated with @Jpf.CommandHandler. The bean instance can be bound to with a JSF-style expression like #{backing.myComponent}.

JSF backing beans are configured using the @Jpf.FacesBacking annotation.

See Also:
Serialized Form

Constructor Summary
FacesBackingBean()
           
 
Method Summary
 void ensureFailover(HttpServletRequest request)
          Ensures that any changes to this object will be replicated in a cluster (for failover), even if the replication scheme uses a change-detection algorithm that relies on HttpSession.setAttribute to be aware of changes.
 String getDisplayName()
          Get the display name for the bean.
protected  Object getPageInput(String pageInputName)
          Get a page input that was passed from a Page Flow action as an "action output".
 Map getPageInputMap()
          Get the map of all page inputs that was passed from a Page Flow action as "action outputs".
protected  void onRestore()
          Callback that is invoked when this backing bean is restored as the page itself is restored through a @Jpf.Forward or @Jpf.SimpleAction with navigateTo=Jpf.NavigateTo.currentPage or navigateTo=Jpf.NavigateTo.previousPage.
 void persistInSession(HttpServletRequest request, HttpServletResponse response)
          Store this object in the user session, in the appropriate place.
 void reinitialize(HttpServletRequest request, HttpServletResponse response, ServletContext servletContext)
          Reinitialize the bean for a new request.
protected  void removeFromSession(HttpServletRequest request)
          Remove this instance from the session.
 void restore(HttpServletRequest request, HttpServletResponse response, ServletContext servletContext)
          Restore this bean (set it as the current one from some dormant state).
 
Methods inherited from class PageFlowManagedObject
create, fieldIsUninitialized, getCreateTime, getServletContext, initializeField, onCreate, onDestroy, valueBound, valueUnbound
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FacesBackingBean

public FacesBackingBean()
Method Detail

persistInSession

public void persistInSession(HttpServletRequest request,
                             HttpServletResponse response)
Store this object in the user session, in the appropriate place. Used by the framework; normally should not be called directly.

Specified by:
persistInSession in class PageFlowManagedObject

removeFromSession

protected void removeFromSession(HttpServletRequest request)
Remove this instance from the session.

Specified by:
removeFromSession in class PageFlowManagedObject

ensureFailover

public void ensureFailover(HttpServletRequest request)
Ensures that any changes to this object will be replicated in a cluster (for failover), even if the replication scheme uses a change-detection algorithm that relies on HttpSession.setAttribute to be aware of changes. Note that this method is used by the framework and does not need to be called explicitly in most cases.

Specified by:
ensureFailover in class PageFlowManagedObject
Parameters:
request - the current HttpServletRequest

getDisplayName

public String getDisplayName()
Get the display name for the bean. For FacesBackingBeans, this is simply the class name.

Specified by:
getDisplayName in class PageFlowManagedObject

reinitialize

public void reinitialize(HttpServletRequest request,
                         HttpServletResponse response,
                         ServletContext servletContext)
Reinitialize the bean for a new request. Used by the framework; normally should not be called directly.

Overrides:
reinitialize in class PageFlowManagedObject

getPageInput

protected Object getPageInput(String pageInputName)
Get a page input that was passed from a Page Flow action as an "action output".

Parameters:
pageInputName - the name of the page input. This is the same as the name of the "action output".
Returns:
the value of the page input, or null if the given one does not exist.

getPageInputMap

public Map getPageInputMap()
Get the map of all page inputs that was passed from a Page Flow action as "action outputs".

Returns:
a Map of page-input-name (String) to page-input-value (Object).

onRestore

protected void onRestore()
Callback that is invoked when this backing bean is restored as the page itself is restored through a @Jpf.Forward or @Jpf.SimpleAction with navigateTo=Jpf.NavigateTo.currentPage or navigateTo=Jpf.NavigateTo.previousPage.


restore

public void restore(HttpServletRequest request,
                    HttpServletResponse response,
                    ServletContext servletContext)
Restore this bean (set it as the current one from some dormant state). This is a framework-invoked method that should not normally be called directly.

Parameters:
request - the current HttpServletRequest.
response - the current HttpServletResponse.
servletContext - the current ServletContext.