|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Objectorg.thymeleaf.context.AbstractContext
org.thymeleaf.context.WebContext
public class WebContext
Standard implementation for the IWebContext interface.
This IContext implementation uses a WebContextExecutionInfo object as its
IContextExecutionInfo implementation.
| Field Summary | |
|---|---|
static String |
APPLICATION_VARIABLE_NAME
Name of the context variable that contains the application (servlet context) attributes. |
static String |
PARAM_VARIABLE_NAME
Name of the context variable that contains the request parameters. |
static String |
SESSION_VARIABLE_NAME
Name of the context variable that contains the session attributes. |
| Fields inherited from class org.thymeleaf.context.AbstractContext |
|---|
EXEC_INFO_VARIABLE_NAME |
| Constructor Summary | |
|---|---|
WebContext(javax.servlet.http.HttpServletRequest request)
Create an instance without specifying a locale. |
|
WebContext(javax.servlet.http.HttpServletRequest request,
Locale locale)
Create an instance specifying a locale. |
|
WebContext(javax.servlet.http.HttpServletRequest request,
Locale locale,
Map<String,?> variables)
Create an instance specifying a locale and an initial set of context variables. |
|
| Method Summary | |
|---|---|
protected IContextExecutionInfo |
buildContextExecutionInfo(String templateName)
Creates the specific instance of IContextExecutionInfo to be added
to the context as the execInfo variable. |
VariablesMap<String,Object> |
getApplicationAttributes()
Returns a VariablesMap object with all the attributes associated
with the ServletContext object linked to the
HttpServletRequest used for creating the context. |
String |
getContextPath()
Returns the context path associated with the web application. |
javax.servlet.http.HttpServletRequest |
getHttpServletRequest()
Returns the HttpServletRequest object associated with the
request this context has been created for. |
javax.servlet.http.HttpSession |
getHttpSession()
Returns the HttpSession object associated with the
request this context has been created for. |
VariablesMap<String,Object> |
getRequestAttributes()
Returns a VariablesMap object with all the attributes associated
with the HttpServletRequest used for creating the context. |
VariablesMap<String,String[]> |
getRequestParameters()
Returns a VariablesMap object with all the parameters associated
with the HttpServletRequest used for creating the context. |
javax.servlet.ServletContext |
getServletContext()
Returns the ServletContext object associated with the
web application. |
VariablesMap<String,Object> |
getSessionAttributes()
Returns a VariablesMap object with all the attributes associated
with the HttpSession object linked to the
HttpServletRequest used for creating the context. |
String |
getSessionID()
Returns the session ID associated with the current execution of the template engine. |
boolean |
isSessionIdFromCookie()
Returns whether the session ID is currently being kept by using cookies or an URL fragment. |
| Methods inherited from class org.thymeleaf.context.AbstractContext |
|---|
addContextExecutionInfo, clearVariables, getLocale, getVariables, setLocale, setVariable, setVariables |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.thymeleaf.context.IContext |
|---|
addContextExecutionInfo, getLocale, getVariables |
| Field Detail |
|---|
public static final String PARAM_VARIABLE_NAME
Name of the context variable that contains the request parameters.
public static final String SESSION_VARIABLE_NAME
Name of the context variable that contains the session attributes.
public static final String APPLICATION_VARIABLE_NAME
Name of the context variable that contains the application (servlet context) attributes.
| Constructor Detail |
|---|
public WebContext(javax.servlet.http.HttpServletRequest request)
Create an instance without specifying a locale. Using this constructor, the default locale (Locale.getDefault()) will be used.
request - the HttpServletRequest that this context will be related to.
public WebContext(javax.servlet.http.HttpServletRequest request,
Locale locale)
Create an instance specifying a locale.
request - the HttpServletRequest that this context will be related to.locale - the locale to be used.
public WebContext(javax.servlet.http.HttpServletRequest request,
Locale locale,
Map<String,?> variables)
Create an instance specifying a locale and an initial set of context variables.
request - the HttpServletRequest that this context will be related to.locale - the locale to be used.variables - the initial set of context variables.| Method Detail |
|---|
public javax.servlet.http.HttpServletRequest getHttpServletRequest()
IWebContext
Returns the HttpServletRequest object associated with the
request this context has been created for.
getHttpServletRequest in interface IWebContextpublic javax.servlet.http.HttpSession getHttpSession()
IWebContext
Returns the HttpSession object associated with the
request this context has been created for.
getHttpSession in interface IWebContextpublic javax.servlet.ServletContext getServletContext()
IWebContext
Returns the ServletContext object associated with the
web application.
getServletContext in interface IWebContextpublic String getContextPath()
IWebContextReturns the context path associated with the web application.
getContextPath in interface IWebContextpublic String getSessionID()
IWebContextReturns the session ID associated with the current execution of the template engine. This ID corresponds with the jsessionid URL fragment or cookie from the HTTP request.
getSessionID in interface IWebContextpublic boolean isSessionIdFromCookie()
IWebContextReturns whether the session ID is currently being kept by using cookies or an URL fragment.
isSessionIdFromCookie in interface IWebContextpublic VariablesMap<String,String[]> getRequestParameters()
IWebContext
Returns a VariablesMap object with all the parameters associated
with the HttpServletRequest used for creating the context.
getRequestParameters in interface IWebContextpublic VariablesMap<String,Object> getRequestAttributes()
IWebContext
Returns a VariablesMap object with all the attributes associated
with the HttpServletRequest used for creating the context.
getRequestAttributes in interface IWebContextpublic VariablesMap<String,Object> getSessionAttributes()
IWebContext
Returns a VariablesMap object with all the attributes associated
with the HttpSession object linked to the
HttpServletRequest used for creating the context.
getSessionAttributes in interface IWebContextpublic VariablesMap<String,Object> getApplicationAttributes()
IWebContext
Returns a VariablesMap object with all the attributes associated
with the ServletContext object linked to the
HttpServletRequest used for creating the context.
getApplicationAttributes in interface IWebContextprotected IContextExecutionInfo buildContextExecutionInfo(String templateName)
AbstractContext
Creates the specific instance of IContextExecutionInfo to be added
to the context as the execInfo variable.
buildContextExecutionInfo in class AbstractContexttemplateName - the name of the template being executed
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||