img
The javax.ser vlet.http Package
The javax.servlet.http package contains a number of interfaces and classes that are commonly
used by servlet developers. You will see that its functionality makes it easy to build servlets
that work with HTTP requests and responses.
The following table summarizes the core interfaces that are provided in this package:
Interface
Description
HttpSer vletRequest
Enables ser vlets to read data from an HTTP request.
HttpSer vletResponse
Enables ser vlets to write data to an HTTP response.
HttpSession
Allows session data to be read and written.
HttpSessionBindingListener
Informs an object that it is bound to or unbound from a session.
The following table summarizes the core classes that are provided in this package. The
most important of these is HttpServlet. Servlet developers typically extend this class in
order to process HTTP requests.
Class
Description
Cookie
Allows state information to be stored on a client machine.
HttpSer vlet
Provides methods to handle HTTP requests and responses.
HttpSessionEvent
Encapsulates a session-changed event.
HttpSessionBindingEvent
Indicates when a listener is bound to or unbound from a session
value, or that a session attribute changed.
The HttpSer vletRequest Interface
The HttpServletRequest interface enables a servlet to obtain information about a client
request. Several of its methods are shown in Table 31-5.
The HttpSer vletResponse Interface
The HttpServletResponse interface enables a servlet to formulate an HTTP response to a
client. Several constants are defined. These correspond to the different status codes that can
be assigned to an HTTP response. For example, SC_OK indicates that the HTTP request
succeeded, and SC_NOT_FOUND indicates that the requested resource is not available.
Several methods of this interface are summarized in Table 31-6.
The HttpSession Interface
The HttpSession interface enables a servlet to read and write the state information that is
associated with an HTTP session. Several of its methods are summarized in Table 31-7. All of
these methods throw an IllegalStateException if the session has already been invalidated.
Search WWH :
Custom Search
Previous Page
Java SE 6 Topic Index
Next Page
Java SE 6 Bookmarks
Home