Package com.composum.platform.htl.impl
Class EmulatedPageContext
- java.lang.Object
-
- com.composum.platform.htl.impl.EmulatedPageContext
-
- All Implemented Interfaces:
org.apache.sling.scripting.sightly.pojo.Use
,org.apache.sling.scripting.sightly.Record<Object>
public class EmulatedPageContext extends Object implements org.apache.sling.scripting.sightly.pojo.Use, org.apache.sling.scripting.sightly.Record<Object>
Implements a kind of pagecontext for HTL by putting a map into a request attribute, to enable communication between templates. There are separate maps for each script name - that is, the resource of the script.- Since:
- 09/2017
- Author:
- Hans-Peter Stoerr
-
-
Field Summary
Fields Modifier and Type Field Description static String
REQUESTATTR_PAGECONTEXTMAP
Map<String,Map<String,Object>> from scriptname to simulated pagecontext map, since the scriptname is the script resource and the bindings are generated freshly each call.protected Map<String,Object>
simulatedPageContext
-
Constructor Summary
Constructors Constructor Description EmulatedPageContext()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,Object>
asMap()
Returns the emulated page context as a map.Object
getProperty(String name)
Set<String>
getPropertyNames()
protected static String
getScriptName(Bindings bindings)
void
init(Bindings bindings)
Initializes the maps.static Map<String,Object>
map(Bindings bindings)
Allows easy access to the map when used in Java Code: returns the actual map used.
-
-
-
Field Detail
-
REQUESTATTR_PAGECONTEXTMAP
public static final String REQUESTATTR_PAGECONTEXTMAP
Map<String,Map<String,Object>> from scriptname to simulated pagecontext map, since the scriptname is the script resource and the bindings are generated freshly each call.
-
-
Method Detail
-
init
public void init(Bindings bindings)
Initializes the maps.- Specified by:
init
in interfaceorg.apache.sling.scripting.sightly.pojo.Use
-
map
public static Map<String,Object> map(Bindings bindings)
Allows easy access to the map when used in Java Code: returns the actual map used.
-
getProperty
public Object getProperty(String name)
- Specified by:
getProperty
in interfaceorg.apache.sling.scripting.sightly.Record<Object>
-
getPropertyNames
public Set<String> getPropertyNames()
- Specified by:
getPropertyNames
in interfaceorg.apache.sling.scripting.sightly.Record<Object>
-
-