All entries for Friday 26 August 2005

August 26, 2005

Spring web flow

Writing about web page

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.

Checkboxes + spring: howto

Writing about web page

So in viewing the spring forums, I keep seeing the same question coming up, how to manage subsets (i.e. checkboxes) in spring. This is my answer: link

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



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
  • 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

Not signed in
Sign in

Powered by BlogBuilder