Servlet API User's Guide
Powered by Java

Version 1.2
WebSite.Servlet API Reference
Back to servlets overview

How the API is Organized

The WebSite Java API is organized and documented using the same style and conventions as the JDK 1.1 API. For generic information on how to use this documentation, see the JDK 1.1 API User's Guide. This package requires the JDK 1.1, as it uses the Java Native Interface, and inner classes.

Narrative Description of Classes

The WebSite Java Servlet framework consists of 10 public classes. All but two of the classes are static; they cannot be instantiated. The exceptions are (1) the FormFile class (objects of this type hold the filespecs and attributes of uploaded files), and (2) the Cookie class, which is used to represent cookies in requests and responses.

The Servlet class is an abstract class that defines the run() method, which you must implement as your program's entry point. It also contains the linkage between your Java servlet and the WebSite WSAPI interface, in conjunction with the private Startup class. The Startup class is private to the framework, you never see it and cannot use anything in it.

The Server class contains information about the local server and a collection of server-supported utilitiy methods. The server-related data doesn't change from request to request, except for the local server's host name, which may change if the server is multi-homed.

The Client class contains information about the client (browser) that submitted the request. This includes such information as the IP address of the client, the product and version of the client software, and other items.

The Request class encapsulates all of the information about the HTTP request itself, except form data. This includes the method, extra headers, URL, and many other items. If the request is a POST accompanied by form data, the Form class provides you with access to the data in the form. WebSite Pro's form decoder and the framework completely hide the details of form structure and encoding. You deal with form fields by their name as specified by the name parameters in the HTML that defines the form. If the form contains one or more TYPE=FILE fields, corresponding to uploaded files, the Form object's file-specific methods allow you to retrieve the files and their attributes. They are represented as FormFile objects.

The Response class contains methods for returning the response back to the client. The most often used method is Response.println(), which sends lines of text back to the client. Note that WebSite Pro's buffered interface and memory-mapped network I/O assure the highest level of efficiency even if you call Response.println() with many small strings. Other methods permit sending arbitrary HTTP response messages such as redirection, authentication and no-op.

The Cookie class is used to represent state management cookies throughout this package. Both request and response cookies are represented by instances of the Cookie class. The Cookie class supports both the functionality described in the Netscape Cookie Specification and the newer standards-track RFC 2109 State Management cookies. Note: you need not manually handle cookies for most of your state management needs. Check out the Session class.

The Session class implements an automatic means for tracking a particular user (actually a particular browser) across multiple HTTP requests. It provides you with a way to associate any Java object with a series of HTTP requests to your servlet. The Session class uses cookies to manage state information, however you need not be concerned with the details of cookie use.

Copyright © 1994-97 O'Reilly & Associates, Inc. All Rights Reserved. O'Reilly Software Online, WebSite Central, WebSite, and WebSite Professional are trademarks of O'Reilly & Associates, Inc.

Java and other Java-based names are trademarks of Sun Microsystems, Inc., and refer to Sun's family of Java-branded technologies.

All other names are the trademarks of their respective companies.