Chapter 11. Managing Application State

 

This chapter covers

  • Building an enhanced Comet service
  • Working with the GWT history system
  • Using standard servlet state

Everything is in a state of flux, including the status quo.

Robert Byrne

In this chapter we’re going to examine an example application we call “State of the Union.” This application demonstrates state management in a long-lived fashion, using log files to capture state on the server with the standard Java Servlet API. This will be done in the context of a GWT application, and within the GWT history system we introduced in chapter 1.

We’ll cover using the History class to update the client state as the model changes, as well as deal with state on the server, representing state in the client, and exploring the possible cases where handling user actions is important. Before we get there, though, we’ll take a look at implementing a publisher-subscriber messaging system on the server, and at using XML as a non-RPC data representation. All the while, we’ll emphasize the placement of these techniques in the context of an MVC pattern on the client.

11.1. Overview of the sample application

11.2. Creating a basic messaging service

11.3. Handling messages on the client and server

11.4. Recording and playing back conversations

11.5. Dealing with state on the server side

11.6. Adding a UI and cleaning up

11.7. Summary