Chapter 5. Application Engines and Services

Table of Contents

Application Servlet
Required Pages
Server-Side State
Stateful vs. Stateless
Engine Services
Logging
Private Assets

The application engine is a central object whose responsibility is to run the request cycle for each request. To do this, it manages resources such as page loaders and page recorders and provides services to the pages and components utilized during the request cycle.

Application engines are instantiated by the application's servlet (described in the next section). They are stored into the HttpSession and are persistent between request cycles.

An important behavior of the engine is to provide named engine services, which are used to create and respond to URLs. The application engine creates and manages the request cycle and provides robust default behavior for catching and reporting exceptions.

The application engine provides the page recorder objects used by the request cycle. By doing so, it sets the persistence strategy for the application as a whole. For example, applications which use or subclass SimpleEngine will use the simple method of storing persistent state: in memory. Such applications may still be distributed, since the page recorders will be serialized with the application engine (which is stored within the HttpSession).