Skip to Main Content
Java Servlet Programming, 2nd Edition
book

Java Servlet Programming, 2nd Edition

by Jason Hunter, William Crawford
April 2001
Intermediate to advanced content levelIntermediate to advanced
780 pages
23h 48m
English
O'Reilly Media, Inc.
Content preview from Java Servlet Programming, 2nd Edition

Name

HttpSessionContext

Synopsis

Interface Name: javax.servlet.http.HttpSessionContext

Superinterface: None

Immediate Subinterfaces: None

Implemented By: None

Availability: Servlet API 2.0 and later; deprecated in Servlet API 2.1

Description

HttpSessionContext is deprecated as of Servlet API 2.1. Previously this class provided access to all of the currently active sessions inside the servlet container. This provided a potential security hole where a servlet could use this class to display all the session IDs found inside the context, and that information could then be used by unscrupulous clients to forge their way into another’s session. Because the ability to access all sessions at once is almost never needed, this class was deprecated for security’s sake.

Interface Declaration

public interface HttpSessionContext {
  // Methods
  public abstract Enumeration getIds();                     // Deprecated
  public abstract HttpSession getSession(String sessionId); // Deprecated
}

Methods

getIds()

public abstract Enumeration getIds()
Description

Deprecated as of Servlet API 2.1. In Servlet API 2.0, returns an Enumeration that contained the session IDs for all the currently valid sessions in this context, or an empty Enumeration if there are no valid sessions. The session IDs returned by getIds( ) must be held as a server secret because any client with knowledge of another client’s session ID can, with a forged cookie or URL, join the second client’s session.

getSession()

public abstract HttpSession getSession(String sessionId) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java Servlet Programming

Java Servlet Programming

Jason Hunter

Publisher Resources

ISBN: 0596000405Supplemental ContentErrata Page