Class WebContext
- Object
-
- org.thymeleaf.context.AbstractContext
-
- org.thymeleaf.context.WebContext
-
- All Implemented Interfaces:
IContext,IWebContext
public final class WebContext extends AbstractContext implements IWebContext
Basic web-oriented implementation of the
IContextandIWebContextinterfaces.This context implementation contains all the required Servlet-API artifacts needed for template execution in web environments, and should be enough for most web-based scenarios of template processing.
Note a class with this name existed since 2.0.9, but it was completely reimplemented in Thymeleaf 3.0
- Since:
- 3.0.0
- Author:
- Daniel Fernández
-
-
Constructor Summary
Constructors Constructor Description WebContext(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.ServletContext servletContext)WebContext(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.ServletContext servletContext, Locale locale)WebContext(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.ServletContext servletContext, Locale locale, Map<String,Object> variables)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.servlet.http.HttpServletRequestgetRequest()Returns theHttpServletRequestobject associated with the template execution.javax.servlet.http.HttpServletResponsegetResponse()Returns theHttpServletResponseobject associated with the template execution.javax.servlet.ServletContextgetServletContext()Returns theServletContextobject associated with the template execution.javax.servlet.http.HttpSessiongetSession()Returns theHttpSessionobject associated with the template execution, or null if there is no session.-
Methods inherited from class org.thymeleaf.context.AbstractContext
clearVariables, containsVariable, getLocale, getVariable, getVariableNames, removeVariable, setLocale, setVariable, setVariables
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.thymeleaf.context.IContext
containsVariable, getLocale, getVariable, getVariableNames
-
-
-
-
Constructor Detail
-
WebContext
public WebContext(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.ServletContext servletContext)
-
WebContext
public WebContext(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.ServletContext servletContext, Locale locale)
-
-
Method Detail
-
getRequest
public javax.servlet.http.HttpServletRequest getRequest()
Description copied from interface:IWebContextReturns the
HttpServletRequestobject associated with the template execution.- Specified by:
getRequestin interfaceIWebContext- Returns:
- the request object.
-
getSession
public javax.servlet.http.HttpSession getSession()
Description copied from interface:IWebContextReturns the
HttpSessionobject associated with the template execution, or null if there is no session.- Specified by:
getSessionin interfaceIWebContext- Returns:
- the session object. Might be null if no session has been created.
-
getResponse
public javax.servlet.http.HttpServletResponse getResponse()
Description copied from interface:IWebContextReturns the
HttpServletResponseobject associated with the template execution.- Specified by:
getResponsein interfaceIWebContext- Returns:
- the response object.
-
getServletContext
public javax.servlet.ServletContext getServletContext()
Description copied from interface:IWebContextReturns the
ServletContextobject associated with the template execution.- Specified by:
getServletContextin interfaceIWebContext- Returns:
- the servlet context object.
-
-