freemarker.ext.servlet
Class ServletContextHashModel

java.lang.Object
  extended by freemarker.ext.servlet.ServletContextHashModel
All Implemented Interfaces:
TemplateHashModel, TemplateModel

public final class ServletContextHashModel
extends java.lang.Object
implements TemplateHashModel

TemplateHashModel wrapper for ServletContext attributes.

Version:
$Id: ServletContextHashModel.java 1115 2013-04-12 04:14:28Z run2000 $
Author:
Attila Szegedi, attila@szegedi.org

Constructor Summary
ServletContextHashModel(javax.servlet.ServletContext servletctx)
          Construct a new ServletContextHashModel.
 
Method Summary
 TemplateModel get(java.lang.String key)
          Retrieve an attribute from the servlet context.
 boolean isEmpty()
          Do we have any attributes in the servlet context?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServletContextHashModel

public ServletContextHashModel(javax.servlet.ServletContext servletctx)
Construct a new ServletContextHashModel.

Parameters:
servletctx - the servlet request to be adapted
Method Detail

get

public TemplateModel get(java.lang.String key)
Retrieve an attribute from the servlet context.

Specified by:
get in interface TemplateHashModel
Parameters:
key - the name of the attribute to be retrieved
Returns:
a TemplateModel wrapping the value we're interested in

isEmpty

public boolean isEmpty()
Do we have any attributes in the servlet context?

Specified by:
isEmpty in interface TemplateModel
Returns:
true if there are no attributes, otherwise false