public final class JellyBuilder
extends groovy.lang.GroovyObjectSupport
Constructor and Description |
---|
JellyBuilder(org.apache.commons.jelly.JellyContext context,
org.apache.commons.jelly.XMLOutput output) |
Modifier and Type | Method and Description |
---|---|
void |
adjunct(String name)
Includes the specified adjunct.
|
protected void |
doInvokeMethod(groovy.xml.QName name,
Object args) |
JellyBuilder |
getBuilder() |
org.apache.commons.jelly.JellyContext |
getContext() |
Object |
getMy()
Gets the "it" object.
|
org.apache.commons.jelly.XMLOutput |
getOutput() |
Object |
getProperty(String property)
Allows values from
JellyContext to be read
like global variables. |
StaplerRequest |
getRequest() |
StaplerResponse |
getResponse() |
String |
getRootURL()
Gets the absolute URL to the top of the webapp.
|
javax.servlet.ServletContext |
getServletContext() |
void |
img(Object base,
String localName)
Generates an
<IMG> tag to the resource. |
void |
include(Class clazz,
String view)
Includes another view.
|
void |
include(Object it,
String view)
Includes another view.
|
Namespace |
jelly(Class t)
Loads a jelly tag library.
|
Object |
methodMissing(String name,
Object args) |
<T extends TypedTagLibrary> |
namespace(Class<T> type) |
Namespace |
namespace(String nsUri) |
Namespace |
namespace(String nsUri,
String prefix)
This is used to allow QName to be used for the invocation.
|
void |
raw(Object o)
Generates HTML fragment from string.
|
org.dom4j.Element |
redirectToDom(groovy.lang.Closure c)
Captures the XML fragment generated by the given closure into dom4j DOM tree
and return the root element.
|
String |
res(Object base,
String localName)
Yields a URL to the given resource.
|
void |
set(String var,
Object value)
Sets the value to
JellyContext (typically as a pre-cursor to calling into Jelly tags.) |
org.apache.commons.jelly.XMLOutput |
setOutput(org.apache.commons.jelly.XMLOutput newValue) |
Object |
taglib(Class type)
Loads a Groovy tag lib instance.
|
void |
text(Object o)
Writes PCDATA.
|
Object |
with(org.apache.commons.jelly.XMLOutput out,
groovy.lang.Closure c)
Executes the closure with the specified
XMLOutput . |
public JellyBuilder(org.apache.commons.jelly.JellyContext context, org.apache.commons.jelly.XMLOutput output)
public Namespace namespace(String nsUri, String prefix)
public <T extends TypedTagLibrary> T namespace(Class<T> type)
public org.apache.commons.jelly.XMLOutput getOutput()
public org.apache.commons.jelly.JellyContext getContext()
public void include(Object it, String view) throws IOException, org.apache.commons.jelly.JellyException
IOException
org.apache.commons.jelly.JellyException
public void include(Class clazz, String view) throws IOException, org.apache.commons.jelly.JellyException
IOException
org.apache.commons.jelly.JellyException
protected void doInvokeMethod(groovy.xml.QName name, Object args)
public org.apache.commons.jelly.XMLOutput setOutput(org.apache.commons.jelly.XMLOutput newValue)
public Object with(org.apache.commons.jelly.XMLOutput out, groovy.lang.Closure c)
XMLOutput
.public org.dom4j.Element redirectToDom(groovy.lang.Closure c)
public Object getProperty(String property)
JellyContext
to be read
like global variables. These includes 'request', 'response', etc.getProperty
in interface groovy.lang.GroovyObject
getProperty
in class groovy.lang.GroovyObjectSupport
JellyClassTearOff
public void set(String var, Object value)
JellyContext
(typically as a pre-cursor to calling into Jelly tags.)public Object getMy()
public void text(Object o) throws SAXException
Any HTML unsafe characters in the string representation of the given object is properly escaped.
SAXException
raw(Object)
public void raw(Object o) throws SAXException
The string representation of the object is assumed to produce proper HTML. No further escaping is performed.
SAXException
text(Object)
public Object taglib(Class type) throws IllegalAccessException, InstantiationException, IOException, SAXException
A groovy tag library is really just a script class with bunch of method definitions,
without any explicit class definition. Such a class is loaded as a subtype of
GroovyClosureScript
so that it can use this builder as the delegation target.
This method instanciates the class (if not done so already for this request), and return it.
public void adjunct(String name) throws IOException, SAXException
IOException
SAXException
public Namespace jelly(Class t)
t
- If this is a subtype of TagLibrary
, then that tag library is loaded and bound to the
Namespace
object, which you can later use to call tags.
Otherwise, t has to have 'taglib' file in the resource and sibling "*.jelly" files will be treated
as tag files.public javax.servlet.ServletContext getServletContext()
public StaplerRequest getRequest()
public StaplerResponse getResponse()
public JellyBuilder getBuilder()
public String getRootURL()
HttpServletRequest.getContextPath()
public void img(Object base, String localName) throws SAXException
<IMG>
tag to the resource.SAXException
public String res(Object base, String localName)
base
- The base class/object for which the 'localName' parameter
is resolved from. If this is class, 'localName' is assumed
to be a resource of this class. If it's other objects,
'localName' is assumed to be a resource of the class of this object.Copyright © 2015. All rights reserved.