|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.web.servlet.support.RequestContextUtils
public abstract class RequestContextUtils
Utility class for easy access to request-specific state which has been
set by the DispatcherServlet
.
Supports lookup of current WebApplicationContext, LocaleResolver, Locale, ThemeResolver, Theme, and MultipartResolver.
RequestContext
,
DispatcherServlet
Constructor Summary | |
---|---|
RequestContextUtils()
|
Method Summary | |
---|---|
static FlashMapManager |
getFlashMapManager(HttpServletRequest request)
Return the FlashMapManager instance to save flash attributes with before a redirect. |
static Map<String,?> |
getInputFlashMap(HttpServletRequest request)
Return a read-only Map with "input" flash attributes saved on a
previous request. |
static Locale |
getLocale(HttpServletRequest request)
Retrieves the current locale from the given request, using the LocaleResolver bound to the request by the DispatcherServlet (if available), falling back to the request's accept-header Locale. |
static LocaleResolver |
getLocaleResolver(HttpServletRequest request)
Return the LocaleResolver that has been bound to the request by the DispatcherServlet. |
static FlashMap |
getOutputFlashMap(HttpServletRequest request)
Return the "output" FlashMap with attributes to save for a subsequent request. |
static Theme |
getTheme(HttpServletRequest request)
Retrieves the current theme from the given request, using the ThemeResolver and ThemeSource bound to the request by the DispatcherServlet. |
static ThemeResolver |
getThemeResolver(HttpServletRequest request)
Return the ThemeResolver that has been bound to the request by the DispatcherServlet. |
static ThemeSource |
getThemeSource(HttpServletRequest request)
Return the ThemeSource that has been bound to the request by the DispatcherServlet. |
static WebApplicationContext |
getWebApplicationContext(ServletRequest request)
Look for the WebApplicationContext associated with the DispatcherServlet that has initiated request processing. |
static WebApplicationContext |
getWebApplicationContext(ServletRequest request,
ServletContext servletContext)
Look for the WebApplicationContext associated with the DispatcherServlet that has initiated request processing, and for the global context if none was found associated with the current request. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RequestContextUtils()
Method Detail |
---|
public static WebApplicationContext getWebApplicationContext(ServletRequest request) throws IllegalStateException
request
- current HTTP request
IllegalStateException
- if no servlet-specific context has been foundpublic static WebApplicationContext getWebApplicationContext(ServletRequest request, ServletContext servletContext) throws IllegalStateException
request
- current HTTP requestservletContext
- current servlet context
IllegalStateException
- if neither a servlet-specific nor a
global context has been foundpublic static LocaleResolver getLocaleResolver(HttpServletRequest request)
request
- current HTTP request
null
if not foundpublic static Locale getLocale(HttpServletRequest request)
request
- current HTTP request
getLocaleResolver(javax.servlet.http.HttpServletRequest)
,
ServletRequest.getLocale()
public static ThemeResolver getThemeResolver(HttpServletRequest request)
request
- current HTTP request
null
if not foundpublic static ThemeSource getThemeSource(HttpServletRequest request)
request
- current HTTP request
public static Theme getTheme(HttpServletRequest request)
request
- current HTTP request
null
if not foundgetThemeResolver(javax.servlet.http.HttpServletRequest)
public static Map<String,?> getInputFlashMap(HttpServletRequest request)
Map
with "input" flash attributes saved on a
previous request.
request
- the current request
null
FlashMap
public static FlashMap getOutputFlashMap(HttpServletRequest request)
request
- current request
FlashMap
instance, never null
FlashMap
public static FlashMapManager getFlashMapManager(HttpServletRequest request)
request
- the current request
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |