org.springframework.webflow.executor.mvc
Class PortletFlowController

java.lang.Object
  extended by org.springframework.context.support.ApplicationObjectSupport
      extended by org.springframework.web.portlet.context.PortletApplicationObjectSupport
          extended by org.springframework.web.portlet.handler.PortletContentGenerator
              extended by org.springframework.web.portlet.mvc.AbstractController
                  extended by org.springframework.webflow.executor.mvc.PortletFlowController
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.web.portlet.context.PortletContextAware, org.springframework.web.portlet.mvc.Controller

public class PortletFlowController
extends org.springframework.web.portlet.mvc.AbstractController
implements org.springframework.beans.factory.InitializingBean

Point of integration between Spring Portlet MVC and Spring Web Flow: a Controller that routes incoming portlet requests to one or more managed flow executions.

Requests into the web flow system are handled by a FlowExecutor, which this class delegates to. Consult the JavaDoc of that class for more information on how requests are processed.

Note: a single PortletFlowController may execute all flows within your application. See the phonebook-portlet sample application for examples of the various strategies for launching and resuming flow executions in a Portlet environment.

It is also possible to customize the FlowExecutorArgumentHandler strategy to allow for different types of controller parameterization, for example perhaps in conjunction with a REST-style request mapper.

Integrating Spring Web Flow into a Portlet environment puts some minor contraints on your flows. These constraints result from technical limitations in the Portlet API, for instance the fact that a render request cannot issue a redirect. Keep the following in mind when developing Portlets using Spring Web Flow:

Author:
Keith Donald, Erwin Vervaet
See Also:
FlowExecutor, FlowExecutorArgumentHandler

Field Summary
 
Fields inherited from class org.springframework.context.support.ApplicationObjectSupport
logger
 
Constructor Summary
PortletFlowController()
          Create a new portlet flow controller.
 
Method Summary
 void afterPropertiesSet()
           
protected  java.lang.String convertToString(java.lang.Object object)
          Converts the object to a string.
 FlowExecutorArgumentHandler getArgumentHandler()
          Returns the flow executor argument handler used by this controller.
 FlowExecutor getFlowExecutor()
          Returns the flow executor used by this controller.
protected  void handleActionRequestInternal(javax.portlet.ActionRequest request, javax.portlet.ActionResponse response)
           
protected  org.springframework.web.portlet.ModelAndView handleRenderRequestInternal(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)
           
 void setArgumentHandler(FlowExecutorArgumentHandler argumentHandler)
          Sets the flow executor argument handler to use.
 void setDefaultFlowId(java.lang.String defaultFlowId)
          Sets the identifier of the default flow to launch if no flowId argument can be extracted by the configured FlowExecutorArgumentHandler during render request processing.
 void setFlowExecutor(FlowExecutor flowExecutor)
          Configures the flow executor implementation to use.
protected  org.springframework.web.portlet.ModelAndView toModelAndView(ResponseInstruction responseInstruction)
          Convert given response instruction into a Spring Portlet MVC model and view.
 
Methods inherited from class org.springframework.web.portlet.mvc.AbstractController
handleActionRequest, handleRenderRequest, isRenderWhenMinimized, isSynchronizeOnSession, setRenderWhenMinimized, setSynchronizeOnSession
 
Methods inherited from class org.springframework.web.portlet.handler.PortletContentGenerator
applyCacheSeconds, cacheForSeconds, check, checkAndPrepare, checkAndPrepare, getCacheSeconds, isRequireSession, preventCaching, setCacheSeconds, setRequireSession
 
Methods inherited from class org.springframework.web.portlet.context.PortletApplicationObjectSupport
getPortletContext, getTempDir, isContextRequired, setPortletContext
 
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

PortletFlowController

public PortletFlowController()
Create a new portlet flow controller. Allows for bean style usage.

See Also:
setFlowExecutor(FlowExecutor), setArgumentHandler(FlowExecutorArgumentHandler)
Method Detail

getFlowExecutor

public FlowExecutor getFlowExecutor()
Returns the flow executor used by this controller.

Returns:
the flow executor

setFlowExecutor

public void setFlowExecutor(FlowExecutor flowExecutor)
Configures the flow executor implementation to use. Required.

Parameters:
flowExecutor - the fully configured flow executor

getArgumentHandler

public FlowExecutorArgumentHandler getArgumentHandler()
Returns the flow executor argument handler used by this controller.

Returns:
the argument handler

setArgumentHandler

public void setArgumentHandler(FlowExecutorArgumentHandler argumentHandler)
Sets the flow executor argument handler to use.

Parameters:
argumentHandler - the fully configured argument handler

setDefaultFlowId

public void setDefaultFlowId(java.lang.String defaultFlowId)
Sets the identifier of the default flow to launch if no flowId argument can be extracted by the configured FlowExecutorArgumentHandler during render request processing.

This is a convenience method that sets the default flow id of the controller's argument handler. Don't use this when using setArgumentHandler(FlowExecutorArgumentHandler).


afterPropertiesSet

public void afterPropertiesSet()
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean

handleRenderRequestInternal

protected org.springframework.web.portlet.ModelAndView handleRenderRequestInternal(javax.portlet.RenderRequest request,
                                                                                   javax.portlet.RenderResponse response)
                                                                            throws java.lang.Exception
Overrides:
handleRenderRequestInternal in class org.springframework.web.portlet.mvc.AbstractController
Throws:
java.lang.Exception

handleActionRequestInternal

protected void handleActionRequestInternal(javax.portlet.ActionRequest request,
                                           javax.portlet.ActionResponse response)
                                    throws java.lang.Exception
Overrides:
handleActionRequestInternal in class org.springframework.web.portlet.mvc.AbstractController
Throws:
java.lang.Exception

convertToString

protected java.lang.String convertToString(java.lang.Object object)
Converts the object to a string. Simply returns String.valueOf(Object) by default.

Parameters:
object - the object
Returns:
the string-form of the object

toModelAndView

protected org.springframework.web.portlet.ModelAndView toModelAndView(ResponseInstruction responseInstruction)
Convert given response instruction into a Spring Portlet MVC model and view. Will only be called during the render phase.



Copyright © 2004-2007. All Rights Reserved.