ServletContextHashModel (FreeMarker 2.3.23 API)
Date: 2015-07-05

freemarker.ext.servlet

## Class ServletContextHashModel

- java.lang.Object
- - freemarker.ext.servlet.ServletContextHashModel

- All Implemented Interfaces:
    TemplateHashModel, TemplateModel

      public final class ServletContextHashModel
      extends Object
      implements TemplateHashModel

  TemplateHashModel wrapper for a ServletContext attributes.

- - ### Field Summary

    - ### Fields inherited from interface freemarker.template.TemplateModel

      `NOTHING`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ServletContextHashModel(javax.servlet.GenericServlet servlet, ObjectWrapper wrapper)`
    `ServletContextHashModel(javax.servlet.ServletContext servletctx, ObjectWrapper wrapper)` Deprecated. use `ServletContextHashModel(GenericServlet, ObjectWrapper)` instead.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `TemplateModel` | `get(String key)` Gets a `TemplateModel` from the hash.
    `javax.servlet.GenericServlet` | `getServlet()` Returns the underlying servlet.
    `boolean` | `isEmpty()`

    - ### 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.GenericServlet servlet,
                                         ObjectWrapper wrapper)

    - #### ServletContextHashModel

          public ServletContextHashModel(javax.servlet.ServletContext servletctx,
                                         ObjectWrapper wrapper)

      Deprecated. use `ServletContextHashModel(GenericServlet, ObjectWrapper)` instead.

  - ### Method Detail

    - #### get

          public TemplateModel get(String key)
                            throws TemplateModelException

      Description copied from interface: `TemplateHashModel`
      Gets a `TemplateModel` from the hash.
      Specified by:
        `get` in interface `TemplateHashModel`
      Parameters:
        `key` - the name by which the `TemplateModel` is identified in the template.
      Returns:
        the `TemplateModel` referred to by the key, or null if not found.
      Throws:
        `TemplateModelException`

    - #### isEmpty

          public boolean isEmpty()

      Specified by:
        `isEmpty` in interface `TemplateHashModel`

    - #### getServlet

          public javax.servlet.GenericServlet getServlet()

      Returns the underlying servlet. Can return null if this object was created using the deprecated constructor.