toolbox.web.template
Class ServletContextTm

Package class diagram package ServletContextTm
java.lang.Object
  extended by toolbox.web.template.ServletContextTm
All Implemented Interfaces:
freemarker.template.TemplateHashModel, freemarker.template.TemplateModel

public class ServletContextTm
extends java.lang.Object
implements freemarker.template.TemplateHashModel

Template model for ServletContext.


Field Summary
 
Fields inherited from interface freemarker.template.TemplateModel
NOTHING
 
Constructor Summary
ServletContextTm()
          Default constructor
ServletContextTm(javax.servlet.ServletContext context, freemarker.template.ObjectWrapper wrapper)
          Construct a TemplateModel with the given ServletContext.
 
Method Summary
 freemarker.template.TemplateModel get(java.lang.String name)
          Returns a TemplateModel instance from the member context.
 boolean isEmpty()
          Check to see if member context has any attributes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServletContextTm

public ServletContextTm()
Default constructor


ServletContextTm

public ServletContextTm(javax.servlet.ServletContext context,
                        freemarker.template.ObjectWrapper wrapper)
Construct a TemplateModel with the given ServletContext.

Parameters:
context - HTTP context.
wrapper - ObjectWrapper
Method Detail

get

public freemarker.template.TemplateModel get(java.lang.String name)
                                      throws freemarker.template.TemplateModelException
Returns a TemplateModel instance from the member context.

This method will attempt to wrap the value of the named context attribute in a suitable TemplateModel.

Specified by:
get in interface freemarker.template.TemplateHashModel
Parameters:
name - Session attribute name.
Returns:
Value of context attribute as a TemplateModel.
Throws:
freemarker.template.TemplateModelException - if the context cannot be wrapped.

isEmpty

public boolean isEmpty()
                throws freemarker.template.TemplateModelException
Check to see if member context has any attributes.

Specified by:
isEmpty in interface freemarker.template.TemplateHashModel
Returns:
boolean indicating whether this model is empty.
Throws:
freemarker.template.TemplateModelException