Links a servlet container with a Tapestry application. The servlet has some responsibilities related to bootstrapping the application (in terms of logging, reading the {@link ApplicationSpecification specification}, etc.). It is also responsible for creating or locating the {@link IEngine} and delegatingincoming requests to it.
The servlet init parameter org.apache.tapestry.specification-path
should be set to the complete resource path (within the classpath) to the application specification, i.e., /com/foo/bar/MyApp.application
.
In some servlet containers (notably WebLogic) it is necessary to invoke {@link HttpSession#setAttribute(String,Object)}in order to force a persistent value to be replicated to the other servers in the cluster. Tapestry applications usually only have a single persistent value, the {@link IEngine engine}. For persistence to work in such an environment, the JVM system property org.apache.tapestry.store-engine
must be set to true
. This will force the application servlet to restore the engine into the {@link HttpSession} at theend of each request cycle.
As of release 1.0.1, it is no longer necessary for a {@link HttpSession}to be created on the first request cycle. Instead, the HttpSession is created as needed by the {@link IEngine} ... that is, when a visit object is created,or when persistent page state is required. Otherwise, for sessionless requests, an {@link IEngine} from a {@link Pool} is used. Additional work must be doneso that the {@link IEngine} can change locale without forcing the creation of a session; this involves the servlet and the engine storing locale information in a {@link Cookie}.
@version $Id: ApplicationServlet.java 244163 2005-03-17 05:18:32Z pferraro $
@author Howard Lewis Ship