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

freemarker.ext.servlet

## Class HttpRequestHashModel

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

- All Implemented Interfaces:
    TemplateHashModel, TemplateHashModelEx, TemplateModel

      public final class HttpRequestHashModel
      extends Object
      implements TemplateHashModelEx

  TemplateHashModel wrapper for a HttpServletRequest attributes.

- - ### Field Summary

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

      `NOTHING`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HttpRequestHashModel(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, ObjectWrapper wrapper)`
    `HttpRequestHashModel(javax.servlet.http.HttpServletRequest request, ObjectWrapper wrapper)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `TemplateModel` | `get(String key)` Gets a `TemplateModel` from the hash.
    `ObjectWrapper` | `getObjectWrapper()`
    `javax.servlet.http.HttpServletRequest` | `getRequest()`
    `javax.servlet.http.HttpServletResponse` | `getResponse()`
    `boolean` | `isEmpty()`
    `TemplateCollectionModel` | `keys()`
    `int` | `size()`
    `TemplateCollectionModel` | `values()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### HttpRequestHashModel

          public HttpRequestHashModel(javax.servlet.http.HttpServletRequest request,
                                      ObjectWrapper wrapper)

      Parameters:
        `wrapper` - Should be an `ObjectWrapperAndUnwrapper`, or else some features might won't work properly. (It's declared as `ObjectWrapper` only for backward compatibility.)

    - #### HttpRequestHashModel

          public HttpRequestHashModel(javax.servlet.http.HttpServletRequest request,
                                      javax.servlet.http.HttpServletResponse response,
                                      ObjectWrapper wrapper)

  - ### 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`

    - #### size

          public int size()

      Specified by:
        `size` in interface `TemplateHashModelEx`
      Returns:
        the number of key/value mappings in the hash.

    - #### keys

          public TemplateCollectionModel keys()

      Specified by:
        `keys` in interface `TemplateHashModelEx`
      Returns:
        a collection containing the keys in the hash. Every element of the returned collection must implement the `TemplateScalarModel` (as the keys of hashes are always strings).

    - #### values

          public TemplateCollectionModel values()

      Specified by:
        `values` in interface `TemplateHashModelEx`
      Returns:
        a collection containing the values in the hash. The elements of the returned collection can be any kind of `TemplateModel`-s.

    - #### getRequest

          public javax.servlet.http.HttpServletRequest getRequest()

    - #### getResponse

          public javax.servlet.http.HttpServletResponse getResponse()

    - #### getObjectWrapper

          public ObjectWrapper getObjectWrapper()