Package org.kohsuke.stapler.jelly.groovy
Class JellyBuilder
java.lang.Object
groovy.lang.GroovyObjectSupport
org.kohsuke.stapler.jelly.groovy.JellyBuilder
- All Implemented Interfaces:
groovy.lang.GroovyObject
public final class JellyBuilder
extends groovy.lang.GroovyObjectSupport
Drive Jelly scripts from Groovy markup.
- Author:
- Kohsuke Kawaguchi
-
Constructor Summary
ConstructorsConstructorDescriptionJellyBuilder(org.apache.commons.jelly.JellyContext context, org.apache.commons.jelly.XMLOutput output) -
Method Summary
Modifier and TypeMethodDescriptionvoidIncludes the specified adjunct.protected voiddoInvokeMethod(groovy.xml.QName name, Object args) org.apache.commons.jelly.JellyContextgetMy()Gets the "it" object.org.apache.commons.jelly.XMLOutputgetProperty(String property) Allows values fromJellyContextto be read like global variables.org.kohsuke.stapler.StaplerRequest2org.kohsuke.stapler.StaplerResponse2Gets the absolute URL to the top of the webapp.jakarta.servlet.ServletContextvoidGenerates an<IMG>tag to the resource.voidIncludes another view.voidIncludes another view.Loads a jelly tag library.methodMissing(String name, Object args) <T extends TypedTagLibrary>
TThis is used to allow QName to be used for the invocation.voidGenerates HTML fragment from string.org.dom4j.ElementredirectToDom(groovy.lang.Closure c) Captures the XML fragment generated by the given closure into dom4j DOM tree and return the root element.Yields a URL to the given resource.voidSets the value toJellyContext(typically as a pre-cursor to calling into Jelly tags.)org.apache.commons.jelly.XMLOutputsetOutput(org.apache.commons.jelly.XMLOutput newValue) Loads a Groovy tag lib instance.voidWrites PCDATA.with(org.apache.commons.jelly.XMLOutput out, groovy.lang.Closure c) Executes the closure with the specifiedXMLOutput.Methods inherited from class groovy.lang.GroovyObjectSupport
getMetaClass, invokeMethod, setMetaClass, setProperty
-
Constructor Details
-
JellyBuilder
public JellyBuilder(org.apache.commons.jelly.JellyContext context, org.apache.commons.jelly.XMLOutput output)
-
-
Method Details
-
namespace
This is used to allow QName to be used for the invocation. -
namespace
-
namespace
-
getOutput
public org.apache.commons.jelly.XMLOutput getOutput() -
getContext
public org.apache.commons.jelly.JellyContext getContext() -
include
public void include(Object it, String view) throws IOException, org.apache.commons.jelly.JellyException Includes another view.- Throws:
IOExceptionorg.apache.commons.jelly.JellyException
-
include
public void include(Class clazz, String view) throws IOException, org.apache.commons.jelly.JellyException Includes another view.- Throws:
IOExceptionorg.apache.commons.jelly.JellyException
-
methodMissing
-
doInvokeMethod
-
setOutput
public org.apache.commons.jelly.XMLOutput setOutput(org.apache.commons.jelly.XMLOutput newValue) -
with
Executes the closure with the specifiedXMLOutput. -
redirectToDom
public 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.- Returns:
- null if nothing was generated.
-
getProperty
Allows values fromJellyContextto be read like global variables. These includes 'request', 'response', etc.- Specified by:
getPropertyin interfacegroovy.lang.GroovyObject- Overrides:
getPropertyin classgroovy.lang.GroovyObjectSupport- See Also:
-
set
Sets the value toJellyContext(typically as a pre-cursor to calling into Jelly tags.) -
getMy
Gets the "it" object. In Groovy "it" is reserved word with a specific meaning, so instead use "my" as the word. -
text
Writes PCDATA.Any HTML unsafe characters in the string representation of the given object is properly escaped.
- Throws:
SAXException- See Also:
-
raw
Generates HTML fragment from string.The string representation of the object is assumed to produce proper HTML. No further escaping is performed.
- Throws:
SAXException- See Also:
-
taglib
Loads a Groovy tag lib instance.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
GroovyClosureScriptso that it can use this builder as the delegation target.This method instantiates the class (if not done so already for this request), and return it.
-
adjunct
Includes the specified adjunct. This method is useful for including adjunct dynamically on demand.- Throws:
IOExceptionSAXException
-
jelly
Loads a jelly tag library.- Parameters:
t- If this is a subtype ofTagLibrary, then that tag library is loaded and bound to theNamespaceobject, 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.
-
getServletContext
public jakarta.servlet.ServletContext getServletContext() -
getRequest
public org.kohsuke.stapler.StaplerRequest2 getRequest() -
getResponse
public org.kohsuke.stapler.StaplerResponse2 getResponse() -
getBuilder
-
getRootURL
Gets the absolute URL to the top of the webapp.- See Also:
-
img
Generates an<IMG>tag to the resource.- Throws:
SAXException
-
res
Yields a URL to the given resource.- Parameters:
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.
-