Results 1 to 8 of 8

Thread: HttpSession handling

  1. #1
    Join Date
    Nov 2004
    Location
    Düsseldorf, Germany
    Posts
    62

    Default HttpSession handling

    The HTTPsession handling of SWF is not very clear to me. May be you can comment on the following statements:
    • - a httpsession is created latest when a flow is started
      - if a flow reaches the end status is the httpSession invalidated or is the flow stuff simply removed from the httpSession (depending on who created the httpsession?)?
      - if I use httpSessionContinuationStorage the flow stuff is not removed from httpSession in the end status, or? Instead the ExpiredFLowCleanupFilter is used to determine unused flows and remove them.
      - how can I influence the HttpSession after a flow has ended? E.g. think of a Registration wizard which auto login a user at the end (which requires the authentication information in the session), or a immediate invalidate of the session. I would expect to use a FLowExecutionListener but it is very clear stated in the docs that the parameters are not linked against the httpRequest or the httpSession.

    Would be great to get clarifications on these ones.
    Thanks,
    Markus

  2. #2
    Join Date
    Aug 2004
    Location
    Melbourne, FL
    Posts
    2,794

    Default

    This is a repost from another topic, but it should answer most of your questions:

    If an exception is thrown up the stack and caught by the dispatcher servlet and routed to a error page, the flow execution by default will continue to sit around in the session until the session expires; that is, if you are choosing to persist your flows in the session. The same applies if I start a flow and then go to the bathroom and don't come back for awhile.

    With that said, there is a ExpiredFlowCleanupFilter you can install that will automatically detect and cleanup expired/abandoned flows. See the web.xml file of the ItemList sample, which illustrates this.

    Also, if you're using a client-continuation based flow execution storage strategy, no cleanup is neccessary as there is no session state.

    On the other hand, If you're using a http session continuation based flow execution storage strategy (sellitem does this by default), a new copy of the flow execution is created and stored in the session on each flow request. This is the most expensive strategy in terms of storage, but the most flexible with regards to state restoration (e.g allowing proper back button use--as you can restore the flow at any point from a unique, cached flowExecutionId in local history.)

    So of the three flow execution storage strategies, the default "session" requires some storage, but not as much as the "continuations-based session" strategy. In those cases, the ExpiredFlowCleanupFilter can help for abandonded/errored out flows, as normal flows that reach a end state will always be cleaned up automatically. The client strategy requires no session state at all, but has some other tradeoffs (e.g security issues, limitations with GET
    Keith Donald
    Core Spring Development Team

  3. #3
    Join Date
    Nov 2004
    Location
    Düsseldorf, Germany
    Posts
    62

    Default

    hi keith,
    thanks so far but the most important point for me is still open: How to communicate from the flow to the rest of the application. See the register wizard example. Is this possible. I think this functionality would be quite equal to the ParameterizableFlowAttributeMapper but it maps back to HTTPSession instead of a FlowSession.

  4. #4
    Join Date
    Aug 2004
    Location
    Melbourne, FL
    Posts
    2,794

    Default

    Markus,

    I'd use the FlowExecutionListener -- just grab the HttpSession there in your flowEnded callback. You can do it like this:

    ((HttpServletRequestEvent)context.getOriginatingEv ent()).getRequest.getSession()
    Keith Donald
    Core Spring Development Team

  5. #5
    Join Date
    Nov 2004
    Location
    Düsseldorf, Germany
    Posts
    62

    Default

    That forced me to add listener support to the struts adapter. It's a simple one (questionable if the effort adding this to jiira is worth the work ;-)):

    See SPR-902 in jiira.

  6. #6

    Default


    With that said, there is a ExpiredFlowCleanupFilter you can install that will automatically detect and cleanup expired/abandoned flows.

    Ho do you do that in Webflow 2?

  7. #7
    Join Date
    Aug 2006
    Location
    Brooklyn
    Posts
    556

    Default

    I'm not aware of anything to that extent but you can control the number of concurrent flow executions through attributes on the flow-execution-repository element in the Web Flow 2 configuration namespace.

  8. #8

    Default

    I'm aware of that ( <webflow:flow-execution-repository max-executions="1" max-execution-snapshots="0"/>, for example ) but I needed some processing to be done on conversation expiry.

Similar Threads

  1. Custom HttpSession implementations
    By maward in forum Web
    Replies: 12
    Last Post: Dec 3rd, 2008, 07:29 AM
  2. Replies: 2
    Last Post: Oct 13th, 2005, 02:47 PM
  3. Replies: 8
    Last Post: Jul 28th, 2005, 10:42 AM
  4. Replies: 1
    Last Post: Apr 15th, 2005, 06:19 AM
  5. Replies: 2
    Last Post: Jan 16th, 2005, 01:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •