|[Back to Index]|
Servlet reloading is built into Tynamo™. It is possible to turn this feature on or off.
Some definitions are necessary:
All servlets, including dynamically loaded servlets not loaded by the special Loader Servlet, must be specified in your servlet configuration file. The server cannot find your servlet if it is not declared here.
The Servlet Classpath
The reloading mechanism first looks for classes in the default and
user classpaths, and then in the paths specified by the
It may possible to specify a user classpath by providing a '-classpath' argument. For example (EJC platform) (note that the line may be wrapped, but should be on one line):
Note that the Loader Servlet does not use this property, and has its own classpath mechanism.
Servlet Reloading Internals You Need to Know About
It is possible to turn this feature off with the
Second, there is a property called
To quote from Section 3.3.4 of the servlet 2.2 specification, "End of Service":
Third, if a servlet was dynamically loaded and its classfile disappears, then the container will reuse the one it has already loaded. If this is undesirable behaviour, please let us know.
The Loader Servlet
The "Loader Servlet" is a special servlet included with the distribution that can load servlets, given only the classname. It searches the path specified by an initialization parameter. For example:
Loader.mapping=/servlet/Loader/* Loader.class=com.qindesign.servlet.LoaderServlet Loader.initParams=classpath=/web/servlet/classes
For the above specification, the servlet will search the default and user classpaths, and then /web/servlet/classes for a given classname. Notice how the search classpath is specified. It is a servlet initialization parameter named "classpath".
Further details about the "
[Motivation: The Path Info specifies the classname of the servlet to load, and any parameters are passed to the servlet as normal. This is the motivation for using the Path Info for the servlet. It allows the parameters to be passed untouched.
For example, if we use the above mapping, this request (note that the line may be wrapped, but should be on one line):
will call the
Lastly, for each requested servlet, a new instance is always created,
and the servlet goes through its entire lifecycle, from
In summary, here are the things you need to do to take advantage of Tynamo™'s servlet reloading capabilities:
To take advantage of the Loader Servlet, follow these steps:
© 2002-2004 Shawn Silverman