img
Method
Description
void sendError(int c)
Sends the error code c to the client.
throws IOException
void sendError(int c, String s)
Sends the error code c and message s to the client.
throws IOException
void sendRedirect(String url)
Redirects the client to url.
throws IOException
void setDateHeader(String field, long msec)
Adds field to the header with date value equal to msec
(milliseconds since midnight, Januar y 1, 1970, GMT).
void setHeader(String field, String value)
Adds field to the header with value equal to value.
void setIntHeader(String field, int value)
Adds field to the header with value equal to value.
void setStatus(int code)
Sets the status code for this response to code.
TABLE 31-6
Various Methods Defined by HttpServletResponse (continued)
The HttpSessionBindingListener Interface
The HttpSessionBindingListener interface is implemented by objects that need to be
notified when they are bound to or unbound from an HTTP session. The methods that are
invoked when an object is bound or unbound are
void valueBound(HttpSessionBindingEvent e)
void valueUnbound(HttpSessionBindingEvent e)
Here, e is the event object that describes the binding.
The Cookie Class
The Cookie class encapsulates a cookie. A cookie is stored on a client and contains state
information. Cookies are valuable for tracking user activities. For example, assume that a
Method
Description
Object getAttribute(String attr)
Returns the value associated with the name passed in attr. Returns
null if attr is not found.
Enumeration getAttributeNames( )
Returns an enumeration of the attribute names associated with the
session.
long getCreationTime( )
Returns the time (in milliseconds since midnight, Januar y 1, 1970,
GMT) when this session was created.
String getId( )
Returns the session ID.
long getLastAccessedTime( )
Returns the time (in milliseconds since midnight, Januar y 1, 1970,
GMT) when the client last made a request for this session.
void invalidate( )
Invalidates this session and removes it from the context.
boolean isNew( )
Returns true if the ser ver created the session and it has not yet
been accessed by the client.
void removeAttribute(String attr)
Removes the attribute specified by attr from the session.
void setAttribute(String attr, Object val)
Associates the value passed in val with the attribute name passed
in attr.
TABLE 31-7
The Methods Defined by HttpSession
Search WWH :
Custom Search
Previous Page
Java SE 6 Topic Index
Next Page
Java SE 6 Bookmarks
Home