Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
HydraExpress Servlet Development Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

2.3 Servlets

Each servlet focuses only on the specific content that it creates. Because servlets contain mostly application logic, there is no single way to summarize servlets. This section presents a general overview of the interaction between a servlet and the servlet container. For details on servlet programming, see the focused topics and example programs in Part III. For instructions on deploying and configuring servlets, see Chapter 4, "Configuring Objects in the Servlet Container."

2.3.1 Request and Response

Although the basic concepts behind servlets are protocol-independent, servlets are optimized to work with request/response protocols, such as HTTP. HTTP is a simple protocol. A client sends a request to a server and the server sends a response back to the client. The HTTP protocol is stateless, that is, the protocol treats each request and response independently. The protocol does not associate a given request with previous requests from the client or responses from the server.

The servlet container represents these concepts directly. Each time a client sends a request to a servlet, the container provides the servlet with a request object and a response object. The request object encapsulates the request from the client. The response object provides a suite of functions for creating a response.

2.3.2 Maintaining State

Although HTTP itself is stateless, the servlet container uses a simple strategy to manage state between requests. A servlet can store arbitrary data in a container-provided object called a session. The servlet container associates a unique ID with the session and returns the ID to the client. When another request arrives from the same client, the servlet container uses the unique ID to attach the session to the request. A servlet can maintain state with little effort, since the servlet container handles the mechanics.



Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved. All Rights Reserved. Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. HydraExpress is a trademark of Rogue Wave Software, Inc. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.