public class Embedded extends Object
Embedded
provides easy means to embed JellyEngine
and use Jelly scripts within an application
Embedded embedded = new Embedded();
embedded.setOutputStream(new ByteArrayOutputStream());
embedded.setVariable("some-var","some-object");
.....
embedded.setScript(scriptAsString);
//or one can do.
//embedded.setScript(scriptAsInputStream);
boolean bStatus=embedded.execute();
if(!bStatus) //if error
{
String errorMsg=embedded.getErrorMsg();
}
Constructor and Description |
---|
Embedded()
Default Constructor
|
Modifier and Type | Method and Description |
---|---|
boolean |
execute()
Execute the jelly script and capture the errors (ifany)within.
|
JellyContext |
getContext()
Method getContext.
|
String |
getErrorMsg()
Returns the errorMsg.
|
void |
registerTagLibrary(String namespaceURI,
String className)
Registers the given tag library class name against the given namespace URI.
|
void |
registerTagLibrary(String namespaceURI,
TagLibrary taglib)
Registers the given tag library against the given namespace URI.
|
void |
setContext(JellyContext context)
Method setContext.
|
void |
setOutputStream(OutputStream outputStream)
Method setOutputStream.
|
void |
setScript(InputStream scriptAsInputStream)
Set the input stream
|
void |
setScript(String scriptAsString)
Set the input script
|
void |
setVariable(String name,
Object value)
Set a new variable within the context for the script to use.
|
public void setContext(JellyContext context)
context
- public JellyContext getContext()
public void setVariable(String name, Object value)
name
- value
- public void setScript(String scriptAsString)
scriptAsString
- public void setScript(InputStream scriptAsInputStream)
scriptAsInputStream
- public void setOutputStream(OutputStream outputStream)
outputStream
- public void registerTagLibrary(String namespaceURI, String className)
public void registerTagLibrary(String namespaceURI, TagLibrary taglib)
public String getErrorMsg()
public boolean execute()
JellyException
Copyright © 2014 Apache Software Foundation. All rights reserved.