JSF-Spring

de.mindmatters.faces.spring.context.servlet.controller
Class SimpleActionController

java.lang.Object
  extended by org.springframework.context.support.ApplicationObjectSupport
      extended by org.springframework.web.context.support.WebApplicationObjectSupport
          extended by org.springframework.web.servlet.support.WebContentGenerator
              extended by org.springframework.web.servlet.mvc.AbstractController
                  extended by de.mindmatters.faces.spring.context.servlet.controller.AbstractFacesController
                      extended by de.mindmatters.faces.spring.context.servlet.controller.SimpleActionController
All Implemented Interfaces:
ActionSource, ApplicationContextAware, ServletContextAware, Controller

public class SimpleActionController
extends AbstractFacesController
implements ActionSource

This Controller implements an ActionSource and fullfills completely the contract of an ActionSource. So this Controller can be used like a UICommand which will be fully configured and mapped in the FacesDispatcherServlet's application context.

For more information please have a look at the UICommand and ActionSource documentations.

Author:
Andreas Kuhrwahl

Field Summary
 
Fields inherited from class org.springframework.web.servlet.support.WebContentGenerator
METHOD_GET, METHOD_HEAD, METHOD_POST
 
Fields inherited from class org.springframework.context.support.ApplicationObjectSupport
logger
 
Constructor Summary
SimpleActionController()
           
 
Method Summary
 void addActionListener(ActionListener listener)
          
 MethodBinding getAction()
          
 MethodBinding getActionListener()
          
 ActionListener[] getActionListeners()
          
protected  ModelAndView handleRequestInternal(FacesContext context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Template method.
 boolean isImmediate()
          
protected  void processAction(FacesContext context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, ActionEvent event)
          Process the request.
 void removeActionListener(ActionListener listener)
          
 void setAction(MethodBinding action)
          
 void setActionListener(MethodBinding actionListener)
          
 void setActionListeners(java.util.List actionListeners)
          Sets the list of new ActionListeners interested in being notified when ActionEvents occur.
 void setActionSource(ActionSource actionSource)
          Sets the ActionSource implementation this controller should use as delegate.
 void setImmediate(boolean immediate)
          
 
Methods inherited from class de.mindmatters.faces.spring.context.servlet.controller.AbstractFacesController
handleRequestInternal
 
Methods inherited from class org.springframework.web.servlet.mvc.AbstractController
handleRequest, isSynchronizeOnSession, setSynchronizeOnSession
 
Methods inherited from class org.springframework.web.servlet.support.WebContentGenerator
applyCacheSeconds, applyCacheSeconds, cacheForSeconds, cacheForSeconds, checkAndPrepare, checkAndPrepare, getCacheSeconds, getSupportedMethods, isRequireSession, isUseCacheControlHeader, isUseExpiresHeader, preventCaching, setCacheSeconds, setRequireSession, setSupportedMethods, setUseCacheControlHeader, setUseExpiresHeader
 
Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport
getServletContext, getTempDir, getWebApplicationContext, isContextRequired, setServletContext
 
Methods inherited from class org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, initApplicationContext, requiredContextClass, setApplicationContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleActionController

public SimpleActionController()
Method Detail

handleRequestInternal

protected final ModelAndView handleRequestInternal(FacesContext context,
                                                   javax.servlet.http.HttpServletRequest request,
                                                   javax.servlet.http.HttpServletResponse response)
Template method. Subclasses must implement this. The contract is the same as for handleRequest.

Specified by:
handleRequestInternal in class AbstractFacesController
Parameters:
context - FacesContext for the current request
request - current HTTP request
response - current HTTP response
Returns:
a ModelAndView to render, or null if handled directly
See Also:
AbstractController.handleRequest(HttpServletRequest, HttpServletResponse)

processAction

protected void processAction(FacesContext context,
                             javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response,
                             ActionEvent event)
Process the request. This method will be invoked after the ActionListeners (added by setActionListeners(List)) are notified and before the Action and ActionListener MethodBindings of this ActionSource will be processed. May be overriden in subclasses.

Parameters:
context - FacesContext for the current request
request - current HTTP request
response - current HTTP response
event - current ActionEvent

setActionSource

public final void setActionSource(ActionSource actionSource)
Sets the ActionSource implementation this controller should use as delegate. Default ActionSource is a UICommand instance.

Parameters:
actionSource - the ActionSource to use for internal purposes.

addActionListener

public final void addActionListener(ActionListener listener)

Specified by:
addActionListener in interface ActionSource

getAction

public final MethodBinding getAction()

Specified by:
getAction in interface ActionSource

getActionListener

public final MethodBinding getActionListener()

Specified by:
getActionListener in interface ActionSource

getActionListeners

public final ActionListener[] getActionListeners()

Specified by:
getActionListeners in interface ActionSource

isImmediate

public final boolean isImmediate()

Specified by:
isImmediate in interface ActionSource

removeActionListener

public final void removeActionListener(ActionListener listener)

Specified by:
removeActionListener in interface ActionSource

setAction

public final void setAction(MethodBinding action)

Specified by:
setAction in interface ActionSource

setActionListener

public final void setActionListener(MethodBinding actionListener)

Specified by:
setActionListener in interface ActionSource

setImmediate

public final void setImmediate(boolean immediate)

Specified by:
setImmediate in interface ActionSource

setActionListeners

public final void setActionListeners(java.util.List actionListeners)
Sets the list of new ActionListeners interested in being notified when ActionEvents occur.

Parameters:
actionListeners - the ActionListener instance to use

JSF-Spring

Copyright © 2006 mindmatters GmbH & Co. KG