Spring Framework

org.springframework.web.servlet.support
Class JspAwareRequestContext

java.lang.Object
  extended by org.springframework.web.servlet.support.RequestContext
      extended by org.springframework.web.servlet.support.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()

Field Summary
 
Fields inherited from class org.springframework.web.servlet.support.RequestContext
DEFAULT_THEME_NAME, jstlPresent, WEB_APPLICATION_CONTEXT_ATTRIBUTE
 
Constructor Summary
JspAwareRequestContext(javax.servlet.jsp.PageContext pageContext)
          Create a new JspAwareRequestContext for the given page context, using the request attributes for Errors retrieval.
JspAwareRequestContext(javax.servlet.jsp.PageContext pageContext, 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.
 
Method Summary
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().
protected  javax.servlet.jsp.PageContext getPageContext()
          Return the underlying PageContext.
protected  void initContext(javax.servlet.jsp.PageContext pageContext, java.util.Map<java.lang.String,java.lang.Object> model)
          Initialize this context with the given page context, using the given model attributes for Errors retrieval.
 
Methods inherited from class org.springframework.web.servlet.support.RequestContext
getBindStatus, getBindStatus, getContextPath, getContextUrl, getContextUrl, getDefaultHtmlEscape, getErrors, getErrors, getFallbackTheme, getLocale, getMessage, getMessage, getMessage, getMessage, getMessage, getMessage, getMessage, getMessage, getMessage, getMessage, getMessageSource, getModel, getModelObject, getPathToServlet, getQueryString, getRequest, getRequestDataValueProcessor, getRequestUri, getServletContext, getTheme, getThemeMessage, getThemeMessage, getThemeMessage, getThemeMessage, getThemeMessage, getThemeMessage, getThemeMessage, getUrlPathHelper, getWebApplicationContext, initContext, isDefaultHtmlEscape, setDefaultHtmlEscape, setUrlPathHelper
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JspAwareRequestContext

public JspAwareRequestContext(javax.servlet.jsp.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(javax.servlet.jsp.PageContext pageContext,
                              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

initContext

protected void initContext(javax.servlet.jsp.PageContext pageContext,
                           java.util.Map<java.lang.String,java.lang.Object> model)
Initialize this context with 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)

getPageContext

protected final javax.servlet.jsp.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()

Spring Framework