Package freemarker.ext.servlet
Class ServletContextHashModel
java.lang.Object
freemarker.ext.servlet.ServletContextHashModel
- All Implemented Interfaces:
TemplateHashModel,TemplateModel
TemplateHashModel wrapper for a ServletContext 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.ServletContextHashModel instead (since 2.3.33).
-
Field Summary
Fields inherited from interface freemarker.template.TemplateModel
NOTHING -
Constructor Summary
ConstructorsConstructorDescriptionServletContextHashModel(javax.servlet.GenericServlet servlet, ObjectWrapper wrapper)ServletContextHashModel(javax.servlet.ServletContext servletctx, ObjectWrapper wrapper)Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionGets aTemplateModelfrom the hash.javax.servlet.GenericServletReturns the underlying servlet.booleanisEmpty()
-
Constructor Details
-
ServletContextHashModel
-
ServletContextHashModel
@Deprecated public ServletContextHashModel(javax.servlet.ServletContext servletctx, ObjectWrapper wrapper)Deprecated.
-
-
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
public boolean isEmpty()- Specified by:
isEmptyin interfaceTemplateHashModel
-
getServlet
public javax.servlet.GenericServlet getServlet()Returns the underlying servlet. Can return null if this object was created using the deprecated constructor.
-
ServletContextHashModel(GenericServlet, ObjectWrapper)instead.