类 SafeRequestContext
java.lang.Object
com.publiccms.common.servlet.SafeRequestContext
-
字段概要
字段修饰符和类型字段说明private Boolean
private Locale
private jakarta.servlet.http.HttpServletRequest
private org.springframework.web.servlet.support.RequestDataValueProcessor
private jakarta.servlet.http.HttpServletResponse
private Boolean
private TimeZone
private org.springframework.web.util.UrlPathHelper
static final String
private org.springframework.web.context.WebApplicationContext
-
构造器概要
构造器构造器说明SafeRequestContext
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.ServletContext servletContext, Map<String, Object> model) -
方法概要
修饰符和类型方法说明void
changeLocale
(Locale locale) void
changeLocale
(Locale locale, TimeZone timeZone) getContextUrl
(String relativeUrl) getContextUrl
(String relativeUrl, Map<String, ?> params) org.springframework.validation.Errors
org.springframework.validation.Errors
protected Locale
protected TimeZone
final Locale
getMessage
(String code) getMessage
(String code, Object[] args) getMessage
(String code, Object[] args, boolean htmlEscape) getMessage
(String code, Object[] args, String defaultMessage) getMessage
(String code, Object[] args, String defaultMessage, boolean htmlEscape) getMessage
(String code, String defaultMessage) getMessage
(String code, List<?> args) getMessage
(String code, List<?> args, String defaultMessage) getMessage
(org.springframework.context.MessageSourceResolvable resolvable) getMessage
(org.springframework.context.MessageSourceResolvable resolvable, boolean htmlEscape) getModel()
protected Object
getModelObject
(String modelName) protected final jakarta.servlet.http.HttpServletRequest
org.springframework.web.servlet.support.RequestDataValueProcessor
protected final jakarta.servlet.ServletContext
Return the underlying ServletContext.org.springframework.web.util.UrlPathHelper
boolean
boolean
void
setDefaultHtmlEscape
(boolean defaultHtmlEscape) void
setUrlPathHelper
(org.springframework.web.util.UrlPathHelper urlPathHelper)
-
字段详细资料
-
WEB_APPLICATION_CONTEXT_ATTRIBUTE
-
request
private jakarta.servlet.http.HttpServletRequest request -
response
@Nullable private jakarta.servlet.http.HttpServletResponse response -
model
-
webApplicationContext
private org.springframework.web.context.WebApplicationContext webApplicationContext -
locale
-
timeZone
-
defaultHtmlEscape
-
responseEncodedHtmlEscape
-
urlPathHelper
private org.springframework.web.util.UrlPathHelper urlPathHelper -
requestDataValueProcessor
@Nullable private org.springframework.web.servlet.support.RequestDataValueProcessor requestDataValueProcessor -
errorsMap
-
-
构造器详细资料
-
SafeRequestContext
-
-
方法详细资料
-
getRequest
protected final jakarta.servlet.http.HttpServletRequest getRequest() -
getServletContext
@Nullable protected final jakarta.servlet.ServletContext getServletContext()Return the underlying ServletContext. -
getModel
- 返回:
- the populated model Map, or
null
if none available
-
getLocale
- 返回:
- current Locale (never
null
)
-
getTimeZone
- 返回:
- current timezone (never
null
)
-
getFallbackLocale
- 返回:
- the fallback locale (never
null
)
-
getFallbackTimeZone
- 返回:
- the fallback time zone (or
null
if none derivable from the request)
-
changeLocale
- 参数:
locale
- the new locale
-
changeLocale
- 参数:
locale
- the new localetimeZone
- the new time zone
-
setDefaultHtmlEscape
public void setDefaultHtmlEscape(boolean defaultHtmlEscape) - 参数:
defaultHtmlEscape
-
-
isDefaultHtmlEscape
public boolean isDefaultHtmlEscape()- 返回:
- Is default HTML escaping active? Falls back to
false
in case of no explicit default given.
-
getDefaultHtmlEscape
- 返回:
- whether default HTML escaping is enabled (null = no explicit default)
-
isResponseEncodedHtmlEscape
public boolean isResponseEncodedHtmlEscape()- 返回:
- Is HTML escaping using the response encoding by default? If enabled, only XML markup significant characters will be escaped with UTF-* encodings.
-
getResponseEncodedHtmlEscape
- 返回:
- whether default use of response encoding HTML escaping is enabled (null = no explicit default)
- 从以下版本开始:
- 4.1.2
-
setUrlPathHelper
public void setUrlPathHelper(org.springframework.web.util.UrlPathHelper urlPathHelper) - 参数:
urlPathHelper
-
-
getUrlPathHelper
public org.springframework.web.util.UrlPathHelper getUrlPathHelper()- 返回:
- the UrlPathHelper used for context path and request URI decoding. Can be used to configure the current UrlPathHelper.
-
getRequestDataValueProcessor
@Nullable public org.springframework.web.servlet.support.RequestDataValueProcessor getRequestDataValueProcessor()- 返回:
- the RequestDataValueProcessor instance to use obtained from the
WebApplicationContext under the name
"requestDataValueProcessor"
. Ornull
if no matching bean was found.
-
getContextPath
- 返回:
- the context path of the original request
-
getContextUrl
- 参数:
relativeUrl
- the relative URL part- 返回:
- a URL that points back to the server with an absolute path (also URL-encoded accordingly)
-
getContextUrl
- 参数:
relativeUrl
- the relative URL partparams
- a map of parameters to insert as placeholders in the url- 返回:
- a URL that points back to the server with an absolute path (also URL-encoded accordingly)
-
getPathToServlet
- 返回:
- the path to URL mappings within the current servlet including the context path and the servlet path of the original request.
-
getRequestUri
- 返回:
- the request URI of the original request
-
getQueryString
- 返回:
- the query string of the current request
-
getMessage
- 参数:
code
- the code of the messagedefaultMessage
- the String to return if the lookup fails- 返回:
- the message
-
getMessage
- 参数:
code
- the code of the messageargs
- arguments for the message, ornull
if nonedefaultMessage
- the String to return if the lookup fails- 返回:
- the message
-
getMessage
- 参数:
code
- the code of the messageargs
- arguments for the message as a List, ornull
if nonedefaultMessage
- the String to return if the lookup fails- 返回:
- the message
-
getMessage
public String getMessage(String code, @Nullable Object[] args, String defaultMessage, boolean htmlEscape) - 参数:
code
- the code of the messageargs
- arguments for the message, ornull
if nonedefaultMessage
- the String to return if the lookup failshtmlEscape
- if the message should be HTML-escaped- 返回:
- the message
-
getMessage
- 参数:
code
- the code of the message- 返回:
- the message
- 抛出:
org.springframework.context.NoSuchMessageException
- if not found
-
getMessage
public String getMessage(String code, @Nullable Object[] args) throws org.springframework.context.NoSuchMessageException - 参数:
code
- the code of the messageargs
- arguments for the message, ornull
if none- 返回:
- the message
- 抛出:
org.springframework.context.NoSuchMessageException
- if not found
-
getMessage
public String getMessage(String code, @Nullable List<?> args) throws org.springframework.context.NoSuchMessageException - 参数:
code
- the code of the messageargs
- arguments for the message as a List, ornull
if none- 返回:
- the message
- 抛出:
org.springframework.context.NoSuchMessageException
- if not found
-
getMessage
public String getMessage(String code, @Nullable Object[] args, boolean htmlEscape) throws org.springframework.context.NoSuchMessageException - 参数:
code
- the code of the messageargs
- arguments for the message, ornull
if nonehtmlEscape
- if the message should be HTML-escaped- 返回:
- the message
- 抛出:
org.springframework.context.NoSuchMessageException
- if not found
-
getMessage
public String getMessage(org.springframework.context.MessageSourceResolvable resolvable) throws org.springframework.context.NoSuchMessageException - 参数:
resolvable
- the MessageSourceResolvable- 返回:
- the message
- 抛出:
org.springframework.context.NoSuchMessageException
- if not found
-
getMessage
public String getMessage(org.springframework.context.MessageSourceResolvable resolvable, boolean htmlEscape) throws org.springframework.context.NoSuchMessageException - 参数:
resolvable
- the MessageSourceResolvablehtmlEscape
- if the message should be HTML-escaped- 返回:
- the message
- 抛出:
org.springframework.context.NoSuchMessageException
- if not found
-
getErrors
- 参数:
name
- the name of the bind object- 返回:
- the Errors instance, or
null
if not found
-
getErrors
- 参数:
name
- the name of the bind objecthtmlEscape
- create an Errors instance with automatic HTML escaping?- 返回:
- the Errors instance, or
null
if not found
-
getModelObject
- 参数:
modelName
- the name of the model object- 返回:
- the model object
-