org.springframework.web.servlet.support

Class JspAwareRequestContext



  • public class JspAwareRequestContext
    extends RequestContext
    JSP-aware (and JSTL-aware) subclass of RequestContext, allowing for population of the context from a javax.servlet.jsp.PageContext.

    This context will detect a JSTL locale attribute in page/request/session/application scope, in addition to the fallback locale strategy provided by the base class.

    Since:
    1.1.4
    Author:
    Juergen Hoeller
    See Also:
    getFallbackLocale()
    • Constructor Detail

      • JspAwareRequestContext

        public JspAwareRequestContext(PageContext pageContext)
        Create a new JspAwareRequestContext for the given page context, using the request attributes for Errors retrieval.
        Parameters:
        pageContext - current JSP page context
      • JspAwareRequestContext

        public JspAwareRequestContext(PageContext pageContext,
                                      @Nullable
                                      java.util.Map<java.lang.String,java.lang.Object> model)
        Create a new JspAwareRequestContext for the given page context, using the given model attributes for Errors retrieval.
        Parameters:
        pageContext - current JSP page context
        model - the model attributes for the current view (can be null, using the request attributes for Errors retrieval)
    • Method Detail

      • getPageContext

        protected final PageContext getPageContext()
        Return the underlying PageContext. Only intended for cooperating classes in this package.
      • getFallbackLocale

        protected java.util.Locale getFallbackLocale()
        This implementation checks for a JSTL locale attribute in page, request, session or application scope; if not found, returns the HttpServletRequest.getLocale().
        Overrides:
        getFallbackLocale in class RequestContext
        Returns:
        the fallback locale (never null)
        See Also:
        ServletRequest.getLocale()
      • getFallbackTimeZone

        protected java.util.TimeZone getFallbackTimeZone()
        This implementation checks for a JSTL time zone attribute in page, request, session or application scope; if not found, returns null.
        Overrides:
        getFallbackTimeZone in class RequestContext
        Returns:
        the fallback time zone (or null if none derivable from the request)