Package freemarker.ext.servlet
Class HttpRequestHashModel
java.lang.Object
freemarker.ext.servlet.HttpRequestHashModel
- All Implemented Interfaces:
TemplateHashModel,TemplateHashModelEx,TemplateModel
TemplateHashModel wrapper for a HttpServletRequest attributes.
Note that this is for the legacy "javax" Servlet/JSP API; for Jakarta (that is, in modern Servlet containers), use
freemarker.ext.jakarta.servlet.HttpRequestHashModel instead (since 2.3.33).
-
Field Summary
Fields inherited from interface freemarker.template.TemplateModel
NOTHING -
Constructor Summary
ConstructorsConstructorDescriptionHttpRequestHashModel(javax.servlet.http.HttpServletRequest request, ObjectWrapper wrapper)HttpRequestHashModel(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, ObjectWrapper wrapper) -
Method Summary
-
Constructor Details
-
HttpRequestHashModel
- Parameters:
wrapper- Should be anObjectWrapperAndUnwrapper, or else some features might won't work properly. (It's declared asObjectWrapperonly for backward compatibility.)
-
HttpRequestHashModel
public HttpRequestHashModel(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, ObjectWrapper wrapper)
-
-
Method Details
-
get
Description copied from interface:TemplateHashModelGets aTemplateModelfrom the hash.- Specified by:
getin interfaceTemplateHashModel- Parameters:
key- The name by which theTemplateModelis identified in the template.- Returns:
- The
TemplateModelreferred to by the key, ornullif not found. - Throws:
TemplateModelException
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceTemplateHashModel
-
size
public int size()- Specified by:
sizein interfaceTemplateHashModelEx- Returns:
- the number of key/value mappings in the hash.
-
keys
- Specified by:
keysin interfaceTemplateHashModelEx- 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
- Specified by:
valuesin interfaceTemplateHashModelEx- 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
-