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

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      javax.servlet.http.HttpServletRequest getRequest()
      Returns the active HTTP request or null if one cannot be found.
      javax.servlet.http.HttpServletResponse getResponse()
      Returns the active HTTP response or null if one cannot be found.
      javax.servlet.http.HttpSession getSession​(boolean create)
      Returns the session associated with the active request or, if there is no current session and create is true, returns a new session.
    • Method Detail

      • getRequest

        javax.servlet.http.HttpServletRequest getRequest()
        Returns the active HTTP request or null if one cannot be found.
      • getResponse

        javax.servlet.http.HttpServletResponse getResponse()
        Returns the active HTTP response or null if one cannot be found.
      • getSession

        javax.servlet.http.HttpSession getSession​(boolean create)
        Returns the session associated with the active request or, if there is no current session and create is true, returns a new session.
        Parameters:
        create - should be true to create a new session for the current request or false to return null if there is no current session
        Returns:
        the HttpSession associated with this request or null if create is false and the request has no session