Spring Web Flow
  1. Spring Web Flow
  2. SWF-158

Introduce Flow controller exception handling

    Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0
    • Fix Version/s: 2.0 M4
    • Component/s: Core: Flow Executor
    • Labels:
      None

      Description

      Currently there is no support in Spring Web Flow for handling exceptions that occur outside a Flow Execution (at the Flow executor level). Specifically these exceptions can occur launching new executions (NoSuchFlowDefinitionException) and restoring existing executions (NoSuchFlowExecution or BadlyFormattedFlowExecutionKeyException).

      This ticket should introduce generic code to handle these exceptions by taking an appropriate response action. Two response actions to be supported include routing to an error view and restarting the flow (if possible).

      Sam Brennan's SpringWebFlowExceptionResolver serves as the start of this work:

      SpringWebFlowExceptionResolver is a custom extension of org.springframework.web.servlet.handler.SimpleMappingExceptionResolver which resolves Spring Web Flow (SWF) exceptions by redirecting to the originating flow URL to launch a new flow. The list of exceptions that should be resolved is configurable and therefore not limited to exceptions from the SWF framework.

      1. SpringWebFlowExceptionResolver.java
        21 kB
        Sam Brannen
      2. SpringWebFlowExceptionResolver.java
        21 kB
        Sam Brannen
      3. SpringWebFlowExceptionResolver.java
        20 kB
        Sam Brannen
      4. SpringWebFlowExceptionResolver.java
        18 kB
        Sam Brannen
      5. SpringWebFlowExceptionResolver.java
        14 kB
        Sam Brannen

        Issue Links

          Activity

          Hide
          Sam Brannen added a comment -

          Thanks to Juergen's changes (see SPR-3402), version 1.13 of SpringWebFlowExceptionResolver is based on the latest version of SimpleMappingExceptionResolver from Spring Framework 2.0.5.

          The new functionality has been tested with the following nightly build:

          http://s3.amazonaws.com/static.springframework.org/SPR/spring-framework-2.0.5-with-dependencies-20070429-73.zip

          Show
          Sam Brannen added a comment - Thanks to Juergen's changes (see SPR-3402 ), version 1.13 of SpringWebFlowExceptionResolver is based on the latest version of SimpleMappingExceptionResolver from Spring Framework 2.0.5. The new functionality has been tested with the following nightly build: http://s3.amazonaws.com/static.springframework.org/SPR/spring-framework-2.0.5-with-dependencies-20070429-73.zip
          Hide
          Sam Brannen added a comment -

          Thanks to Juergen's changes (see SPR-3402), version 1.13 of SpringWebFlowExceptionResolver is based on the
          latest version of SimpleMappingExceptionResolver from Spring Framework 2.0.5.

          The new functionality has been tested with the following nightly build:

          http://s3.amazonaws.com/static.springframework.org/SPR/spring-framework-2.0.5-with-dependencies-20070429-73.zip

          As an added benefit of Juergen's added support for mappedHandlerClasses, it is no longer necessary
          to explicitly configure mappedHandlers when using version 1.13 of SpringWebFlowExceptionResolver,
          since SpringWebFlowExceptionResolver now configures the FlowController class as a default
          mappedHandlerClass. See getDefaultSwfMappedHandlerClasses() for details.

          Show
          Sam Brannen added a comment - Thanks to Juergen's changes (see SPR-3402 ), version 1.13 of SpringWebFlowExceptionResolver is based on the latest version of SimpleMappingExceptionResolver from Spring Framework 2.0.5. The new functionality has been tested with the following nightly build: http://s3.amazonaws.com/static.springframework.org/SPR/spring-framework-2.0.5-with-dependencies-20070429-73.zip As an added benefit of Juergen's added support for mappedHandlerClasses, it is no longer necessary to explicitly configure mappedHandlers when using version 1.13 of SpringWebFlowExceptionResolver, since SpringWebFlowExceptionResolver now configures the FlowController class as a default mappedHandlerClass. See getDefaultSwfMappedHandlerClasses() for details.
          Hide
          Begoña Hernández Esteve added a comment -

          hi Sam,
          I'm just wondering If now it's possible after NoSuchFlowExecutionException redirect to the start state of the flow
          (without defining th default flow id, because if my flowController controls more than one flows...)
          thanks!

          Show
          Begoña Hernández Esteve added a comment - hi Sam, I'm just wondering If now it's possible after NoSuchFlowExecutionException redirect to the start state of the flow (without defining th default flow id, because if my flowController controls more than one flows...) thanks!
          Hide
          Sam Brannen added a comment -

          Hi Begoña,

          > I'm just wondering If now it's possible after NoSuchFlowExecutionException
          > redirect to the start state of the flow (without defining th default flow
          > id, because if my flowController controls more than one flows...)

          We discussed this topic once on the forum here:

          http://forum.springframework.org/showpost.php?p=111251&postcount=33

          Here are the highlights:

          • If you cannot configure a defaultFlowId, it does not make sense to use the
            SpringWebFlowExceptionResolver.
          • A viable option is to use multiple FlowControllers, one configured for each
            flow with a specific path and corresponding defaultFlowId. Each of these
            FlowControllers could reference the same flowExecutor. Thus, you would
            essentially have one central repository (i.e., flowRegistry), but you would
            have multiple, unique entry points into the various flows. This would allow
            SpringWebFlowExceptionResolver to restart the correct flow based merely on
            the path and configured defaultFlowId per FlowController.

          Hope this helps!

          Sam

          Show
          Sam Brannen added a comment - Hi Begoña, > I'm just wondering If now it's possible after NoSuchFlowExecutionException > redirect to the start state of the flow (without defining th default flow > id, because if my flowController controls more than one flows...) We discussed this topic once on the forum here: http://forum.springframework.org/showpost.php?p=111251&postcount=33 Here are the highlights: If you cannot configure a defaultFlowId, it does not make sense to use the SpringWebFlowExceptionResolver. A viable option is to use multiple FlowControllers, one configured for each flow with a specific path and corresponding defaultFlowId. Each of these FlowControllers could reference the same flowExecutor. Thus, you would essentially have one central repository (i.e., flowRegistry), but you would have multiple, unique entry points into the various flows. This would allow SpringWebFlowExceptionResolver to restart the correct flow based merely on the path and configured defaultFlowId per FlowController. Hope this helps! Sam
          Hide
          Keith Donald added a comment -

          Introduced a capability to handle unhandled flow exceptions on a per flow basis in a custom manner, including displaying an error page with the option to start over.
          Introduced a capability to start a new instance of a flow that has expired or ended automatically.

          Show
          Keith Donald added a comment - Introduced a capability to handle unhandled flow exceptions on a per flow basis in a custom manner, including displaying an error page with the option to start over. Introduced a capability to start a new instance of a flow that has expired or ended automatically.

            People

            • Assignee:
              Keith Donald
              Reporter:
              Sam Brannen
            • Votes:
              7 Vote for this issue
              Watchers:
              15 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development