Package freemarker.ext.servlet
Class HttpSessionHashModel
java.lang.Object
freemarker.ext.servlet.HttpSessionHashModel
- All Implemented Interfaces:
TemplateHashModel,TemplateModel,Serializable
TemplateHashModel wrapper for a HttpSession attributes.
Note that this is for the legacy "javax" Servlet/JSP API; for Jakarta (that is, in modern Servlet containers), use
freemarker.ext.jakarta.servlet.HttpSessionHashModel instead (since 2.3.33).
- See Also:
- Serialized Form
-
Field Summary
Fields inherited from interface freemarker.template.TemplateModel
NOTHING -
Constructor Summary
ConstructorsConstructorDescriptionHttpSessionHashModel(FreemarkerServlet servlet, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, ObjectWrapper wrapper)Use this constructor when the session isn't already created.HttpSessionHashModel(javax.servlet.http.HttpSession session, ObjectWrapper wrapper)Use this constructor when the session already exists. -
Method Summary
-
Constructor Details
-
HttpSessionHashModel
Use this constructor when the session already exists.- Parameters:
session- the sessionwrapper- an object wrapper used to wrap session attributes
-
HttpSessionHashModel
public HttpSessionHashModel(FreemarkerServlet servlet, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, ObjectWrapper wrapper)Use this constructor when the session isn't already created. It is passed enough parameters so that the session can be properly initialized after it's detected that it was created.- Parameters:
servlet- the FreemarkerServlet that created this model. If the model is not created through FreemarkerServlet, leave this argument as null.request- the actual requestresponse- the actual responsewrapper- an object wrapper used to wrap session attributes
-
-
Method Details
-
get
Description copied from interface:TemplateHashModelGets aTemplateModelfrom the hash.- Specified by:
getin interfaceTemplateHashModel- Parameters:
key- The name by which theTemplateModelis identified in the template.- Returns:
- The
TemplateModelreferred to by the key, ornullif not found. - Throws:
TemplateModelException
-
isEmpty
- Specified by:
isEmptyin interfaceTemplateHashModel- Throws:
TemplateModelException
-