|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.webflow.executor.support.FlowExecutorArgumentHandler
org.springframework.webflow.executor.support.RequestParameterFlowExecutorArgumentHandler
org.springframework.webflow.executor.support.RequestPathFlowExecutorArgumentHandler
public class RequestPathFlowExecutorArgumentHandler
Flow executor argument handler that extracts arguments from the request path and exposes them in the URL path.
This allows for REST-style URLs to launch flows in the general format:
http://${host}/${context path}/${dispatcher path}/${flowId}
.
For example, the URL http://localhost/springair/reservation/booking
would launch a new execution of
the booking
flow, assuming a context path of /springair
and a servlet mapping of
/reservation/*
.
This also allows for URLs to resume flow executions in the format:
http://${host}/${context path}/${dispatcher path}/${key delimiter}/${flowExecutionKey}
.
For example, the URL http://localhost/springair/reservation/k/ABC123XYZ
would resume flow execution
"ABC123XYZ".
Note: this implementation only works with ExternalContext
implementations that return valid
ExternalContext.getRequestPathInfo()
such as the ServletExternalContext
. Furthermore, it assumes
that the controller handling flow requests is not identified using request path information. For instance, mapping
the dispatcher to "*.html" in web.xml would work since in this case the flow controller will be identified as part of
the dispatcher name (e.g. "flows.html"). Mapping the dispatcher to "/html/*" in web.xml will not work since that
would require the flow controller to be identified by the extra request path information (e.g. "/html/flows").
Constructor Summary | |
---|---|
RequestPathFlowExecutorArgumentHandler()
|
Method Summary | |
---|---|
protected void |
appendFlowExecutorPath(java.lang.StringBuffer url,
ExternalContext context)
Append the URL path to the flow executor capable of accepting new requests. |
java.lang.String |
createFlowDefinitionUrl(FlowDefinitionRedirect flowDefinitionRedirect,
ExternalContext context)
Create a URL that when redirected to launches a entirely new execution of a flow definition (starts a new conversation). |
java.lang.String |
createFlowExecutionUrl(java.lang.String flowExecutionKey,
FlowExecutionContext flowExecution,
ExternalContext context)
Create a URL path that when redirected to renders the current (or last) view selection made by the flow execution identified by the flow execution key. |
java.lang.String |
extractFlowExecutionKey(ExternalContext context)
Extract the flow execution key from the external context. |
java.lang.String |
extractFlowId(ExternalContext context)
Extracts the flow id from the external context. |
java.lang.String |
getKeyDelimiter()
Returns the key delimiter. |
boolean |
isFlowExecutionKeyPresent(ExternalContext context)
Returns true if the flow execution key is extractable from the context. |
boolean |
isFlowIdPresent(ExternalContext context)
Returns true if the flow id is extractable from the context. |
void |
setKeyDelimiter(java.lang.String keyDelimiter)
Sets the delimiter that when present in the requestPathInfo indicates the flowExecutionKey follows in the URL. |
Methods inherited from class org.springframework.webflow.executor.support.RequestParameterFlowExecutorArgumentHandler |
---|
appendQueryParameter, appendQueryParameters, createExternalUrl, extractEventId, findParameter, getParameterValueDelimiter, isEventIdPresent, setParameterValueDelimiter |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RequestPathFlowExecutorArgumentHandler()
Method Detail |
---|
public java.lang.String getKeyDelimiter()
public void setKeyDelimiter(java.lang.String keyDelimiter)
keyDelimiter
- the key delimiterextractFlowExecutionKey(ExternalContext)
public boolean isFlowIdPresent(ExternalContext context)
FlowExecutorArgumentExtractor
isFlowIdPresent
in interface FlowExecutorArgumentExtractor
isFlowIdPresent
in class RequestParameterFlowExecutorArgumentHandler
context
- the context in which a external user event occured
public java.lang.String extractFlowId(ExternalContext context)
FlowExecutorArgumentExtractor
extractFlowId
in interface FlowExecutorArgumentExtractor
extractFlowId
in class RequestParameterFlowExecutorArgumentHandler
context
- the context in which a external user event occured
public boolean isFlowExecutionKeyPresent(ExternalContext context)
FlowExecutorArgumentExtractor
isFlowExecutionKeyPresent
in interface FlowExecutorArgumentExtractor
isFlowExecutionKeyPresent
in class RequestParameterFlowExecutorArgumentHandler
context
- the context in which a external user event occured
public java.lang.String extractFlowExecutionKey(ExternalContext context) throws FlowExecutorArgumentExtractionException
FlowExecutorArgumentExtractor
extractFlowExecutionKey
in interface FlowExecutorArgumentExtractor
extractFlowExecutionKey
in class RequestParameterFlowExecutorArgumentHandler
context
- the context in which the external user event occured
FlowExecutorArgumentExtractionException
- if the flow execution key could not be extractedpublic java.lang.String createFlowDefinitionUrl(FlowDefinitionRedirect flowDefinitionRedirect, ExternalContext context)
FlowExecutorArgumentExposer
createFlowDefinitionUrl
in interface FlowExecutorArgumentExposer
createFlowDefinitionUrl
in class RequestParameterFlowExecutorArgumentHandler
flowDefinitionRedirect
- the flow definition redirect view selectioncontext
- the external context
public java.lang.String createFlowExecutionUrl(java.lang.String flowExecutionKey, FlowExecutionContext flowExecution, ExternalContext context)
FlowExecutorArgumentExposer
createFlowExecutionUrl
in interface FlowExecutorArgumentExposer
createFlowExecutionUrl
in class RequestParameterFlowExecutorArgumentHandler
flowExecutionKey
- the flow execution keyflowExecution
- the flow executioncontext
- the external context
FlowExecutionRedirect
protected void appendFlowExecutorPath(java.lang.StringBuffer url, ExternalContext context)
RequestParameterFlowExecutorArgumentHandler
appendFlowExecutorPath
in class RequestParameterFlowExecutorArgumentHandler
url
- the url buffer to append tocontext
- the context of this request
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |