Class FlowHandlerMapping

java.lang.Object
org.springframework.context.support.ApplicationObjectSupport
org.springframework.web.context.support.WebApplicationObjectSupport
org.springframework.web.servlet.handler.AbstractHandlerMapping
org.springframework.webflow.mvc.servlet.FlowHandlerMapping
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.context.ApplicationContextAware, org.springframework.core.Ordered, org.springframework.web.context.ServletContextAware, org.springframework.web.servlet.HandlerMapping

public class FlowHandlerMapping extends org.springframework.web.servlet.handler.AbstractHandlerMapping
Implementation of HandlerMapping that follows a simple convention for creating URL path mappings from the ids of registered flow definitions. This implementation returns a FlowHandler that invokes a flow if the current request path matches the id of a flow in the configured FlowDefinitionRegistry. Alternatively, a custom FlowHandler may also be registered with in containing ApplicationContext with that id and it will be returned. This allows for more control over the invocation of a flow from Spring MVC environment. Null is returned in the case of no flow id match, allowing the next handler mapping in the chain to execute.
Author:
Keith Donald
  • Field Summary

    Fields inherited from class org.springframework.web.servlet.handler.AbstractHandlerMapping

    mappingsLogger

    Fields inherited from interface org.springframework.web.servlet.HandlerMapping

    BEST_MATCHING_HANDLER_ATTRIBUTE, BEST_MATCHING_PATTERN_ATTRIBUTE, INTROSPECT_TYPE_LEVEL_MAPPING, LOOKUP_PATH, MATRIX_VARIABLES_ATTRIBUTE, PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE, PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE, URI_TEMPLATE_VARIABLES_ATTRIBUTE

    Fields inherited from interface org.springframework.core.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected FlowHandler
    Factory method that returns the default flow handler for the flow with the given id.
    Returns the registry of flows to query when this mapping is tested.
    Returns the configured flow url handler.
    protected Object
    getHandlerInternal(jakarta.servlet.http.HttpServletRequest request)
     
    protected void
    initServletContext(jakarta.servlet.ServletContext servletContext)
     
    void
    Sets the registry of flows to query when this mapping is tested.
    void
    Sets the flow URL handler, which allows customization for how the flow id is determined for each request tested by this mapping.

    Methods inherited from class org.springframework.web.servlet.handler.AbstractHandlerMapping

    adaptInterceptor, detectMappedInterceptors, extendInterceptors, formatMappingName, getAdaptedInterceptors, getCorsConfiguration, getCorsConfigurationSource, getCorsHandlerExecutionChain, getCorsProcessor, getDefaultHandler, getHandler, getHandlerExecutionChain, getMappedInterceptors, getOrder, getPathMatcher, getPatternParser, getUrlPathHelper, hasCorsConfigurationSource, initApplicationContext, initInterceptors, initLookupPath, setAlwaysUseFullPath, setBeanName, setCorsConfigurations, setCorsConfigurationSource, setCorsProcessor, setDefaultHandler, setInterceptors, setOrder, setPathMatcher, setPatternParser, setRemoveSemicolonContent, setUrlDecode, setUrlPathHelper, usesPathPatterns

    Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport

    getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, isContextRequired, setServletContext

    Methods inherited from class org.springframework.context.support.ApplicationObjectSupport

    getApplicationContext, getMessageSourceAccessor, obtainApplicationContext, requiredContextClass, setApplicationContext

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FlowHandlerMapping

      public FlowHandlerMapping()
  • Method Details

    • getFlowRegistry

      public FlowDefinitionRegistry getFlowRegistry()
      Returns the registry of flows to query when this mapping is tested.
      Returns:
      the flow definition registry
    • setFlowRegistry

      public void setFlowRegistry(FlowDefinitionRegistry flowRegistry)
      Sets the registry of flows to query when this mapping is tested. Optional. If not set, this handler mapping will look in the containing application context for a bean with id flowRegistry.
      Parameters:
      flowRegistry - the flow definition registry
    • getFlowUrlHandler

      public FlowUrlHandler getFlowUrlHandler()
      Returns the configured flow url handler.
    • setFlowUrlHandler

      public void setFlowUrlHandler(FlowUrlHandler flowUrlHandler)
      Sets the flow URL handler, which allows customization for how the flow id is determined for each request tested by this mapping. Defaults to a DefaultFlowUrlHandler.
      Parameters:
      flowUrlHandler - the flow URL handler
    • initServletContext

      protected void initServletContext(jakarta.servlet.ServletContext servletContext)
      Overrides:
      initServletContext in class org.springframework.web.context.support.WebApplicationObjectSupport
    • getHandlerInternal

      protected Object getHandlerInternal(jakarta.servlet.http.HttpServletRequest request) throws Exception
      Specified by:
      getHandlerInternal in class org.springframework.web.servlet.handler.AbstractHandlerMapping
      Throws:
      Exception
    • createDefaultFlowHandler

      protected FlowHandler createDefaultFlowHandler(String flowId)
      Factory method that returns the default flow handler for the flow with the given id. Subclasses may override to return their own custom default FlowHandler.
      Parameters:
      flowId - the id of the flow to handle invocation of
      Returns:
      the default flow handler