public class JSScriptProcessor extends AbstractScriptProcessor implements ScriptResourceLoader
| Modifier and Type | Class and Description |
|---|---|
static class |
JSScriptProcessor.PresentationWrapFactory
Wrap Factory for Rhino Script Engine
|
processorExtensions| Constructor and Description |
|---|
JSScriptProcessor() |
| Modifier and Type | Method and Description |
|---|---|
Object |
executeScript(ScriptContent location,
Map<String,Object> model)
Execute script
|
Object |
executeScript(String path,
Map<String,Object> model)
Execute script
|
ScriptContent |
findScript(String path)
Find a script at the specified path (within registered Web Script stores)
|
String |
getExtension()
The file extension that the processor is associated with, null if none.
|
String |
getName()
Get the name of the processor
|
void |
init()
Inits the processor
|
protected void |
initProcessor()
Inits the processor.
|
protected org.mozilla.javascript.Scriptable |
initScope(org.mozilla.javascript.Context cx,
boolean secure,
boolean sealed)
Initializes a scope for script execution.
|
protected boolean |
isDebugMode() |
String |
loadScriptResource(String resource)
Load a script content from the specific resource path.
|
void |
reset()
Reset script cache
|
void |
setCompile(boolean compile) |
void |
setConfigService(ConfigService configService)
Sets the config service.
|
void |
setShareSealedScopes(boolean shareSealedScopes) |
Object |
unwrapValue(Object value)
Unwrap value returned by script
TODO: Remove this method when value conversion is truly hidden within script engine
|
addProcessorModelExtensions, getScriptLoader, getSearchPath, initLoaders, register, setSearchPathgetScriptProcessorRegistry, onApplicationEvent, setApplicationContext, setScriptProcessorRegistryregisterProcessorExtensionpublic void setConfigService(ConfigService configService)
configService - The ConfigServicepublic void setCompile(boolean compile)
compile - the compile flag to setpublic void setShareSealedScopes(boolean shareSealedScopes)
shareSealedScopes - true to allow sharing of sealed scopes between script executions - set to
false to disable this feature and ensure that a new scope is created for each executed script.public String getExtension()
ProcessorgetExtension in interface Processorpublic String getName()
Processorpublic void init()
BaseRegisterableScriptProcessorinit in class AbstractScriptProcessorpublic ScriptContent findScript(String path)
ScriptProcessorfindScript in interface ScriptProcessorpath - script pathpublic Object executeScript(String path, Map<String,Object> model)
ScriptProcessorexecuteScript in interface ScriptProcessorpath - script pathmodel - modelpublic Object executeScript(ScriptContent location, Map<String,Object> model)
ScriptProcessorexecuteScript in interface ScriptProcessorlocation - script locationmodel - modelpublic String loadScriptResource(String resource)
loadScriptResource in interface ScriptResourceLoaderresource - Script resource to load. Supports either classpath: prefix syntax or a
resource path within the webscript stores.public Object unwrapValue(Object value)
ScriptProcessorunwrapValue in interface ScriptProcessorvalue - value to unwrappublic void reset()
ScriptProcessorreset in interface ScriptProcessorprotected void initProcessor()
protected org.mozilla.javascript.Scriptable initScope(org.mozilla.javascript.Context cx,
boolean secure,
boolean sealed)
cx - the thread execution contextsecure - Do we consider the script secure? When false this ensures the script may not
access insecure java.* libraries or import any other classes for direct access - only the
configured root host objects will be available to the script writer.sealed - Should the scope be sealed, making it immutable? This should be true if a scope
is to be reused.protected boolean isDebugMode()
Copyright © 2005–2019 Alfresco Software. All rights reserved.