Class DefaultFlowUrlHandler

java.lang.Object
org.springframework.webflow.context.servlet.DefaultFlowUrlHandler
All Implemented Interfaces:
FlowUrlHandler
Direct Known Subclasses:
FilenameFlowUrlHandler

public class DefaultFlowUrlHandler extends Object implements FlowUrlHandler
The default FlowUrlHandler implementation for Spring Web Flow.

Expects URLs to launch flow to be of this pattern:

 https://<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:

 https://<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.
Author:
Keith Donald, Jeremy Grelle
  • Constructor Details

    • DefaultFlowUrlHandler

      public DefaultFlowUrlHandler()
  • Method Details

    • setEncodingScheme

      public void setEncodingScheme(String encodingScheme)
      Set the character encoding scheme for flow urls. Default is the request's encoding scheme (which is ISO-8859-1 if not specified otherwise).
    • getFlowExecutionKey

      public String getFlowExecutionKey(jakarta.servlet.http.HttpServletRequest request)
      Description copied from interface: FlowUrlHandler
      Extract the flow execution from the request.
      Specified by:
      getFlowExecutionKey in interface FlowUrlHandler
      Parameters:
      request - the request
      Returns:
      the flow execution key, or null if no flow execution key is present
    • getFlowId

      public String getFlowId(jakarta.servlet.http.HttpServletRequest request)
      Description copied from interface: FlowUrlHandler
      Extract the flow id from the request.
      Specified by:
      getFlowId in interface FlowUrlHandler
      Parameters:
      request - the request
      Returns:
      the flow id, or null if no flow id is present
    • createFlowExecutionUrl

      public String createFlowExecutionUrl(String flowId, String flowExecutionKey, jakarta.servlet.http.HttpServletRequest request)
      Description copied from interface: FlowUrlHandler
      Create a URL that when addressed will resume an existing execution of a flow.
      Specified by:
      createFlowExecutionUrl in interface FlowUrlHandler
      flowExecutionKey - the flow execution key that is paused and waiting to be resumed
      request - the current request
      Returns:
      the flow execution url
    • createFlowDefinitionUrl

      public String createFlowDefinitionUrl(String flowId, AttributeMap<?> input, jakarta.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.

      Example - given a request originating at:

       https://someHost/someApp/someServlet/nestedPath/foo
       
      and a request for the flow id "nestedPath/bar", the new flow definition URL would be:
       https://someHost/someApp/someServlet/nestedPath/bar
       
      Specified by:
      createFlowDefinitionUrl in interface FlowUrlHandler
      Parameters:
      flowId - the id of the flow definition
      input - the input to pass the new flow execution
      request - the current request
      Returns:
      the flow definition url
    • getEncodingScheme

      protected String getEncodingScheme(jakarta.servlet.http.HttpServletRequest request)
    • appendQueryParameters

      protected <T> void appendQueryParameters(StringBuilder url, Map<String,T> parameters, String encodingScheme)