public class FlowHandlerAdapter
extends org.springframework.web.servlet.support.WebContentGenerator
implements org.springframework.web.servlet.HandlerAdapter, org.springframework.beans.factory.InitializingBean
flow handlers
to manage the interaction with executions of
specific flow definitions.Constructor and Description |
---|
FlowHandlerAdapter()
Creates a new flow handler adapter.
|
Modifier and Type | Method and Description |
---|---|
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<java.lang.Object> |
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.
|
boolean |
getSaveOutputToFlashScopeOnRedirect()
Whether servlet relative redirects should pass
flow output to the Spring MVC
flash scope . |
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.
|
void |
setSaveOutputToFlashScopeOnRedirect(boolean saveOutputToFlashScopeOnRedirect)
Set whether servlet relative redirects sent by this handler adapter
should pass
flow output to the
Spring MVC flash scope . |
void |
setStatusCode(org.springframework.http.HttpStatus statusCode)
Set the status code for this view.
|
boolean |
supports(java.lang.Object handler) |
applyCacheSeconds, applyCacheSeconds, cacheForSeconds, cacheForSeconds, checkAndPrepare, checkAndPrepare, getCacheSeconds, getSupportedMethods, isAlwaysMustRevalidate, isRequireSession, isUseCacheControlHeader, isUseCacheControlNoStore, isUseExpiresHeader, preventCaching, setAlwaysMustRevalidate, setCacheSeconds, setRequireSession, setSupportedMethods, setUseCacheControlHeader, setUseCacheControlNoStore, setUseExpiresHeader
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
public FlowHandlerAdapter()
public FlowExecutor getFlowExecutor()
public void setFlowExecutor(FlowExecutor flowExecutor)
flowExecutor
- public FlowUrlHandler getFlowUrlHandler()
public void setFlowUrlHandler(FlowUrlHandler flowUrlHandler)
flowUrlHandler
- the flow url handlerpublic AjaxHandler getAjaxHandler()
public void setAjaxHandler(AjaxHandler ajaxHandler)
ajaxHandler
- the ajax handlerpublic boolean getRedirectHttp10Compatible()
public void setRedirectHttp10Compatible(boolean redirectHttp10Compatible)
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.
HttpServletResponse.sendRedirect(java.lang.String)
public void setStatusCode(org.springframework.http.HttpStatus statusCode)
Default is to send 302/303, depending on the value of the
http10Compatible
flag.
public void setSaveOutputToFlashScopeOnRedirect(boolean saveOutputToFlashScopeOnRedirect)
flow output
to the
Spring MVC flash scope
.
By default, to remain compatible with previous releases, flow output is not mapped to flash scope.
saveOutputToFlashScopeOnRedirect
- public boolean getSaveOutputToFlashScopeOnRedirect()
flow output
to the Spring MVC
flash scope
.true
if so, false
otherwisepublic void afterPropertiesSet() throws java.lang.Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
java.lang.Exception
public boolean supports(java.lang.Object handler)
supports
in interface org.springframework.web.servlet.HandlerAdapter
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
handle
in interface org.springframework.web.servlet.HandlerAdapter
java.lang.Exception
public long getLastModified(javax.servlet.http.HttpServletRequest request, java.lang.Object handler)
getLastModified
in interface org.springframework.web.servlet.HandlerAdapter
protected ServletExternalContext createServletExternalContext(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
request
- the current requestresponse
- the current responseprotected java.lang.String defaultGetFlowId(javax.servlet.http.HttpServletRequest request)
FlowHandler.getFlowId()
returns null. This implementation delegates to the configured
FlowUrlHandler.getFlowId(HttpServletRequest)
. Subclasses may override.request
- the current requestprotected MutableAttributeMap<java.lang.Object> defaultCreateFlowExecutionInputMap(javax.servlet.http.HttpServletRequest request)
FlowHandler.createExecutionInputMap(HttpServletRequest)
returns null. This implementation exposes all
current request parameters as flow execution input attributes. Subclasses may override.request
- the current requestprotected void defaultHandleExecutionOutcome(java.lang.String flowId, FlowExecutionOutcome outcome, ServletExternalContext context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
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.flowId
- the id of the ended flowoutcome
- the flow execution outcomecontext
- ServletExternalContext the completed ServletExternalContextrequest
- the current requestresponse
- the current responsejava.io.IOException
protected void defaultHandleException(java.lang.String flowId, FlowException e, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
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.flowId
- the id of the ended flowe
- the flow exceptionrequest
- the current requestresponse
- the current responsejava.io.IOException
protected void sendRedirect(java.lang.String url, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
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.url
- the url to redirect torequest
- the current requestresponse
- the current responsejava.io.IOException
- an exception occurred