Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Web Flow
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.webflow.mvc.servlet
Class FlowHandlerAdapter

    java.lang.Object
      org.springframework.context.support.ApplicationObjectSupport
          org.springframework.web.context.support.WebApplicationObjectSupport
              org.springframework.web.servlet.support.WebContentGenerator
                  org.springframework.webflow.mvc.servlet.FlowHandlerAdapter

All Implemented Interfaces:
  org.springframework.beans.factory.Aware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.web.context.ServletContextAware, org.springframework.web.servlet.HandlerAdapter

Direct Known Subclasses:
  JsfFlowHandlerAdapter

    public class FlowHandlerAdapter

extends org.springframework.web.servlet.support.WebContentGenerator
implements org.springframework.web.servlet.HandlerAdapter, org.springframework.beans.factory.InitializingBean

A custom MVC HandlerAdapter that encapsulates the generic workflow associated with executing flows in a Servlet environment. Delegates to mapped `flow handlers` to manage the interaction with executions of specific flow definitions.

Author:
  Keith Donald

Field Summary

Fields inherited from class org.springframework.web.servlet.support.WebContentGenerator
`METHOD_GET, METHOD_HEAD, METHOD_POST`

Constructor Summary
`FlowHandlerAdapter()` Creates a new flow handler adapter.

Method Summary
`void` | `afterPropertiesSet()`
`protected ServletExternalContext` | `createServletExternalContext(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)` Creates the servlet external context for the current HTTP servlet request.
`protected MutableAttributeMap` | `defaultCreateFlowExecutionInputMap(javax.servlet.http.HttpServletRequest request)` The default algorithm to create the flow execution input map.
`protected java.lang.String` | `defaultGetFlowId(javax.servlet.http.HttpServletRequest request)` The default algorithm to determine the id of the flow to launch from the current request.
`protected void` | `defaultHandleException(java.lang.String flowId, FlowException e, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)` The default algorithm for handling a `FlowException` now handled by the Web Flow system.
`protected void` | `defaultHandleExecutionOutcome(java.lang.String flowId, FlowExecutionOutcome outcome, ServletExternalContext context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)` The default algorithm for handling a flow execution outcome.
`AjaxHandler` | `getAjaxHandler()` Returns the configured Ajax handler.
`FlowExecutor` | `getFlowExecutor()` Returns the central service for executing flows.
`FlowUrlHandler` | `getFlowUrlHandler()` Returns the flow url handler.
`long` | `getLastModified(javax.servlet.http.HttpServletRequest request, java.lang.Object handler)`
`boolean` | `getRedirectHttp10Compatible()` Whether redirect sent by this handler adapter should be compatible with HTTP 1.0 clients.
`org.springframework.web.servlet.ModelAndView` | `handle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Object handler)`
`protected void` | `sendRedirect(java.lang.String url, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)` Sends a redirect to the requested url using `HttpServletResponse.sendRedirect(String)`.Called to actually perform flow execution redirects, flow definition redirects, and external redirects.
`void` | `setAjaxHandler(AjaxHandler ajaxHandler)` Sets the configured Ajax handler.
`void` | `setFlowExecutor(FlowExecutor flowExecutor)` Sets the central service for executing flows.
`void` | `setFlowUrlHandler(FlowUrlHandler flowUrlHandler)` Sets the flow url handler
`void` | `setRedirectHttp10Compatible(boolean redirectHttp10Compatible)` Set whether redirects sent by this handler adapter should be compatible with HTTP 1.0 clients.
`boolean` | `supports(java.lang.Object handler)`

Methods inherited from class org.springframework.web.servlet.support.WebContentGenerator
`applyCacheSeconds, applyCacheSeconds, cacheForSeconds, cacheForSeconds, checkAndPrepare, checkAndPrepare, getCacheSeconds, getSupportedMethods, isAlwaysMustRevalidate, isRequireSession, isUseCacheControlHeader, isUseCacheControlNoStore, isUseExpiresHeader, preventCaching, setAlwaysMustRevalidate, setCacheSeconds, setRequireSession, setSupportedMethods, setUseCacheControlHeader, setUseCacheControlNoStore, setUseExpiresHeader`

Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport
`getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, 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

### FlowHandlerAdapter

    public FlowHandlerAdapter()

  Creates a new flow handler adapter.

  See Also:
    `setFlowExecutor(FlowExecutor)`, `setFlowUrlHandler(FlowUrlHandler)`, `setAjaxHandler(AjaxHandler)`, `afterPropertiesSet()`

Method Detail

### getFlowExecutor

    public FlowExecutor getFlowExecutor()

  Returns the central service for executing flows. Required.

### setFlowExecutor

    public void setFlowExecutor(FlowExecutor flowExecutor)

  Sets the central service for executing flows. Required.

  Parameters:
    `flowExecutor` -

### getFlowUrlHandler

    public FlowUrlHandler getFlowUrlHandler()

  Returns the flow url handler.

### setFlowUrlHandler

    public void setFlowUrlHandler(FlowUrlHandler flowUrlHandler)

  Sets the flow url handler

  Parameters:
    `flowUrlHandler` - the flow url handler

### getAjaxHandler

    public AjaxHandler getAjaxHandler()

  Returns the configured Ajax handler.

### setAjaxHandler

    public void setAjaxHandler(AjaxHandler ajaxHandler)

  Sets the configured Ajax handler.

  Parameters:
    `ajaxHandler` - the ajax handler

### getRedirectHttp10Compatible

    public boolean getRedirectHttp10Compatible()

  Whether redirect sent by this handler adapter should be compatible with HTTP 1.0 clients.

  Returns:
    true if so, false otherwise

### setRedirectHttp10Compatible

    public void setRedirectHttp10Compatible(boolean redirectHttp10Compatible)

  Set whether redirects sent by this handler adapter should be compatible with HTTP 1.0 clients.

  By default, this will enforce a redirect HTTP status code of 302 by delegating to `HttpServletResponse.sendRedirect`. Setting this to false will send HTTP status code 303, which is the correct code for HTTP 1.1 clients, but not understood by HTTP 1.0 clients.

  Many HTTP 1.1 clients treat 302 just like 303, not making any difference. However, some clients depend on 303 when redirecting after a POST request; turn this flag off in such a scenario.

  See Also:
    `HttpServletResponse.sendRedirect(java.lang.String)`

### afterPropertiesSet

    public void afterPropertiesSet()
                            throws java.lang.Exception

  Specified by:
    `afterPropertiesSet` in interface `org.springframework.beans.factory.InitializingBean`
  Throws:
    `java.lang.Exception`

### supports

    public boolean supports(java.lang.Object handler)

  Specified by:
    `supports` in interface `org.springframework.web.servlet.HandlerAdapter`

### handle

    public org.springframework.web.servlet.ModelAndView handle(javax.servlet.http.HttpServletRequest request,
                                                               javax.servlet.http.HttpServletResponse response,
                                                               java.lang.Object handler)
                                                        throws java.lang.Exception

  Specified by:
    `handle` in interface `org.springframework.web.servlet.HandlerAdapter`
  Throws:
    `java.lang.Exception`

### getLastModified

    public long getLastModified(javax.servlet.http.HttpServletRequest request,
                                java.lang.Object handler)

  Specified by:
    `getLastModified` in interface `org.springframework.web.servlet.HandlerAdapter`

### createServletExternalContext

    protected ServletExternalContext createServletExternalContext(javax.servlet.http.HttpServletRequest request,
                                                                  javax.servlet.http.HttpServletResponse response)

  Creates the servlet external context for the current HTTP servlet request.

  Parameters:
    `request` - the current request
    `response` - the current response

### defaultGetFlowId

    protected java.lang.String defaultGetFlowId(javax.servlet.http.HttpServletRequest request)

  The default algorithm to determine the id of the flow to launch from the current request. Only called if `FlowHandler.getFlowId()` returns null. This implementation delegates to the configured `FlowUrlHandler.getFlowId(HttpServletRequest)`. Subclasses may override.

  Parameters:
    `request` - the current request

### defaultCreateFlowExecutionInputMap

    protected MutableAttributeMap defaultCreateFlowExecutionInputMap(javax.servlet.http.HttpServletRequest request)

  The default algorithm to create the flow execution input map. Only called if `FlowHandler.createExecutionInputMap(HttpServletRequest)` returns null. This implementation exposes all current request parameters as flow execution input attributes. Subclasses may override.

  Parameters:
    `request` - the current request

### defaultHandleExecutionOutcome

    protected void defaultHandleExecutionOutcome(java.lang.String flowId,
                                                 FlowExecutionOutcome outcome,
                                                 ServletExternalContext context,
                                                 javax.servlet.http.HttpServletRequest request,
                                                 javax.servlet.http.HttpServletResponse response)
                                          throws java.io.IOException

  The default algorithm for handling a flow execution outcome. Only called if `FlowHandler.handleExecutionOutcome(FlowExecutionOutcome, HttpServletRequest, HttpServletResponse)` returns null. This implementation attempts to start a new execution of the ended flow. Any flow execution output is passed as input to the new execution. Subclasses may override.

  Parameters:
    `flowId` - the id of the ended flow
    `outcome` - the flow execution outcome
    `context` - ServletExternalContext the completed ServletExternalContext
    `request` - the current request
    `response` - the current response
  Throws:
    `java.io.IOException`

### defaultHandleException

    protected void defaultHandleException(java.lang.String flowId,
                                          FlowException e,
                                          javax.servlet.http.HttpServletRequest request,
                                          javax.servlet.http.HttpServletResponse response)
                                   throws java.io.IOException

  The default algorithm for handling a `FlowException` now handled by the Web Flow system. Only called if `FlowHandler.handleException(FlowException, HttpServletRequest, HttpServletResponse)` returns null. This implementation rethrows the exception unless it is a `NoSuchFlowExecutionException`. If the exception is a NoSuchFlowExecutionException, this implementation attempts to start a new execution of the ended or expired flow. Subclasses may override.

  Parameters:
    `flowId` - the id of the ended flow
    `e` - the flow exception
    `request` - the current request
    `response` - the current response
  Throws:
    `java.io.IOException`

### sendRedirect

    protected void sendRedirect(java.lang.String url,
                                javax.servlet.http.HttpServletRequest request,
                                javax.servlet.http.HttpServletResponse response)
                         throws java.io.IOException

  Sends a redirect to the requested url using `HttpServletResponse.sendRedirect(String)`.Called to actually perform flow execution redirects, flow definition redirects, and external redirects. Subclasses may override to customize general Web Flow system redirect behavior.

  Parameters:
    `url` - the url to redirect to
    `request` - the current request
    `response` - the current response
  Throws:
    `java.io.IOException` - an exception occurred

Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Web Flow
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD