The application servlet is a "bridge" between the servlet container and the application engine. Its job is simply to create (on the first request) or locate (on subsequent requests) the application engine.
All Tapestry applications use the same servlet class, however its configuration is different. Part of the configuration is to identify the location of the application specification which is like a master index of all the pages in the application.
The tutorial is a rare case; it is a single WAR that contains multiple Tapestry applications. This isn't a problem ... each Tapestry application has its own servlet and has its own configuration. The following figure shows the deployment descriptor for the Tapestry Tutorial (but excludes the additional sections for the other applications within the WAR).
Figure 3.1. Tutorial Deployment Descriptor (partial)
<?xml version="1.0"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd"> <web-app> <display-name>Tapestry Tutorial</display-name> <servlet> <servlet-name>hello</servlet-name> <servlet-class>org.apache.tapestry.ApplicationServlet</servlet-class> <init-param> <param-name>org.apache.tapestry.application-specification</param-name> <param-value>/tutorial/hello/HelloWorld.application</param-value> </init-param> <load-on-startup>0</load-on-startup> </servlet> <servlet-mapping> <servlet-name>hello</servlet-name> <url-pattern>/hello</url-pattern> </servlet-mapping> <session-config> <session-timeout>15</session-timeout> </session-config> <welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-file-list> </web-app> |