| |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Context holder for request-specific state, like current web application context, current locale, current theme, and potential binding errors. Provides easy access to localized messages and Errors instances.
Suitable for exposition to views, and usage within Can be instantiated manually, or automatically exposed to views as
model attribute via AbstractView's requestContextAttribute property. This only works with InternalResourceViews, as Errors instances
are part of the model and not normally exposed as request attributes.
It will typically be used within JSPs or custom tags. This works with all View implementations.
It will typically be used by View implementations. to Class org.springframework.web.context.WebApplicationContext to Class java.util.Locale to Class org.springframework.ui.context.Theme to Class java.util.Map Constructor Summary RequestContext(HttpServletRequest request)
Create a new RequestContext for the given request,
using the request attributes for Errors retrieval.RequestContext(HttpServletRequest request, Map model)
Create a new RequestContext for the given request,
using the given model attributes for Errors retrieval. Method Summary StringgetContextPath()
Return the context path of the current request,
i.e. ErrorsgetErrors(String name)
Retrieve the Errors instance for the given bind object,
using the defaultHtmlEscape setting. ErrorsgetErrors(String name, boolean htmlEscape)
Retrieve the Errors instance for the given bind object. LocalegetLocale()
Return the current locale. StringgetMessage(String code, String defaultMessage)
Retrieve the message for the given code, using the defaultHtmlEscape setting. StringgetMessage(String code, Object[] args, String defaultMessage)
Retrieve the message for the given code, using the defaultHtmlEscape setting. StringgetMessage(String code, Object[] args, String defaultMessage, boolean htmlEscape)
Retrieve the message for the given code. StringgetMessage(String code)
Retrieve the message for the given code, using the defaultHtmlEscape setting. StringgetMessage(String code, Object[] args)
Retrieve the message for the given code, using the defaultHtmlEscape setting. StringgetMessage(String code, Object[] args, boolean htmlEscape)
Retrieve the message for the given code. StringgetMessage(MessageSourceResolvable resolvable)
Retrieve the given MessageSourceResolvable (e.g. StringgetMessage(MessageSourceResolvable resolvable, boolean htmlEscape)
Retrieve the given MessageSourceResolvable (e.g. ThemegetTheme()
Return the current theme. WebApplicationContextgetWebApplicationContext()
Return the current WebApplicationContext. booleanisDefaultHtmlEscape()
Default HTML escaping? voidsetDefaultHtmlEscape(boolean defaultHtmlEscape)
(De)activate default HTML escaping for messages and errors.Constructor Detail RequestContext
public RequestContext(HttpServletRequest request)
throws ServletExceptionRequestContext
public RequestContext(HttpServletRequest request, Map model)
throws ServletExceptionMethod Detail getContextPath
public String getContextPath()
getErrors
public Errors getErrors(String name)
getErrors
public Errors getErrors(String name, boolean htmlEscape)
getLocale
public Locale getLocale()
getMessage
public String getMessage(String code, String defaultMessage)
getMessage
public String getMessage(String code, Object[] args, String defaultMessage)
getMessage
public String getMessage(String code, Object[] args, String defaultMessage, boolean htmlEscape)
getMessage
public String getMessage(String code)
throws org.springframework.context.NoSuchMessageExceptiongetMessage
public String getMessage(String code, Object[] args)
throws org.springframework.context.NoSuchMessageExceptiongetMessage
public String getMessage(String code, Object[] args, boolean htmlEscape)
throws org.springframework.context.NoSuchMessageExceptiongetMessage
public String getMessage(MessageSourceResolvable resolvable)
throws org.springframework.context.NoSuchMessageExceptiongetMessage
public String getMessage(MessageSourceResolvable resolvable, boolean htmlEscape)
throws org.springframework.context.NoSuchMessageExceptiongetTheme
public Theme getTheme()
getWebApplicationContext
public WebApplicationContext getWebApplicationContext()
isDefaultHtmlEscape
public boolean isDefaultHtmlEscape()
setDefaultHtmlEscape
public void setDefaultHtmlEscape(boolean defaultHtmlEscape)
Association Links
to Class java.util.MapOverview Package Class Use Tree Index Help PREV CLASS NEXT CLASS FRAMES NO FRAMES SUMMARY: INNER | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD