public final class ServletThreadContext extends Object
ThreadLocal。
ServletThreadContext包含一个ActionInvocation,存储线程安全的Action运行时上下文。
ServletThreadContext包含http的相关的变量。
ServletThreadContext包含一个contextMap变量,存储自定义的key-value。
ServletThreadContext包含一个Exception对象,存储发生的异常。| 限定符和类型 | 方法和说明 |
|---|---|
static <T extends jrouter.ActionInvocation> |
getActionInvocation()
返回Action运行时上下文。
|
static <T> Map<String,T> |
getContextMap()
返回ThreadContext中的Map容器。
|
static Exception |
getException()
Get the exception.
|
static javax.servlet.http.HttpServletRequest |
getRequest()
Gets the HTTP servlet request object.
|
static Map<String,String[]> |
getRequestParameters()
Gets the HTTP servlet request parameters.
|
static javax.servlet.http.HttpServletResponse |
getResponse()
Gets the HTTP servlet response object.
|
static javax.servlet.ServletContext |
getServletContext()
Gets the servlet context.
|
static javax.servlet.http.HttpSession |
getSession()
Gets the HTTP servlet session object.
|
static javax.servlet.http.HttpSession |
getSession(boolean create)
Gets the HTTP servlet session object.
|
static void |
remove()
移除前线程副本中的ServletThreadContext。
|
static void |
setActionInvocation(jrouter.ActionInvocation<?> actionInvocation)
设置Action运行时上下文。
|
static void |
setException(Exception exception)
Store the exception.
|
static void |
setRequest(javax.servlet.http.HttpServletRequest request)
Sets the HTTP servlet request object.
|
static void |
setResponse(javax.servlet.http.HttpServletResponse response)
Sets the HTTP servlet response object.
|
static void |
setServletContext(javax.servlet.ServletContext servletContext)
Sets the current servlet context object.
|
public static void remove()
public static <T extends jrouter.ActionInvocation> T getActionInvocation()
T - Action运行时上下文类型。ServletActionFactory.DefaultServletActionFactory.createActionInvocation(java.lang.String, java.lang.Object...)public static void setActionInvocation(jrouter.ActionInvocation<?> actionInvocation)
actionInvocation - Action运行时上下文。public static void setRequest(javax.servlet.http.HttpServletRequest request)
request - the HTTP servlet request object.public static javax.servlet.http.HttpServletRequest getRequest()
public static javax.servlet.http.HttpSession getSession()
public static javax.servlet.http.HttpSession getSession(boolean create)
create - true to create
a new session for this request if necessary;
false to return null
if there's no current sessionpublic static Map<String,String[]> getRequestParameters()
public static void setResponse(javax.servlet.http.HttpServletResponse response)
response - the HTTP servlet response object.public static javax.servlet.http.HttpServletResponse getResponse()
public static javax.servlet.ServletContext getServletContext()
public static void setServletContext(javax.servlet.ServletContext servletContext)
servletContext - The servlet context to usepublic static <T> Map<String,T> getContextMap()
public static Exception getException()
public static void setException(Exception exception)
exception - The exceptionCopyright © 2018. All rights reserved.