public abstract class AbstractScriptableHeapObject extends GenericHeapObject
filters
and handlers
. This heap
object acts as a simple wrapper around the scripting engine. Scripts are
provided with the following variable bindings:
globals
- the Map of global variables which persist across
successive invocations of the script
context
- the associated request context
contexts
- the visible contexts, keyed by context's name
request
- the HTTP request
http
- an HTTP client which may be used for performing outbound HTTP requests
ldap
- an OpenIG LDAP client which may be used for
performing LDAP requests such as LDAP authentication
logger
- the OpenIG logger
next
- if the heap object is a filter then this variable
will contain the next handler in the filter chain.
heap
- the heap.
NOTE: at the moment only Groovy is supported.
NOTE: As of OpenIG 4.0, exchange.request
and exchange.response
are not set anymore.
Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractScriptableHeapObject.AbstractScriptableHeaplet
Creates and initializes a capture filter in a heap environment.
|
logger, storage
Modifier | Constructor and Description |
---|---|
protected |
AbstractScriptableHeapObject(Script compiledScript,
Heap heap)
Creates a new scriptable heap object using the provided compiled script.
|
Modifier and Type | Method and Description |
---|---|
protected Promise<Response,NeverThrowsException> |
runScript(Bindings bindings,
Handler next,
Context context)
Runs the compiled script using the provided bindings and optional
forwarding handler.
|
void |
setArgs(Map<String,Object> args)
Sets the parameters which should be made available to scripts.
|
void |
setClientHandler(Handler clientHandler)
Sets the HTTP client handler which should be made available to scripts.
|
getLogger, getStorage, setLogger, setStorage
protected AbstractScriptableHeapObject(Script compiledScript, Heap heap)
compiledScript
- The compiled script.heap
- The heap to look for bindingspublic void setClientHandler(Handler clientHandler)
clientHandler
- The HTTP client handler which should be made available to scripts.public void setArgs(Map<String,Object> args)
args
- The parameters which should be made available to scripts.protected final Promise<Response,NeverThrowsException> runScript(Bindings bindings, Handler next, Context context)
bindings
- Base bindings available to the script (will be enriched).next
- The next handler in the chain if applicable, may be
null
.context
- request processing contextCopyright 2011-2015 ForgeRock AS.