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
ConstructorDescriptionServletContextHashModel(javax.servlet.GenericServlet servlet, ObjectWrapper wrapper)
ServletContextHashModel(javax.servlet.ServletContext servletctx, ObjectWrapper wrapper)
Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionGets aTemplateModel
from the hash.javax.servlet.GenericServlet
Returns the underlying servlet.boolean
isEmpty()
-
Constructor Details
-
ServletContextHashModel
-
ServletContextHashModel
@Deprecated public ServletContextHashModel(javax.servlet.ServletContext servletctx, ObjectWrapper wrapper)Deprecated.
-
-
Method Details
-
get
Description copied from interface:TemplateHashModel
Gets aTemplateModel
from the hash.- Specified by:
get
in interfaceTemplateHashModel
- Parameters:
key
- The name by which theTemplateModel
is identified in the template.- Returns:
- The
TemplateModel
referred to by the key, ornull
if not found. - Throws:
TemplateModelException
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in 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.