vqServer Java servlets
Java servlets are a way to add extra functions and capabilities to web servers. They are an alternative to CGI scripts. However, servlets are more efficient and more powerful than CGI scripts. vqServer is a very efficient host for Java servlets because it is itself a Java application. Servlets run on the server (as opposed to Java applets which run in a browser). They are written in Java and conform to the servlet specification published by and available from JavaSoft. For more information about servlets, including more very good reasons why you should use them, please see the JavaSoft site. vqServer implements version 2.0 of JavaSoft's servlet specification and API (but see API notes below. |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Sample servletsThree sample servlets are included with vqServer:
|
![]() ![]() ![]() ![]() ![]() |
Internal servletsSome of vqServer's functions are provided by special internal servlets which have access to the inner workings of vqServer. These are:
The vq.server.userxxx servlets are discussed on the special security features page. |
![]() ![]() ![]() ![]() ![]() |
Calling servlets and servlet aliasesThere are three ways to invoke servlets:
In all three cases, vqServer expects servlets to be specified by their alias (see the aliases page for more information about aliases):
Note that aliases always begins with /. By convention, servlet aliases begin with /servlet/, although they can in fact be anything you like. vqServer expects the real name resulting from the translation of a servlet's alias to match servletdir/package.classname (see the aliases page for information about alias translation). Note:
vqServer can also load servlets and their associated resources from .JAR or .ZIP archives. If a servlet is in a .JAR archive the real name resulting from the translation of its alias should match archivedir/archivename.jar/classname. Servlet class files cannot be in subdirectories within .JAR or .ZIP files unless the subdirectories represent package names. |
![]() ![]() ![]() ![]() ![]() |
Servlet initialisation parametersYou can specify initialisation parameters for a servlet by clicking on Aliases in the control centre menu and then clicking on the icon in the parameters column next to the corresponding alias (see Alias parameters). You may want to create an alias specifically for each servlet for which you need to provide initialisation parameters. The data vqServer returns to servlets in response to the getParameterNames() and getParameter() methods of the ServletConfig interface is that which is in force at the time the method is invoked, not that which was in force when the servlet is initialised and can therefore change during the life of the servlet instance. Modifying and reloading servletsvqServer checks each servlet's .class file before calling the servlet. If the .class file has changed since the servlet was last called vqServer calls the servlet's destroy() method and reloads and re-initialises the servlet. You can force vqServer to call the destroy() method and unload all active servlets by clicking Other in the control centre menu and then clicking Stop all servlets. |
![]() ![]() ![]() ![]() ![]() |
Classes and instancesYou can have more than one instance of the same servlet, each with different initialisation parameters, by using different aliases which correspond to the same servlet class (in the same directory). Different instances of the same servlet share static class data. However the static class data of other classes (including other servlet classes) to which a servlet might refer is not shared by different servlets (unless the class referred to is on the system CLASSPATH). In other words, each servlet exists within its own namespace. |
![]() ![]() ![]() ![]() ![]() |
Security considerationsvqServer doesn't impose any restrictions whatsoever on servlet activity. For example servlets can read, write and delete any file on your computer. So make sure that any servlets you deploy on your web site come from a reputable source or are thoroughly debugged. |
![]() ![]() ![]() ![]() ![]() |
API notesServlet writers should note the following concerning the vqServer implementation of the JavaSoft servlet API:
vqServer version 1.06. Copyright © 1997-98 vqSoft and Steve Shering. Last updated 7 November 1998. |
![]() ![]() ![]() ![]() ![]() |