类 SafeRequestContext

java.lang.Object
com.publiccms.common.servlet.SafeRequestContext

public class SafeRequestContext extends Object
  • 字段详细资料

    • WEB_APPLICATION_CONTEXT_ATTRIBUTE

      public static final String WEB_APPLICATION_CONTEXT_ATTRIBUTE
    • request

      private jakarta.servlet.http.HttpServletRequest request
    • response

      @Nullable private jakarta.servlet.http.HttpServletResponse response
    • model

      @Nullable private Map<String,Object> model
    • webApplicationContext

      private org.springframework.web.context.WebApplicationContext webApplicationContext
    • locale

      @Nullable private Locale locale
    • timeZone

      @Nullable private TimeZone timeZone
    • defaultHtmlEscape

      @Nullable private Boolean defaultHtmlEscape
    • responseEncodedHtmlEscape

      @Nullable private Boolean responseEncodedHtmlEscape
    • urlPathHelper

      private org.springframework.web.util.UrlPathHelper urlPathHelper
    • requestDataValueProcessor

      @Nullable private org.springframework.web.servlet.support.RequestDataValueProcessor requestDataValueProcessor
    • errorsMap

      @Nullable private Map<String,org.springframework.validation.Errors> errorsMap
  • 构造器详细资料

    • SafeRequestContext

      public SafeRequestContext(jakarta.servlet.http.HttpServletRequest request, @Nullable jakarta.servlet.http.HttpServletResponse response, @Nullable jakarta.servlet.ServletContext servletContext, @Nullable Map<String,Object> model)
  • 方法详细资料

    • getRequest

      protected final jakarta.servlet.http.HttpServletRequest getRequest()
    • getServletContext

      @Nullable protected final jakarta.servlet.ServletContext getServletContext()
      Return the underlying ServletContext.
    • getModel

      @Nullable public final Map<String,Object> getModel()
      返回:
      the populated model Map, or null if none available
    • getLocale

      public final Locale getLocale()
      返回:
      current Locale (never null)
    • getTimeZone

      @Nullable public TimeZone getTimeZone()
      返回:
      current timezone (never null)
    • getFallbackLocale

      protected Locale getFallbackLocale()
      返回:
      the fallback locale (never null)
    • getFallbackTimeZone

      @Nullable protected TimeZone getFallbackTimeZone()
      返回:
      the fallback time zone (or null if none derivable from the request)
    • changeLocale

      public void changeLocale(Locale locale)
      参数:
      locale - the new locale
    • changeLocale

      public void changeLocale(Locale locale, TimeZone timeZone)
      参数:
      locale - the new locale
      timeZone - 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

      @Nullable public Boolean 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

      @Nullable public Boolean 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". Or null if no matching bean was found.
    • getContextPath

      public String getContextPath()
      返回:
      the context path of the original request
    • getContextUrl

      public String getContextUrl(String relativeUrl)
      参数:
      relativeUrl - the relative URL part
      返回:
      a URL that points back to the server with an absolute path (also URL-encoded accordingly)
    • getContextUrl

      public String getContextUrl(String relativeUrl, Map<String,?> params)
      参数:
      relativeUrl - the relative URL part
      params - 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

      public String getPathToServlet()
      返回:
      the path to URL mappings within the current servlet including the context path and the servlet path of the original request.
    • getRequestUri

      public String getRequestUri()
      返回:
      the request URI of the original request
    • getQueryString

      public String getQueryString()
      返回:
      the query string of the current request
    • getMessage

      public String getMessage(String code, String defaultMessage)
      参数:
      code - the code of the message
      defaultMessage - the String to return if the lookup fails
      返回:
      the message
    • getMessage

      public String getMessage(String code, @Nullable Object[] args, String defaultMessage)
      参数:
      code - the code of the message
      args - arguments for the message, or null if none
      defaultMessage - the String to return if the lookup fails
      返回:
      the message
    • getMessage

      public String getMessage(String code, @Nullable List<?> args, String defaultMessage)
      参数:
      code - the code of the message
      args - arguments for the message as a List, or null if none
      defaultMessage - 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 message
      args - arguments for the message, or null if none
      defaultMessage - the String to return if the lookup fails
      htmlEscape - if the message should be HTML-escaped
      返回:
      the message
    • getMessage

      public String getMessage(String code) throws org.springframework.context.NoSuchMessageException
      参数:
      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 message
      args - arguments for the message, or null 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 message
      args - arguments for the message as a List, or null 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 message
      args - arguments for the message, or null if none
      htmlEscape - 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 MessageSourceResolvable
      htmlEscape - if the message should be HTML-escaped
      返回:
      the message
      抛出:
      org.springframework.context.NoSuchMessageException - if not found
    • getErrors

      @Nullable public org.springframework.validation.Errors getErrors(String name)
      参数:
      name - the name of the bind object
      返回:
      the Errors instance, or null if not found
    • getErrors

      @Nullable public org.springframework.validation.Errors getErrors(String name, boolean htmlEscape)
      参数:
      name - the name of the bind object
      htmlEscape - create an Errors instance with automatic HTML escaping?
      返回:
      the Errors instance, or null if not found
    • getModelObject

      @Nullable protected Object getModelObject(String modelName)
      参数:
      modelName - the name of the model object
      返回:
      the model object