JSF-Spring

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

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.MultiActionEventController
All Implemented Interfaces:
ApplyRequestValuesPhaseListener, InvokeApplicationPhaseListener, ProcessValidationsPhaseListener, RenderResponsePhaseListener, RestoreViewPhaseListener, UpdateModelValuesPhaseListener, InitializingBean, ApplicationContextAware, ServletContextAware, Controller, LastModified

public class MultiActionEventController
extends AbstractController
implements InitializingBean, LastModified, RestoreViewPhaseListener, ApplyRequestValuesPhaseListener, ProcessValidationsPhaseListener, UpdateModelValuesPhaseListener, InvokeApplicationPhaseListener, RenderResponsePhaseListener

JSF-Spring's integration class of Spring's MultiActionController. For further informtion please have a look at the documentation of MultiActionController.

MultiActionController can handle several different types of request with methods of a well documented form (see MultiActionController). Such methods are allowed to take a third parameter HttpSession, a Map or a single domain specific type. Typically JSF binds the input fields (the request parameters) of a HTTP form to backing beans (also known as managed beans) with unique names. All those backing beans which takes the request parameters will be exposed as third parameter in a Map (with their names as keys) if the action method is accordingly parameterized. If such a third parameter is a single domain specific type, the first occurrence of the type in the backing bean map is exposed to it. So it's very easy to integrate singleton scoped controllers which can handle request scoped model data.

Furthermore this class implements the phaselistener interfaces specified by the de.mindmatters.faces.spring.context.servlet.lifecycle package. Subclasses may override them or (if this class is used with a delegate configured by setDelegate(Object)) delegates may implement them.

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
MultiActionEventController()
          Constructor for MultiActionEventController that looks for handler methods in the present subclass.
MultiActionEventController(java.lang.Object delegate)
          Constructor for MultiActionEventController that looks for handler methods in delegate, rather than a subclass of this class.
 
Method Summary
 void afterApplyRequestValues(FacesContext context)
          Handle a notification that the processing for the Apply Request Values phase has just been completed.
 void afterInvokeApplication(FacesContext context)
          Handle a notification that the processing for the Invoke Application phase has just been completed.
 void afterProcessValidations(FacesContext context)
          Handle a notification that the processing for the Process Validations phase has just been completed.
 void afterPropertiesSet()
          Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).
 void afterRenderResponse(FacesContext context)
          Handle a notification that the processing for the Render Response phase has just been completed.
 void afterRestoreView(FacesContext context)
          Handle a notification that the processing for the Restore View phase has just been completed.
 void afterUpdateModelValues(FacesContext context)
          Handle a notification that the processing for the Update Model Values phase has just been completed.
 void beforeApplyRequestValues(FacesContext context)
          Handle a notification that the processing for the Apply Request Values phase of the request processing lifecycle is about to begin.
 void beforeInvokeApplication(FacesContext context)
          Handle a notification that the processing for the Invoke Application phase of the request processing lifecycle is about to begin.
 void beforeProcessValidations(FacesContext context)
          Handle a notification that the processing for the Process Validations phase of the request processing lifecycle is about to begin.
 void beforeRenderResponse(FacesContext context)
          Handle a notification that the processing for the Render Response phase of the request processing lifecycle is about to begin.
 void beforeRestoreView(FacesContext context)
          Handle a notification that the processing for the Restore View phase of the request processing lifecycle is about to begin.
 void beforeUpdateModelValues(FacesContext context)
          Handle a notification that the processing for the Update Model Values phase of the request processing lifecycle is about to begin.
 long getLastModified(javax.servlet.http.HttpServletRequest request)
          Same contract as for HttpServlet's getLastModified method.
 MethodNameResolver getMethodNameResolver()
          Return the MethodNameResolver used by this class.
protected  ModelAndView handleRequestInternal(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Template method.
protected  void initMultiActionEventController()
          This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.
 void setDelegate(java.lang.Object delegate)
          Set the delegate used by this class.
 void setMethodNameResolver(MethodNameResolver resolver)
          Set the method name resolver that this class should use.
 
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

MultiActionEventController

public MultiActionEventController()
Constructor for MultiActionEventController that looks for handler methods in the present subclass.


MultiActionEventController

public MultiActionEventController(java.lang.Object delegate)
Constructor for MultiActionEventController that looks for handler methods in delegate, rather than a subclass of this class.

Parameters:
delegate - handler object. This doesn't need to implement any particular interface, as everything is done using reflection.
Method Detail

afterPropertiesSet

public final void afterPropertiesSet()
                              throws java.lang.Exception
Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).

This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.

Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
java.lang.Exception - in the event of misconfiguration (such as failure to set an essential property) or if initialization fails.

initMultiActionEventController

protected void initMultiActionEventController()
                                       throws java.lang.Exception
This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.

Throws:
java.lang.Exception - in the event of misconfiguration (such as failure to set an essential property) or if initialization fails.

getLastModified

public final long getLastModified(javax.servlet.http.HttpServletRequest request)
Same contract as for HttpServlet's getLastModified method. Invoked before request processing.

The return value will be sent to the HTTP client as Last-Modified header, and compared with If-Modified-Since headers that the client sends back. The content will only get regenerated if there has been a modification.

Specified by:
getLastModified in interface LastModified
Parameters:
request - current HTTP request
Returns:
the time the underlying resource was last modified, or -1 meaning that the content must always be regenerated
See Also:
HandlerAdapter.getLastModified(javax.servlet.http.HttpServletRequest, java.lang.Object), HttpServlet.getLastModified(javax.servlet.http.HttpServletRequest)

setDelegate

public final void setDelegate(java.lang.Object delegate)
Set the delegate used by this class. The default is this, assuming that handler methods have been added by a subclass.

Parameters:
delegate - an object containing handler methods

getMethodNameResolver

public final MethodNameResolver getMethodNameResolver()
Return the MethodNameResolver used by this class.

Returns:
the used MethodNameResolver

setMethodNameResolver

public final void setMethodNameResolver(MethodNameResolver resolver)
Set the method name resolver that this class should use. Allows parameterization of handler method mappings.

Parameters:
resolver - the resolver - default resolver is ActionMethodNameResolver

handleRequestInternal

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

Specified by:
handleRequestInternal in class AbstractController
Throws:
java.lang.Exception
See Also:
AbstractController.handleRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)

afterRestoreView

public void afterRestoreView(FacesContext context)
Handle a notification that the processing for the Restore View phase has just been completed.

Specified by:
afterRestoreView in interface RestoreViewPhaseListener
Parameters:
context - FacesContext for the current request being processed

beforeRestoreView

public void beforeRestoreView(FacesContext context)
Handle a notification that the processing for the Restore View phase of the request processing lifecycle is about to begin.

Specified by:
beforeRestoreView in interface RestoreViewPhaseListener
Parameters:
context - FacesContext for the current request being processed

afterApplyRequestValues

public void afterApplyRequestValues(FacesContext context)
Handle a notification that the processing for the Apply Request Values phase has just been completed.

Specified by:
afterApplyRequestValues in interface ApplyRequestValuesPhaseListener
Parameters:
context - FacesContext for the current request being processed

beforeApplyRequestValues

public void beforeApplyRequestValues(FacesContext context)
Handle a notification that the processing for the Apply Request Values phase of the request processing lifecycle is about to begin.

Specified by:
beforeApplyRequestValues in interface ApplyRequestValuesPhaseListener
Parameters:
context - FacesContext for the current request being processed

afterProcessValidations

public void afterProcessValidations(FacesContext context)
Handle a notification that the processing for the Process Validations phase has just been completed.

Specified by:
afterProcessValidations in interface ProcessValidationsPhaseListener
Parameters:
context - FacesContext for the current request being processed

beforeProcessValidations

public void beforeProcessValidations(FacesContext context)
Handle a notification that the processing for the Process Validations phase of the request processing lifecycle is about to begin.

Specified by:
beforeProcessValidations in interface ProcessValidationsPhaseListener
Parameters:
context - FacesContext for the current request being processed

afterUpdateModelValues

public void afterUpdateModelValues(FacesContext context)
Handle a notification that the processing for the Update Model Values phase has just been completed.

Specified by:
afterUpdateModelValues in interface UpdateModelValuesPhaseListener
Parameters:
context - FacesContext for the current request being processed

beforeUpdateModelValues

public void beforeUpdateModelValues(FacesContext context)
Handle a notification that the processing for the Update Model Values phase of the request processing lifecycle is about to begin.

Specified by:
beforeUpdateModelValues in interface UpdateModelValuesPhaseListener
Parameters:
context - FacesContext for the current request being processed

afterInvokeApplication

public void afterInvokeApplication(FacesContext context)
Handle a notification that the processing for the Invoke Application phase has just been completed.

Specified by:
afterInvokeApplication in interface InvokeApplicationPhaseListener
Parameters:
context - FacesContext for the current request being processed

beforeInvokeApplication

public void beforeInvokeApplication(FacesContext context)
Handle a notification that the processing for the Invoke Application phase of the request processing lifecycle is about to begin.

Specified by:
beforeInvokeApplication in interface InvokeApplicationPhaseListener
Parameters:
context - FacesContext for the current request being processed

afterRenderResponse

public void afterRenderResponse(FacesContext context)
Handle a notification that the processing for the Render Response phase has just been completed.

Specified by:
afterRenderResponse in interface RenderResponsePhaseListener
Parameters:
context - FacesContext for the current request being processed

beforeRenderResponse

public void beforeRenderResponse(FacesContext context)
Handle a notification that the processing for the Render Response phase of the request processing lifecycle is about to begin.

Specified by:
beforeRenderResponse in interface RenderResponsePhaseListener
Parameters:
context - FacesContext for the current request being processed

JSF-Spring

Copyright © 2006 mindmatters GmbH & Co. KG