Package org.apache.struts2.views.freemarker

# Class ScopesHashModel

java.lang.Object
freemarker.template.WrappingTemplateModel
freemarker.template.SimpleHash
org.apache.struts2.views.freemarker.ScopesHashModel

All Implemented Interfaces:
  `freemarker.template.TemplateHashModel`, `freemarker.template.TemplateHashModelEx`, `freemarker.template.TemplateHashModelEx2`, `freemarker.template.TemplateModel`, `Serializable`

public class ScopesHashModel extends freemarker.template.SimpleHash implements freemarker.template.TemplateModel

Simple Hash model that also searches other scopes.

If the key doesn't exist in this hash, this template model tries to resolve the key within the attributes of the following scopes, in the order stated: Request, Session, Servlet Context

Updated to subclass AllHttpScopesHashModel.java to incorporate invisible scopes and compatibility with freemarker.

See Also:
  - Serialized Form

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface freemarker.template.TemplateHashModelEx2

  `freemarker.template.TemplateHashModelEx2.KeyValuePair, freemarker.template.TemplateHashModelEx2.KeyValuePairIterator`

- ## Field Summary

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

  `NOTHING`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ScopesHashModel(freemarker.template.ObjectWrapper objectWrapper, jakarta.servlet.ServletContext context, jakarta.servlet.http.HttpServletRequest request)`
  `ScopesHashModel(freemarker.template.ObjectWrapper objectWrapper, jakarta.servlet.ServletContext context, jakarta.servlet.http.HttpServletRequest request, ValueStack stack)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `freemarker.template.TemplateModel`
  `get(String key)`
  `void`
  `put(String string, boolean b)`
  `void`
  `put(String string, Object object)`
  `void`
  `putUnlistedModel(String key, freemarker.template.TemplateModel model)`
  Stores a model in the hash so that it doesn't show up in `keys()` and `values()` methods.

  ### Methods inherited from class freemarker.template.SimpleHash

  `containsKey, copyMap, isEmpty, keys, keyValuePairIterator, putAll, remove, size, synchronizedWrapper, toMap, toString, values`

  ### Methods inherited from class freemarker.template.WrappingTemplateModel

  `getDefaultObjectWrapper, getObjectWrapper, setDefaultObjectWrapper, setObjectWrapper, wrap`

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

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

- ## Constructor Details

  - ### ScopesHashModel

    public ScopesHashModel(freemarker.template.ObjectWrapper objectWrapper, jakarta.servlet.ServletContext context, jakarta.servlet.http.HttpServletRequest request, ValueStack stack)

  - ### ScopesHashModel

    public ScopesHashModel(freemarker.template.ObjectWrapper objectWrapper, jakarta.servlet.ServletContext context, jakarta.servlet.http.HttpServletRequest request)

- ## Method Details

  - ### putUnlistedModel

    public void putUnlistedModel(String key, freemarker.template.TemplateModel model)
    Stores a model in the hash so that it doesn't show up in `keys()` and `values()` methods. Used to put the Application, Session, Request, RequestParameters and JspTaglibs objects.
    Parameters:
      `key` - the key under which the model is stored
      `model` - the stored model

  - ### get

    public freemarker.template.TemplateModel get(String key) throws freemarker.template.TemplateModelException
    Specified by:
      `get` in interface `freemarker.template.TemplateHashModel`
    Overrides:
      `get` in class `freemarker.template.SimpleHash`
    Throws:
      `freemarker.template.TemplateModelException`

  - ### put

    public void put(String string, boolean b)
    Overrides:
      `put` in class `freemarker.template.SimpleHash`

  - ### put

    public void put(String string, Object object)
    Overrides:
      `put` in class `freemarker.template.SimpleHash`