Class HttpCallContext

java.lang.Object
com.peterphi.std.guice.web.HttpCallContext

public class HttpCallContext extends Object
Represents the current Http Call being processed by this Thread
  • Constructor Summary

    Constructors
    Constructor
    Description
    HttpCallContext(String logId, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.ServletContext servletContext)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
     
    get()
    Retrieve the HttpCallContext associated with this Thread
     
    javax.servlet.http.HttpServletRequest
     
    Returns a string representation of the request (e.g.
    javax.servlet.http.HttpServletResponse
     
    javax.servlet.ServletContext
     
    boolean
     
    Retrieve the HttpCallContext associated with this Thread (or null if none is associated)
    set(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.ServletContext servletContext)
    Creates and associates an HttpCallContext with the current Thread

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • HttpCallContext

      public HttpCallContext(String logId, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.ServletContext servletContext)
  • Method Details

    • get

      public static HttpCallContext get() throws IllegalStateException
      Retrieve the HttpCallContext associated with this Thread
      Returns:
      Throws:
      IllegalStateException - if not inside an http call
    • peek

      public static HttpCallContext peek()
      Retrieve the HttpCallContext associated with this Thread (or null if none is associated)
      Returns:
      Throws:
      IllegalStateException - if not inside an http call
    • clear

      public static void clear()
    • set

      public static HttpCallContext set(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.ServletContext servletContext)
      Creates and associates an HttpCallContext with the current Thread
      Parameters:
      request -
      response -
      Returns:
    • getLogId

      public String getLogId()
    • getRequest

      public javax.servlet.http.HttpServletRequest getRequest()
    • getResponse

      public javax.servlet.http.HttpServletResponse getResponse()
    • getServletContext

      public javax.servlet.ServletContext getServletContext()
    • getRequestInfo

      public String getRequestInfo()
      Returns a string representation of the request (e.g. "GET /webapp/rest/resource?a=b")
      Returns:
    • isVerbose

      public boolean isVerbose()