Class ContextExposingHttpServletRequest
java.lang.Object
jakarta.servlet.ServletRequestWrapper
jakarta.servlet.http.HttpServletRequestWrapper
org.springframework.web.context.support.ContextExposingHttpServletRequest
- All Implemented Interfaces:
- HttpServletRequest,- ServletRequest
HttpServletRequest decorator that makes all Spring beans in a
 given WebApplicationContext accessible as request attributes,
 through lazy checking once an attribute gets accessed.
- Since:
- 2.5
- Author:
- Juergen Hoeller
- 
Field SummaryFields inherited from interface jakarta.servlet.http.HttpServletRequestBASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
- 
Constructor SummaryConstructorsConstructorDescriptionContextExposingHttpServletRequest(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.
- 
Method SummaryModifier and TypeMethodDescriptiongetAttribute(String name) final WebApplicationContextReturn the WebApplicationContext that this request runs in.voidsetAttribute(String name, Object value) Methods inherited from class jakarta.servlet.http.HttpServletRequestWrapperauthenticate, 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, isRequestedSessionIdValid, isTrailerFieldsReady, isUserInRole, login, logout, newPushBuilder, upgradeMethods inherited from class jakarta.servlet.ServletRequestWrappergetAsyncContext, getAttributeNames, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getProtocolRequestId, getReader, getRemoteAddr, getRemoteHost, getRemotePort, getRequest, getRequestDispatcher, getRequestId, getScheme, getServerName, getServerPort, getServletConnection, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, isWrapperFor, isWrapperFor, removeAttribute, setCharacterEncoding, setRequest, startAsync, startAsyncMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jakarta.servlet.ServletRequestgetAsyncContext, getAttributeNames, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getProtocolRequestId, getReader, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getRequestId, getScheme, getServerName, getServerPort, getServletConnection, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, removeAttribute, setCharacterEncoding, startAsync, startAsync
- 
Constructor Details- 
ContextExposingHttpServletRequestpublic ContextExposingHttpServletRequest(HttpServletRequest originalRequest, WebApplicationContext context) Create a new ContextExposingHttpServletRequest for the given request.- Parameters:
- originalRequest- the original HttpServletRequest
- context- the WebApplicationContext that this request runs in
 
- 
ContextExposingHttpServletRequestpublic ContextExposingHttpServletRequest(HttpServletRequest originalRequest, WebApplicationContext context, @Nullable Set<String> exposedContextBeanNames) Create a new ContextExposingHttpServletRequest for the given request.- Parameters:
- originalRequest- the original HttpServletRequest
- context- the WebApplicationContext that this request runs in
- exposedContextBeanNames- 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)
 
 
- 
- 
Method Details- 
getWebApplicationContextReturn the WebApplicationContext that this request runs in.
- 
getAttribute- Specified by:
- getAttributein interface- ServletRequest
- Overrides:
- getAttributein class- ServletRequestWrapper
 
- 
setAttribute- Specified by:
- setAttributein interface- ServletRequest
- Overrides:
- setAttributein class- ServletRequestWrapper
 
 
-