Table of Contents
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).
Every Tapestry application has a single servlet, which acts as a bridge between the servlet container and the application engine. The application servlet is a subclass of ApplicationServlet.
The subclass provides the framework with the path to the application specification by implementing the method getApplicationSpecificationPath().
The servlet's main job is to find or create the IEngine instance. It then delegates all the behavior for processing the request to the application engine. Encoded in the URL will be a particular application service; the engine delegates to the service to perform the real work of handling the request.
The servlet may also perform some static initialization for the application in its init() method. This includes tasks such as loading JDBC drivers.