public final class WebContext extends AbstractContext implements IWebContext
Basic web-oriented implementation of the IContext
and IWebContext
interfaces.
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
Constructor and 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) |
Modifier and Type | Method and Description |
---|---|
javax.servlet.http.HttpServletRequest |
getRequest()
Returns the
HttpServletRequest object associated with the template execution. |
javax.servlet.http.HttpServletResponse |
getResponse()
Returns the
HttpServletResponse object associated with the template execution. |
javax.servlet.ServletContext |
getServletContext()
Returns the
ServletContext object associated with the template execution. |
javax.servlet.http.HttpSession |
getSession()
Returns the
HttpSession object associated with the template execution, or null if
there is no session. |
clearVariables, containsVariable, getLocale, getVariable, getVariableNames, removeVariable, setLocale, setVariable, setVariables
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
containsVariable, getLocale, getVariable, getVariableNames
public WebContext(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.ServletContext servletContext)
public WebContext(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.ServletContext servletContext, Locale locale)
public javax.servlet.http.HttpServletRequest getRequest()
IWebContext
Returns the HttpServletRequest
object associated with the template execution.
getRequest
in interface IWebContext
public javax.servlet.http.HttpSession getSession()
IWebContext
Returns the HttpSession
object associated with the template execution, or null if
there is no session.
getSession
in interface IWebContext
public javax.servlet.http.HttpServletResponse getResponse()
IWebContext
Returns the HttpServletResponse
object associated with the template execution.
getResponse
in interface IWebContext
public javax.servlet.ServletContext getServletContext()
IWebContext
Returns the ServletContext
object associated with the template execution.
getServletContext
in interface IWebContext
Copyright © 2016 The THYMELEAF team. All rights reserved.