August 26, 2005

Spring web flow

Writing about web page http://forum.springframework.org/viewtopic.php?t=8324

So I have been using spring web flow on my current project (thanks to Dave Hewitt ;)), and I gotta say, it really is nice.

It isn't a public release yet, so there are still teething problems, and the APIs do change (always um, interesting :)).

Basically, as the name suggests, it introduces the concept of a "flow". Typically, in web apps you have the concept of a request, a session or an application. There is no concept of a "process" scope. If, in typical web usage, your users do one or more "processes" within a single browser, then what can you do? You do not want to store information in the session (too large) or in the request (too small), so you are stuffed. Enter "flow scope".

Basically web flow allows you to model "flows" (hence the name obviously :)). Each flow has an xml document (or can be built in java) consisting of one or more actions, each action leads to a transition depending on the result of that action. Each transition can be another action, a sub flow (excellent concept) or a view. The view has transitions and so on until event you hit an end-state.

Implementation of processes or workflow within web apps is usually artificially demarcated around page renderings. This is because most MVC infrastructure is demarcated by the V, the view. With webflow there is no such restriction. For example, you could have a flow with 0 or multiple page views within that flow.

So how is data stored, well in the "flow" scope scope of course ;). I can already hear you saying so it is just clever session management, but no, it isn't :) Webflow being spring is architected to let you replace which ever bits you want, and there are multiple implementations of FlowExcecutionStorage, session backed, db backed or client side (through serialization). I am currenly using clientSide so there is no session state whatsoever ;) When I need to store really big objects (i.e. file uploads) then I just write a listener which dumps out the big objects to secondary storage when dehydrating the flow scope, and restores them when rehydrating :) And as mentioned, because of Spring's excellent architecture, this is all transparent.

Why did I start of with talking about flow storage instead of the workflow aspects? Because there are so many projects that are tripping over themselves because they don't want to use storage, but request scope isn't enough. SWF is a perfect fit even if the actually process, or workflow they are modelling isn't complicated. SWF provides you with native support for "flow scope". This in itself is a huge win :)

Take a typical request; user fills in a form and can upload 1 or more files. How do you cope with this? You could temporarily persist in secondary storage (file, DB) some representation of the user's results, or you can stick the object in the session. Sessions are not ideal for many reasons (timeout, memory constraints, replication etc.). SWF is a perfect solution for this.


- 5 comments by 1 or more people Not publicly viewable

  1. Egor Margineanu

    Nice article Colin.

    02 Oct 2005, 09:34

  2. Hey, I'm famous :) link

    03 Oct 2005, 12:19

  3. hendra

    Yess, You are famous … Keep the good job

    04 Dec 2005, 06:29

  4. Bhushan

    Hi Colin ,

    I am new to Spring but i know Struts well .

    I wanted to know that how ease,it is to implement workflow (e.g TroubleTicket Workflow) with Spring Webflow? . Do you have any suggestion for using any other workflow engine with spring?

    03 Mar 2006, 07:22

  5. Bhushan,

    Spring Web Flow isn't really a rules engine as such, it is for complex page navigation (thing complex wizards). It is very flexible however, and may do what you want.

    If you have lots of complex pages it is for you, if you have a small number of pages that all do really complex processes then it probably isn't :)

    04 Mar 2006, 17:24


Add a comment

You are not allowed to comment on this entry as it has restricted commenting permissions.

August 2005

Mo Tu We Th Fr Sa Su
Jul |  Today  | Sep
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31            

Search this blog

Tags

Galleries

Most recent comments

  • Interesting… While I'm not completely convinced in such microbenchmarks, I'm pretty sure that 1ms … by Alexander Snaps on this entry
  • Hello. I bought the book yesterday. I was trying to find the source code for chapter 11 and chapter … by Suleman on this entry
  • http://woosight.net/account/login?username=demo by live mashup demo on this entry
  • Thanks mate ….. This blog was really helpful. by Maaz Hurzuk on this entry
  • Ty. Not directly helpful for my problem, but pointed me in the right direction. You will also get th… by Mike E. on this entry

Blog archive

Loading…
Not signed in
Sign in

Powered by BlogBuilder
© MMXXI