Name the class that includes the getSession method that is used to get the HttpSession object.
Reveal answer
Fill a bubble to check yourself
Name the class that includes the getSession method that is used to get the HttpSession object.
SessionContext
SessionConfig
HttpServletRequest
HttpServletResponse
The HttpServletRequest interface provides the getSession() method to retrieve the HttpSession object. This is part of the Java Servlet API for session management in web applications.
HttpServletRequest is the interface that declares getSession(), which returns the HttpSession object associated with the current request (creating a new one if none exists, when called with no arguments or with true). SessionContext and SessionConfig aren't standard Servlet API types with this responsibility, and HttpServletResponse is used to write output/set headers/redirects — session retrieval is a request-side concern, not a response-side one.