| ||
[Back to Index] | ||
Servlet reloading was introduced because, starting with TINI firmware 1.10, dynamic classloading became possible. In the Tynamo™ server, it is possible to turn this feature on or off, and even to exclude it from the web server binary. Some definitions are necessary:
Subject Menu
Building Reloading into the Binary
There are two build properties, Because a dynamically loaded class may reference any member from the Servlet API, it is necessary to include much more reflection information and some support classes. This has the effect of increasing the size of the binary by approximately 8k. Other than classloading speed, this is the only deterministic disadvantage of including reloading support in your server. [Top] Servlet ConfigurationAll 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. In other words, declare your servlets as normal in the servlets.props file. [Top] The Servlet Classpath
The reloading mechanism first looks for classes in the default and
user classpaths, and then in the paths specified by the
[Motivation: The user and default classpaths are specified with the '-classpath' and '-bootclasspath' options when starting a program with the 'java' command in Slush. For example (note that the line may be wrapped, but should be on one line):
In this case, /myclasses and /web/classes will be
searched first by the system classloader, and the paths specified in
In other words, don't use the '-classpath' option for your classes. Note that the Loader Servlet does not use this property, and has its own classpath mechanism. [Top] Servlet Reloading Internals You Need to Know About
Even with servlet reloading capabilities built into the binary, it is
still 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. [Top] The Loader ServletThe "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 [Top] SummaryIn summary, here are the things you need to do to take advantage of the Tynamo™ server's servlet reloading capabilities:
To take advantage of the Loader Servlet, follow these steps:
[Top] | ||
Tynamo™-TINI/1.0.4 Email: shawn@pobox.com © 2002-2006 Shawn Silverman |