title: Use Spring Web Flow without state on the server
body: <p>I'm reading the Spring Web Flow chapter in the book Pro Spring MVC. Unfortunately there's no explicit information, where the state during a flow execution is persisted. I assume it is saved in the JVM Heap and associated with the session.</p>
  
  <p>Now HTTP is a stateless protocol (REST...) and I'd like to use Spring Web Flow without saving state on the server (besides the one and only state that a session might be authenticated).</p>
  
  <p>One strategy is to send all parameters of the entire flow with every HTTP request of the flow (hidden input) and thus accumulating all necessary parameters until the flow has finished.</p>
  
  <p>The overhead of re-validating parameters can be avoided with signatures over already validated parameters.</p>
  
  <p>Do you know, whether it might be possible to use Spring Web Flow in this way? Has anybody already done this?</p>
  
  <p><strong>Update:</strong> Why?</p>
  
  <p>Persisting state is not only a violation of the principles of HTTP as a stateless protocol but has practical problems too:</p>
  
  <ul>
  <li>If the user browses with multiple browser tabs then this can lead to inconsistent state, race conditions or data loss.</li>
  <li>Storing state on the server makes load balancing over several servers more complicate.</li>
  <li>Testing and debugging becomes more complicate, because requests can not be tested or analyzed in isolation but only in the context of previous requests.</li>
  <li>Cookies must be enabled to correlate servers sessions to requests.</li>
  <li>The server needs to synchronize access to the server-side state.</li>
  <li>The url of a request that also depends on server state does not contain all information necessary to bookmark the state inside a flow or to make sense of it in a bug report.</li>
  </ul>
  
  <p>I've not yet looked at the details of Web Flow but I'm confident that one could have the same programming experience and still keep all information in the request parameters.</p>
  
  <p><strong>Update:</strong> I've now learned that my requested style of flow handling has a name: <a href="http://en.wikipedia.org/wiki/Continuation#In_Web_development" rel="nofollow">Continuations</a>. The term continuation is more common in functional programming but it's apparently not uncommon to adapt the idea to HTTP interactions.</p>