Announcement Announcement Module
Collapse
No announcement yet.
handling end states Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • handling end states

    Question1

    Does a redirect in the endstate still have the flow contents? meaning, I have a flow with 3 states, just wanted to confirm if the last state had a redirect to the success page. Will the success page gain access to flow contents during its previous states?

    Question2

    Applicable if there is no answer to question1, when the end state is reached and I display a success page with links to 3 new flows, user clicks one of the flows and clicks back, currently I am getting a flow execution execption, cannot go back to flow which has ended. Is there a graceful way of handling such scenarios?

    Thanks
    Srini

  • #2
    Originally posted by srini_ge
    Question1

    Does a redirect in the endstate still have the flow contents? meaning, I have a flow with 3 states, just wanted to confirm if the last state had a redirect to the success page. Will the success page gain access to flow contents during its previous states?
    The *redirect* view definately have access to flowScope however if the redirect view is an end state, after the redirect view has been processed the flow will end. By the time the success page gets a go it is all over..the flow has ended.

    I typically have my redirect URL contain the important values in the URL, i.e. if I have added a new user then the redirect will be "users/details.htm?userId=123" etc.

    Question2

    Applicable if there is no answer to question1, when the end state is reached and I display a success page with links to 3 new flows, user clicks one of the flows and clicks back, currently I am getting a flow execution execption, cannot go back to flow which has ended. Is there a graceful way of handling such scenarios?

    Thanks
    Srini
    As mentioned, when an end-state is reached, the flow is finished and disgarded. When the user clicks "back" they are trying to visit the end state of a flow that no longer exists.

    In my experience most end-states display a "well done, you have done this operation" and therefore either do not need any state, or only require state which can be passed in via the redirect.

    I know Keith has added support for various redirect views in SWF so you might want to check out the reference manual for more info: http://static.springframework.org/sp...nce/index.html

    Comment


    • #3
      Firstly, thanks for the reply.

      Please let me know how to have a disabled back on browser for such scenarios

      Comment


      • #4
        Unfortunately you cannot easily disable the browser back button.

        Or at least not that I know of...maybe google?

        Comment


        • #5
          BACK is a mystery till date..

          I am in big trouble with this end state back scenarios...

          Comment


          • #6
            What are your requirements? So you're going back and getting a NoSuchFlowExecutionException? Have you tried catching that exception and routing to an error page? Do you need more than that?

            Keith

            Comment


            • #7
              it aint a NoSuchFlowException, when Im done with a flow [end state reached], I display a success page with 3 links [3 new flows], suppose the user choses link1 , he is routed to flow1, when the user realizes thatz a mistake, the user tries to go back, since the previous screen was an end state, there is an exception Flowexpired and hence the page would not show up. I am currently using an error page which describes an appropriate message for Error 500
              Hope you got my problem

              If you think there is a workaround for this scenario, please let me know

              Thanks

              Comment


              • #8
                Well there aint no FlowExpiredException :-)

                What exception is being thrown exactly? I would expect it to be NoSuchFlowExecutionException and I bet you a buck that's what it is. :-)

                What back behavior would you want to see? Please be more specific about about what behavior you're after.

                Keith
                Last edited by Keith Donald; Jul 23rd, 2006, 12:02 PM.

                Comment


                • #9
                  Okay, herez my requirement

                  Lets say I am in an end state,
                  where I show the jsp information "your photo order is processed, thank you for your business" and to this page I put 3 links mentioned below.
                  a) Share this photo album with others.
                  b) Place a repeat order.
                  c) Cancel this order.
                  [not a very good example, but still describes my requirement]
                  All these 3 links are new flows.

                  User clicks on link a) by mistake...realizes his mistake and clicks on back, so that he can click link c).

                  This is what the users sees on the back page

                  Error 500: Request processing failed; nested exception is org.springframework.webflow.execution.repository.N oSuchConversationException: No conversation could be found with id 'AF93BE66-FF8C-5303-F233-278F9EB9F593' -- perhaps this executing flow has ended or expired? This could happen if your users are relying on browser history (typically via the back button) that reference ended flows.

                  Logically speaking, I would still have to show the snapshot of the previous end-state.

                  Technically speaking, I can only avoid this error screen by trapping Error code 500.

                  Keith - I am sure this is a known challenge, let me know if there is any solution.

                  Comment


                  • #10
                    this is because the page you are displaying is generated as the result of a submission to the server, i.e. a POST. When you click back the browser will display the standard "Are you sure you want to resubmit this data...." etc. When you say yes you are submitting the data to a flow which has now ended.

                    You can get around this by having your end state be a redirect to the "well done" page because clicking back to a page which was served as GET will be loaded via the browser cache (subject to your not explicitly excluding it...), but as your initial post implied, the redirected to page does not have access to the flow scope.....because the flow has since expired.

                    Most people workaround this by using the so called "redirect after POST" pattern.

                    Comment


                    • #11
                      yes, I agree with you, I am fully aware of this scenario, I was trying to explain the scenario to Keith....Im gonna try your recommendation, I see a solution there.
                      Thanks

                      Comment


                      • #12
                        In your flow that ends, in the end-state you can redirect to another URL that triggers display of the success page. This page could be a simple stateless controller mapped to an independent URL, and always refreshable. You can pass parameters through the redirect.

                        It is not possible to refresh a flow execution that has ended. When it has ended, it's done. In the future we'll want to make it easy (perhaps default behavior) to restart a new independent flow execution when the user backs up into a URL referencing one that has ended--for now the easiest option is to simply display an error page. This is what I was probing for some feedback on.

                        Another option may be not to make this an end-state but a view-state with transitions that spawn subflows.

                        If you were using 1.0 RC3 the exception would've been a NoSuchFlowExecutionException wrapping a NoSuchConversationException. I'd recommend upgrading to the latest RC.

                        Keith

                        Comment


                        • #13
                          Keith, your recommendation is crystal clear

                          The situation I have, is to pass entire flowscope to the redirect.

                          <end-state id="finish" view="redirect:/success.htm?CustomerForm=${flowScope.CustomerForm} "/>

                          CustomerForm is an object that has more than 20 member variables, and I am not sure if I can pass an object this way

                          How can I pass all flowscope objects into success.htm mentioned in the above case?

                          Thanks
                          Srini

                          Comment


                          • #14
                            Originally posted by srini_ge
                            <end-state id="finish" view="redirect:/success.htm?CustomerForm=${flowScope.CustomerForm} "/>

                            CustomerForm is an object that has more than 20 member variables, and I am not sure if I can pass an object this way
                            The easiest thing is to simply pass the id and then have the success page controller reload it, i.e.
                            Code:
                            redirect:/success.htm?customerId=${flowScope.customerForm.id}

                            Comment


                            • #15
                              Feature proposal: SpringWebFlowExceptionResolver (part 1)

                              Hi Keith,

                              Originally posted by Keith Donald
                              It is not possible to refresh a flow execution that has ended. When it has ended, it's done. In the future we'll want to make it easy (perhaps default behavior) to restart a new independent flow execution when the user backs up into a URL referencing one that has ended--for now the easiest option is to simply display an error page. This is what I was probing for some feedback on.
                              Based on code Rob Moore once posted to the forum, I put together a nice ExceptionResolver that I am using. I think it's a good start for what you're proposing to add to the SWF core. Of course, as I mention in the JavaDoc, it would be best to add pluggable strategies for varying repository implementations. Perhaps you would consider building this into SWF.

                              Due to length restrictions, I'm posting the code in "part 2".

                              Here's an example of how I configure it in my applicationContext.xml:

                              Code:
                              <bean id="globalExceptionResolver" class="com.xyz.spring.web.servlet.handler.SpringWebFlowExceptionResolver">
                              	<property name="order" value="100" />
                              	<property name="supportedSwfExceptions">
                              		<list>
                              			<value>org.springframework.webflow.execution.NoSuchFlowDefinitionException</value>
                              			<value>org.springframework.webflow.execution.repository.NoSuchFlowExecutionException</value>
                              			<value>org.springframework.webflow.execution.repository.conversation.NoSuchConversationException</value>
                              			<value>org.springframework.webflow.executor.support.FlowExecutorArgumentExtractionException</value>
                              		</list>
                              	</property>
                              	<property name="defaultErrorView" value="error/generalError" />
                              	<property name="exceptionMappings">
                              		<props>
                              			<prop key="org.acegisecurity.AccessDeniedException">error/accessDenied</prop>
                              			<!-- etc. ... -->
                              		</props>
                              	</property>
                              </bean>
                              If you'd like, I could open a Jira issue. Just let me know.

                              regards,

                              Sam
                              Last edited by Sam Brannen; Jul 24th, 2006, 09:16 AM.

                              Comment

                              Working...
                              X