public class DefaultFlowUrlHandler extends java.lang.Object implements FlowUrlHandler
Expects URLs to launch flow to be of this pattern:
http://<host>/[app context path]/[app servlet path]/<flow path>As an example, the URL
http://localhost/springtravel/app/booking
would map to flow "booking", while the
URL http://localhost/springtravel/app/hotels/booking
would map to flow "hotels/booking". In both these
examples, /springtravel is the context path and /app is the servlet path. The flow id is treated as the path info
component of the request URL string.
If the path info is null, the servletPath will be used as the flow id. Also, if the servlet path ends in an extension
it will be stripped when calculating the flow id. For example, a URL of
http://localhost/springtravel/hotels/booking.htm
would still map to flow id "hotels/booking", assuming a
context path of /springtravel, a servlet path of /hotels/booking.htm (likely mapped with a servlet-mapping of *.htm),
and a path info of null.
Expects URLs to resume flows to be of this pattern:
http://<host>/[app context path]/[app servlet path]/<flow path>?execution=<flow execution key>As an example, the URL http://localhost/springtravel/app/hotels/booking?execution=e1s1 would attempt to resume execution "e1s1" of the "hotels/booking" flow.
Constructor and Description |
---|
DefaultFlowUrlHandler() |
Modifier and Type | Method and Description |
---|---|
protected <T> void |
appendQueryParameters(java.lang.StringBuilder url,
java.util.Map<java.lang.String,T> parameters,
java.lang.String encodingScheme) |
java.lang.String |
createFlowDefinitionUrl(java.lang.String flowId,
AttributeMap<?> input,
javax.servlet.http.HttpServletRequest request)
The flow definition URL for the given flow id will be built by appending the flow id to the base app context and
servlet paths.
|
java.lang.String |
createFlowExecutionUrl(java.lang.String flowId,
java.lang.String flowExecutionKey,
javax.servlet.http.HttpServletRequest request)
Create a URL that when addressed will resume an existing execution of a flow.
|
protected java.lang.String |
getEncodingScheme(javax.servlet.http.HttpServletRequest request) |
java.lang.String |
getFlowExecutionKey(javax.servlet.http.HttpServletRequest request)
Extract the flow execution from the request.
|
java.lang.String |
getFlowId(javax.servlet.http.HttpServletRequest request)
Extract the flow id from the request.
|
void |
setEncodingScheme(java.lang.String encodingScheme)
Set the character encoding scheme for flow urls.
|
public void setEncodingScheme(java.lang.String encodingScheme)
public java.lang.String getFlowExecutionKey(javax.servlet.http.HttpServletRequest request)
FlowUrlHandler
getFlowExecutionKey
in interface FlowUrlHandler
request
- the requestpublic java.lang.String getFlowId(javax.servlet.http.HttpServletRequest request)
FlowUrlHandler
getFlowId
in interface FlowUrlHandler
request
- the requestpublic java.lang.String createFlowExecutionUrl(java.lang.String flowId, java.lang.String flowExecutionKey, javax.servlet.http.HttpServletRequest request)
FlowUrlHandler
createFlowExecutionUrl
in interface FlowUrlHandler
flowExecutionKey
- the flow execution key that is paused and waiting to be resumedrequest
- the current requestpublic java.lang.String createFlowDefinitionUrl(java.lang.String flowId, AttributeMap<?> input, javax.servlet.http.HttpServletRequest request)
Example - given a request originating at:
http://someHost/someApp/someServlet/nestedPath/fooand a request for the flow id "nestedPath/bar", the new flow definition URL would be:
http://someHost/someApp/someServlet/nestedPath/bar
createFlowDefinitionUrl
in interface FlowUrlHandler
flowId
- the id of the flow definitioninput
- the input to pass the new flow executionrequest
- the current requestprotected java.lang.String getEncodingScheme(javax.servlet.http.HttpServletRequest request)
protected <T> void appendQueryParameters(java.lang.StringBuilder url, java.util.Map<java.lang.String,T> parameters, java.lang.String encodingScheme)