0

My company has an application developed using Spring WebFlow 2.4.0. The flow is an application process, and the application object is in FlowScope.

When the HTTP session times out, I would like to access that application object, make a few modifications to it, and persist it to a our database. My problem is that I can't seem to find a hook that would let me access FlowScope on HTTP session timeout.

We have an HttpSessionListener defined, which can get me access to the session. Since webflow keeps it's data in the session, it seems likely that there is a way to access FlowScope from an HttpSession object? Is that true, and if so:

  1. How?
  2. Is it OK to do this? Kid-tested mother-approved?

Note: I did try using a FlowExecutionListener's sessionEnding hook, hoping that on HttpSession destroy, webflow would gracefully close and end the flow-session, but that doesn't appear to be the case.

Any tips or guidance would be much appreciated! Apologies in advance if this is a silly question. I am by no means a webflow expert. :)

KFox112
  • 452
  • 4
  • 11

1 Answers1

0

Did you try using/calling the RequestContextHolder.getRequestContext() in your HttpSessionListener logic?

see

How can I access Spring Webflow FlowScope elements outside the flow?

Community
  • 1
  • 1
Selwyn
  • 3,118
  • 1
  • 26
  • 33
  • Thank you for your response! I didn't originally try this, but at your suggestion, gave it a whirl. Unfortunately, it appears that RequestContextHolder.getRequestContext() expects the current thread to have started as part of a request, which isn't the case in an HttpSessionListener. :( When I try using this method, my RequestContext comes back as null. – KFox112 Aug 03 '15 at 20:24
  • @KFox112 Maybe you should explicitly fire an ApplicationEvent and listen for it? See this solution http://stackoverflow.com/questions/19794115/how-i-can-get-session-object-from-applicationlistener-method/19795352#19795352 – Selwyn Aug 06 '15 at 08:27