org.apache.struts2.views.freemarker
Class ScopesHashModel

java.lang.Object
  extended by freemarker.template.WrappingTemplateModel
      extended by freemarker.template.SimpleHash
          extended by org.apache.struts2.views.freemarker.ScopesHashModel
All Implemented Interfaces:
freemarker.template.TemplateHashModel, freemarker.template.TemplateHashModelEx, freemarker.template.TemplateModel, java.io.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

Field Summary
 
Fields inherited from interface freemarker.template.TemplateModel
NOTHING
 
Constructor Summary
ScopesHashModel(freemarker.template.ObjectWrapper objectWrapper, javax.servlet.ServletContext context, javax.servlet.http.HttpServletRequest request)
           
ScopesHashModel(freemarker.template.ObjectWrapper objectWrapper, javax.servlet.ServletContext context, javax.servlet.http.HttpServletRequest request, ValueStack stack)
           
 
Method Summary
 freemarker.template.TemplateModel get(java.lang.String key)
           
 void put(java.lang.String string, boolean b)
           
 void put(java.lang.String string, java.lang.Object object)
           
 void putUnlistedModel(java.lang.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
copyMap, isEmpty, keys, 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 Detail

ScopesHashModel

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

ScopesHashModel

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

putUnlistedModel

public void putUnlistedModel(java.lang.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(java.lang.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(java.lang.String string,
                boolean b)
Overrides:
put in class freemarker.template.SimpleHash

put

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


Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.