类 ContextExposingHttpServletRequest
- java.lang.Object
- javax.servlet.ServletRequestWrapper
- javax.servlet.http.HttpServletRequestWrapper
- org.springframework.web.context.support.ContextExposingHttpServletRequest
- 所有已实现的接口:
HttpServletRequest
,ServletRequest
public class ContextExposingHttpServletRequest extends HttpServletRequestWrapper
HttpServletRequest decorator that makes all Spring beans in a given WebApplicationContext accessible as request attributes, through lazy checking once an attribute gets accessed.- 从以下版本开始:
- 2.5
- 作者:
- Juergen Hoeller
字段概要
从接口继承的字段 javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
构造器概要
构造器 构造器 说明 ContextExposingHttpServletRequest(HttpServletRequest originalRequest, WebApplicationContext context)
Create a new ContextExposingHttpServletRequest for the given request.ContextExposingHttpServletRequest(HttpServletRequest originalRequest, WebApplicationContext context, Set<String> exposedContextBeanNames)
Create a new ContextExposingHttpServletRequest for the given request.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 Object
getAttribute(String name)
The default behavior of this method is to call getAttribute(String name) on the wrapped request object.WebApplicationContext
getWebApplicationContext()
Return the WebApplicationContext that this request runs in.void
setAttribute(String name, Object value)
The default behavior of this method is to return setAttribute(String name, Object o) on the wrapped request object.从类继承的方法 javax.servlet.http.HttpServletRequestWrapper
authenticate, changeSessionId, getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getHttpServletMapping, getIntHeader, getMethod, getPart, getParts, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, getTrailerFields, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isTrailerFieldsReady, isUserInRole, login, logout, newPushBuilder, upgrade
从类继承的方法 javax.servlet.ServletRequestWrapper
getAsyncContext, getAttributeNames, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequest, getRequestDispatcher, getScheme, getServerName, getServerPort, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, isWrapperFor, isWrapperFor, removeAttribute, setCharacterEncoding, setRequest, startAsync, startAsync
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 javax.servlet.ServletRequest
getAsyncContext, getAttributeNames, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getScheme, getServerName, getServerPort, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, removeAttribute, setCharacterEncoding, startAsync, startAsync
构造器详细资料
ContextExposingHttpServletRequest
public ContextExposingHttpServletRequest(HttpServletRequest originalRequest, WebApplicationContext context)
Create a new ContextExposingHttpServletRequest for the given request.- 参数:
originalRequest
- the original HttpServletRequestcontext
- the WebApplicationContext that this request runs in
ContextExposingHttpServletRequest
public ContextExposingHttpServletRequest(HttpServletRequest originalRequest, WebApplicationContext context, @Nullable Set<String> exposedContextBeanNames)
Create a new ContextExposingHttpServletRequest for the given request.- 参数:
originalRequest
- the original HttpServletRequestcontext
- the WebApplicationContext that this request runs inexposedContextBeanNames
- the names of beans in the context which are supposed to be exposed (if this is non-null, only the beans in this Set are eligible for exposure as attributes)
方法详细资料
getWebApplicationContext
public final WebApplicationContext getWebApplicationContext()
Return the WebApplicationContext that this request runs in.
getAttribute
@Nullable public Object getAttribute(String name)
从类复制的说明:javax.servlet.ServletRequestWrapper
The default behavior of this method is to call getAttribute(String name) on the wrapped request object.- 指定者:
getAttribute
在接口中ServletRequest
- 覆盖:
getAttribute
在类中ServletRequestWrapper
- 参数:
name
- aString
specifying the name of the attribute- 返回:
- an
Object
containing the value of the attribute, ornull
if the attribute does not exist
setAttribute
public void setAttribute(String name, Object value)
从类复制的说明:javax.servlet.ServletRequestWrapper
The default behavior of this method is to return setAttribute(String name, Object o) on the wrapped request object.- 指定者:
setAttribute
在接口中ServletRequest
- 覆盖:
setAttribute
在类中ServletRequestWrapper
- 参数:
name
- aString
specifying the name of the attributevalue
- theObject
to be stored