Package com.avoka.fc.core.servlet
Class RequestContext
- java.lang.Object
-
- com.avoka.fc.core.servlet.RequestContext
-
- Direct Known Subclasses:
MockRequestContext
public class RequestContext extends Object
Provides Servlet API request context object.
-
-
Constructor Summary
Constructors Constructor Description RequestContext(ServletContext context, HttpServletRequest request, HttpServletResponse response)
Instantiates a new request context.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
bindThreadRequestContext(RequestContext requestContext)
Bind the request context to the current thread.HttpServletRequest
getRequest()
Return the servlet request object.HttpServletResponse
getResponse()
Return the servlet response object.ServletContext
getServletContext()
Return the servlet context object.HttpSession
getSession()
Return the servlet session object.static HttpServletRequest
getThreadRequest()
static RequestContext
getThreadRequestContext()
Return the request context object for the current thread.String
toString()
-
-
-
Constructor Detail
-
RequestContext
public RequestContext(ServletContext context, HttpServletRequest request, HttpServletResponse response)
Instantiates a new request context.- Parameters:
context
- the contextrequest
- the requestresponse
- the response
-
-
Method Detail
-
getServletContext
public ServletContext getServletContext()
Return the servlet context object.- Returns:
- the servlet context object
-
getResponse
public HttpServletResponse getResponse()
Return the servlet response object.- Returns:
- the servlet response object
-
getRequest
public HttpServletRequest getRequest()
Return the servlet request object.- Returns:
- the servlet request object
-
getSession
public HttpSession getSession()
Return the servlet session object.- Returns:
- the servlet session object
-
getThreadRequestContext
public static RequestContext getThreadRequestContext()
Return the request context object for the current thread.- Returns:
- the request context object for the current thread
-
getThreadRequest
public static HttpServletRequest getThreadRequest()
- Returns:
- the thread local HtttpServletRequest if defined or null otherwise.
- Since:
- 4.3.2
-
bindThreadRequestContext
public static void bindThreadRequestContext(RequestContext requestContext)
Bind the request context to the current thread.- Parameters:
requestContext
- the request context
-
-