Top Description Inners Fields Constructors Methods
org.springframework.web.servlet.support

public Class JspAwareRequestContext

extends RequestContext
Class Inheritance
Imports
java.util.Locale, .Map, .TimeZone, jakarta.servlet.http.HttpServletRequest, .HttpServletResponse, jakarta.servlet.jsp.PageContext, jakarta.servlet.jsp.jstl.core.Config, org.springframework.lang.Nullable

JSP-aware (and JSTL-aware) subclass of RequestContext, allowing for population of the context from a jakarta.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.

Author
Juergen Hoeller
Since
1.1.4
See Also
getFallbackLocale

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
JspAwareRequestContext.JstlPageLocaleResolver

Inner class that isolates the JSTL dependency.

Field Summary

Modifier and TypeField and Description
private final PageContext
Inherited from org.springframework.web.servlet.support.RequestContext:
DEFAULT_THEME_NAMEjstlPresentWEB_APPLICATION_CONTEXT_ATTRIBUTE

Constructor Summary

AccessConstructor and Description
public
JspAwareRequestContext(PageContext
current JSP page context
pageContext
)

Create a new JspAwareRequestContext for the given page context, using the request attributes for Errors retrieval.

public
JspAwareRequestContext(PageContext
current JSP page context
pageContext
,
Map<String, Object>
the model attributes for the current view (can be null, using the request attributes for Errors retrieval)
model
)

Create a new JspAwareRequestContext for the given page context, using the given model attributes for Errors retrieval.

Method Summary

Modifier and TypeMethod and Description
protected Locale
getFallbackLocale()

Overrides org.springframework.web.servlet.support.RequestContext.getFallbackLocale.

This implementation checks for a JSTL locale attribute in page, request, session or application scope; if not found, returns the HttpServletRequest.getLocale().

protected TimeZone
getFallbackTimeZone()

Overrides org.springframework.web.servlet.support.RequestContext.getFallbackTimeZone.

This implementation checks for a JSTL time zone attribute in page, request, session or application scope; if not found, returns null.

protected final PageContext
getPageContext()

Return the underlying PageContext.

Inherited from org.springframework.web.servlet.support.RequestContext:
changeLocalechangeLocalechangeThemechangeThemegetBindStatusgetBindStatusgetContextPathgetContextUrlgetContextUrlgetDefaultHtmlEscapegetErrorsgetErrorsgetFallbackThemegetLocalegetMessagegetMessagegetMessagegetMessagegetMessagegetMessagegetMessagegetMessagegetMessagegetMessagegetMessageSourcegetModelgetModelObjectgetPathToServletgetQueryStringgetRequestgetRequestDataValueProcessorgetRequestUrigetResponseEncodedHtmlEscapegetServletContextgetThemegetThemeMessagegetThemeMessagegetThemeMessagegetThemeMessagegetThemeMessagegetThemeMessagegetThemeMessagegetTimeZonegetUrlPathHelpergetWebApplicationContextisDefaultHtmlEscapeisResponseEncodedHtmlEscapesetDefaultHtmlEscapesetUrlPathHelper

Field Detail

pageContextback to summary
private final PageContext pageContext

Constructor Detail

JspAwareRequestContextback to summary
public JspAwareRequestContext(PageContext pageContext)

Create a new JspAwareRequestContext for the given page context, using the request attributes for Errors retrieval.

Parameters
pageContext:PageContext

current JSP page context

JspAwareRequestContextback to summary
public JspAwareRequestContext(PageContext pageContext, Map<String, Object> model)

Create a new JspAwareRequestContext for the given page context, using the given model attributes for Errors retrieval.

Parameters
pageContext:PageContext

current JSP page context

model:Map<String, Object>

the model attributes for the current view (can be null, using the request attributes for Errors retrieval)

Method Detail

getFallbackLocaleback to summary
protected Locale getFallbackLocale()

Overrides org.springframework.web.servlet.support.RequestContext.getFallbackLocale.

This implementation checks for a JSTL locale attribute in page, request, session or application scope; if not found, returns the HttpServletRequest.getLocale().

Returns:Locale

Doc from org.springframework.web.servlet.support.RequestContext.getFallbackLocale.

the fallback locale (never null)

Annotations
@Override
getFallbackTimeZoneback to summary
protected TimeZone getFallbackTimeZone()

Overrides org.springframework.web.servlet.support.RequestContext.getFallbackTimeZone.

This implementation checks for a JSTL time zone attribute in page, request, session or application scope; if not found, returns null.

Returns:TimeZone

Doc from org.springframework.web.servlet.support.RequestContext.getFallbackTimeZone.

the fallback time zone (or null if none derivable from the request)

Annotations
@Override
getPageContextback to summary
protected final PageContext getPageContext()

Return the underlying PageContext. Only intended for cooperating classes in this package.

org.springframework.web.servlet.support back to summary

private Class JspAwareRequestContext.JstlPageLocaleResolver

extends Object
Class Inheritance
  • java.lang.Object
  • org.springframework.web.servlet.support.JspAwareRequestContext.JstlPageLocaleResolver

Inner class that isolates the JSTL dependency. Just called to resolve the fallback locale if the JSTL API is present.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Locale
public static TimeZone
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

JstlPageLocaleResolverback to summary
private JstlPageLocaleResolver()

Method Detail

getJstlLocaleback to summary
public static Locale getJstlLocale(PageContext pageContext)
Annotations
@Nullable
getJstlTimeZoneback to summary
public static TimeZone getJstlTimeZone(PageContext pageContext)
Annotations
@Nullable