Interface HttpContext
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.
Note that this interface makes no guarantees about which wrapper for the active request, response or session will be returned. Callers should not rely on retrieving any particular wrapper. It is only guaranteed to be populated on a http request thread, after login, and before decoration.
- Since:
- 2.8
-
Method Summary
Modifier and TypeMethodDescriptionjavax.servlet.http.HttpServletRequestReturns the active HTTP request ornullif one cannot be found.javax.servlet.http.HttpServletResponseReturns the active HTTP response ornullif one cannot be found.javax.servlet.http.HttpSessiongetSession(boolean create) Returns the session associated with the active request or, if there is no current session andcreateis true, returns a new session.
-
Method Details
-
getRequest
Returns the active HTTP request ornullif one cannot be found. -
getResponse
Returns the active HTTP response ornullif one cannot be found. -
getSession
Returns the session associated with the active request or, if there is no current session andcreateis true, returns a new session.- Parameters:
create- should betrueto create a new session for the active request orfalseto returnnullif there is no current session- Returns:
- the HttpSession associated with this request or
nullifcreateis false and the request has no session, or if there is no active request
-