Writing Your Own Servlets

The process of writing your own servlets for the Tynamo™ server does not change: you can retrieve an OutputStream or Writer and output data just as you have done before; cookies and session data can be stored; requests can be forwarded to, or included in, another servlet. In other words, write your servlets as normal. All servlet features are available to you.

Configuration is done via the servlet properties file.

You must be aware of a few features and restrictions, however. The restrictions are found here, and the extras are as follows:

  1. The com.qindesign.http.requestCount context attribute stores a one-element integer array containing the current request count.
  2. The com.qindesign.http.serverProps context attribute stores a Hashtable object from which you can access all of the webserver properties. They are read-only. For example, you can determine what the request timeout is, which port the server is listening to, and the minimum time between each GC.
  3. The com.qindesign.http.startTime context attribute stores a Long object indicating the time in milliseconds the server was started.
  4. This server supports the "Basic" and "Digest" authentication schemes of RFC 2617. In order to use this facility, extend com.qindesign.servlet.AuthenticatedHttpServlet instead of the usual javax.servlet.http.HttpServlet.

    Successfully authenticated requests are passed to the appropriate doXXX methods, and unauthorized requests are sent to similarly-named doUnauthorizedXXX methods.

    An example demonstrating how to use this feature can be found in the example servlets.