Package org.zaproxy.zap.extension.script
Class ScriptWrapper
- java.lang.Object
-
- org.zaproxy.zap.extension.script.ScriptWrapper
-
public class ScriptWrapper extends java.lang.Object
-
-
Constructor Summary
Constructors Modifier Constructor Description ScriptWrapper()
protected
ScriptWrapper(java.lang.String name, java.lang.String description, java.lang.String engineName, java.lang.String typeName, boolean enabled, java.io.File file)
ScriptWrapper(java.lang.String name, java.lang.String description, java.lang.String engineName, ScriptType type, boolean enabled, java.io.File file)
ScriptWrapper(java.lang.String name, java.lang.String description, ScriptEngineWrapper engine, ScriptType type)
ScriptWrapper(java.lang.String name, java.lang.String description, ScriptEngineWrapper engine, ScriptType type, boolean enabled, java.io.File file)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.String
getContents()
java.lang.String
getDescription()
ScriptEngineWrapper
getEngine()
Gets the script engine wrapper.java.lang.String
getEngineName()
java.io.File
getFile()
<T> T
getInterface(java.lang.Class<T> class1)
java.lang.String
getLastErrorDetails()
java.lang.Exception
getLastException()
java.lang.String
getLastOutput()
int
getModCount()
Gets the mod count.java.lang.String
getName()
ScriptType
getType()
java.lang.String
getTypeName()
java.io.Writer
getWriter()
Gets the writer which will be written to every time this script runs (if any)boolean
hasChangedOnDisk()
Returns true if the script has changed on disk since it was loaded into this classboolean
isChanged()
boolean
isEnabled()
boolean
isError()
boolean
isLoadOnStart()
boolean
isRunableStandalone()
Deprecated.(2.11.0) UseisRunnableStandalone()
boolean
isRunnableStandalone()
void
reloadScript()
Reloads the script.void
setChanged(boolean changed)
void
setContents(java.lang.String contents)
void
setDescription(java.lang.String description)
void
setEnabled(boolean enabled)
Sets if this script is enabled.void
setEngine(ScriptEngineWrapper engine)
void
setEngineName(java.lang.String engineName)
void
setError(boolean error)
void
setFile(java.io.File file)
void
setLastErrorDetails(java.lang.String lastErrorDetails)
void
setLastException(java.lang.Exception lastException)
void
setLastOutput(java.lang.String lastOutput)
void
setLoadOnStart(boolean loadOnStart)
void
setName(java.lang.String name)
void
setType(ScriptType type)
void
setWriter(java.io.Writer writer)
Set a writer which will be written to every time this script runs
-
-
-
Constructor Detail
-
ScriptWrapper
public ScriptWrapper()
-
ScriptWrapper
public ScriptWrapper(java.lang.String name, java.lang.String description, ScriptEngineWrapper engine, ScriptType type)
-
ScriptWrapper
public ScriptWrapper(java.lang.String name, java.lang.String description, java.lang.String engineName, ScriptType type, boolean enabled, java.io.File file)
-
ScriptWrapper
public ScriptWrapper(java.lang.String name, java.lang.String description, ScriptEngineWrapper engine, ScriptType type, boolean enabled, java.io.File file)
-
ScriptWrapper
protected ScriptWrapper(java.lang.String name, java.lang.String description, java.lang.String engineName, java.lang.String typeName, boolean enabled, java.io.File file)
-
-
Method Detail
-
getName
public java.lang.String getName()
-
setName
public void setName(java.lang.String name)
-
getDescription
public java.lang.String getDescription()
-
setDescription
public void setDescription(java.lang.String description)
-
getEngine
public ScriptEngineWrapper getEngine()
Gets the script engine wrapper. Might benull
if the engine is not installed or was not yet set.- Returns:
- the engine of the script, or
null
if not installed or was not yet set
-
setEngine
public void setEngine(ScriptEngineWrapper engine)
-
setEngineName
public void setEngineName(java.lang.String engineName)
-
getEngineName
public java.lang.String getEngineName()
-
getType
public ScriptType getType()
-
setType
public void setType(ScriptType type)
-
getTypeName
public java.lang.String getTypeName()
-
getContents
public java.lang.String getContents()
-
setContents
public void setContents(java.lang.String contents)
-
getModCount
public int getModCount()
Gets the mod count.The value is different each time the contents of the script change.
- Returns:
- the mod count.
- Since:
- 2.10.0
-
getLastOutput
public java.lang.String getLastOutput()
-
setLastOutput
public void setLastOutput(java.lang.String lastOutput)
-
isChanged
public boolean isChanged()
-
setChanged
public void setChanged(boolean changed)
-
isEnabled
public boolean isEnabled()
-
setEnabled
public void setEnabled(boolean enabled)
Sets if this script is enabled.It's not possible to enable scripts without engine.
- Parameters:
enabled
-true
if the script should be enabled,false
otherwise- See Also:
getEngine()
-
getLastErrorDetails
public java.lang.String getLastErrorDetails()
-
setLastErrorDetails
public void setLastErrorDetails(java.lang.String lastErrorDetails)
-
getLastException
public java.lang.Exception getLastException()
-
setLastException
public void setLastException(java.lang.Exception lastException)
-
isError
public boolean isError()
-
setError
public void setError(boolean error)
-
isLoadOnStart
public boolean isLoadOnStart()
-
setLoadOnStart
public void setLoadOnStart(boolean loadOnStart)
-
getFile
public java.io.File getFile()
-
setFile
public void setFile(java.io.File file)
-
getInterface
public <T> T getInterface(java.lang.Class<T> class1) throws javax.script.ScriptException, java.io.IOException
- Throws:
javax.script.ScriptException
java.io.IOException
-
isRunableStandalone
@Deprecated public boolean isRunableStandalone()
Deprecated.(2.11.0) UseisRunnableStandalone()
-
isRunnableStandalone
public boolean isRunnableStandalone()
-
getWriter
public java.io.Writer getWriter()
Gets the writer which will be written to every time this script runs (if any)- Returns:
-
setWriter
public void setWriter(java.io.Writer writer)
Set a writer which will be written to every time this script runs- Parameters:
writer
-
-
reloadScript
public void reloadScript() throws java.io.IOException
Reloads the script. It should only be called if the script has already been loaded vialoadScript(Charset)
- Throws:
java.io.IOException
- Since:
- 2.8.0
-
hasChangedOnDisk
public boolean hasChangedOnDisk()
Returns true if the script has changed on disk since it was loaded into this class- Returns:
- true if the script has changed on disk since it was loaded into this class
- Since:
- 2.8.0
-
-