Interface HttpContext
- All Known Implementing Classes:
StaticHttpContext
public interface HttpContext
Provides access to the key objects provided by the servlet API when processing an HTTP request.
Use this interface rather than making static calls to classes like ServletActionContext directly.
- Since:
- 2.9
-
Method Summary
Modifier and TypeMethodDescriptionjakarta.servlet.http.HttpServletRequest
Returns the active HTTP request ornull
if one cannot be found.jakarta.servlet.http.HttpServletResponse
Returns the active HTTP response ornull
if one cannot be found.jakarta.servlet.http.HttpSession
getActiveSession
(boolean create) Returns the session associated with the active request or, if there is no current session andcreate
istrue
, returns a new session.
-
Method Details
-
getActiveRequest
jakarta.servlet.http.HttpServletRequest getActiveRequest()Returns the active HTTP request ornull
if one cannot be found.- Since:
- 10.0
-
getActiveResponse
jakarta.servlet.http.HttpServletResponse getActiveResponse()Returns the active HTTP response ornull
if one cannot be found.- Since:
- 10.0
-
getActiveSession
jakarta.servlet.http.HttpSession getActiveSession(boolean create) Returns the session associated with the active request or, if there is no current session andcreate
istrue
, returns a new session.- Parameters:
create
- should betrue
to create a new session for the current request orfalse
to returnnull
if there is no current session- Returns:
- the HttpSession associated with this request or
null
ifcreate
is false and the request has no session - Since:
- 10.0
-