|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object groovy.lang.GroovyObjectSupport groovy.util.BuilderSupport groovy.xml.MarkupBuilder grails.util.OpenRicoBuilder
public class OpenRicoBuilder extends groovy.xml.MarkupBuilder
Provides support for creating OpenRico AJAX responses.
If this builder is used in controllers no views should be configured since content will be written to the HttpServletResponse instance. Also no operations should be performed on the response object prior to passing it to this builder.
This builder will set the content type of the response to "text/xml" and will render a correct XML prolog ().
This builder supports no namespaces or hyphens in element and attribute names.
Use this builder to write a OpenRico reponse to the client. Sending a simple DIV tag to the client requires this code:
new OpenRicoBuilder(response).ajax { element(id:"personInfo") { div(class:"person") } }
Sending object XML to the client requires this code:
new OpenRicoBuilder(response).ajax { object(id:"formLetterUpdater") { person( fullName:"Pat Barnes", title:"Mr.", firstName:"Pat", lastName:"Barnes") } }
The first call on a OpenRicoBuilder instance should be "ajax", the second either "element" (to return HTML) or object (to return XML) both with a required "id" attribute. Violations against these rules will be reported as exceptions.
OpenRico responses can contain multiple element and/or object nodes which is supported by this builder.
When using OpenRicoBuilder in controllers you may need to return a null value at the end of a closure to avoid an UnsupporterReturnValueException.
Constructor Summary | |
OpenRicoBuilder(HttpServletResponse response)
|
Method Summary | |
---|---|
protected java.lang.Object
|
createNode(java.lang.Object name)
|
protected java.lang.Object
|
createNode(java.lang.Object name, java.util.Map attributes, java.lang.Object value)
|
protected java.lang.Object
|
createNode(java.lang.Object name, java.lang.Object value)
|
protected void
|
nodeCompleted(java.lang.Object parent, java.lang.Object node)
|
Methods inherited from class groovy.xml.MarkupBuilder | |
---|---|
groovy.xml.MarkupBuilder#getDoubleQuotes(), groovy.xml.MarkupBuilder#setDoubleQuotes(boolean), groovy.xml.MarkupBuilder#isOmitNullAttributes(), groovy.xml.MarkupBuilder#setOmitNullAttributes(boolean), groovy.xml.MarkupBuilder#isOmitEmptyAttributes(), groovy.xml.MarkupBuilder#setOmitEmptyAttributes(boolean), groovy.xml.MarkupBuilder#getMkp(), groovy.xml.MarkupBuilder#invokeMethod(java.lang.String), groovy.xml.MarkupBuilder#invokeMethod(java.lang.String, java.lang.Object), groovy.xml.MarkupBuilder#setProperty(java.lang.String, java.lang.Object), groovy.xml.MarkupBuilder#getProperty(java.lang.String), groovy.xml.MarkupBuilder#getMetaClass(), groovy.xml.MarkupBuilder#setMetaClass(groovy.lang.MetaClass), groovy.xml.MarkupBuilder#wait(), groovy.xml.MarkupBuilder#wait(long), groovy.xml.MarkupBuilder#wait(long, int), groovy.xml.MarkupBuilder#equals(java.lang.Object), groovy.xml.MarkupBuilder#toString(), groovy.xml.MarkupBuilder#hashCode(), groovy.xml.MarkupBuilder#getClass(), groovy.xml.MarkupBuilder#notify(), groovy.xml.MarkupBuilder#notifyAll() |
Methods inherited from class groovy.util.BuilderSupport | |
---|---|
groovy.util.BuilderSupport#invokeMethod(java.lang.String), groovy.util.BuilderSupport#invokeMethod(java.lang.String, java.lang.Object), groovy.util.BuilderSupport#setProperty(java.lang.String, java.lang.Object), groovy.util.BuilderSupport#getProperty(java.lang.String), groovy.util.BuilderSupport#getMetaClass(), groovy.util.BuilderSupport#setMetaClass(groovy.lang.MetaClass), groovy.util.BuilderSupport#wait(), groovy.util.BuilderSupport#wait(long), groovy.util.BuilderSupport#wait(long, int), groovy.util.BuilderSupport#equals(java.lang.Object), groovy.util.BuilderSupport#toString(), groovy.util.BuilderSupport#hashCode(), groovy.util.BuilderSupport#getClass(), groovy.util.BuilderSupport#notify(), groovy.util.BuilderSupport#notifyAll() |
Methods inherited from class groovy.lang.GroovyObjectSupport | |
---|---|
groovy.lang.GroovyObjectSupport#setProperty(java.lang.String, java.lang.Object), groovy.lang.GroovyObjectSupport#getProperty(java.lang.String), groovy.lang.GroovyObjectSupport#getMetaClass(), groovy.lang.GroovyObjectSupport#setMetaClass(groovy.lang.MetaClass), groovy.lang.GroovyObjectSupport#invokeMethod(java.lang.String, java.lang.Object), groovy.lang.GroovyObjectSupport#wait(), groovy.lang.GroovyObjectSupport#wait(long), groovy.lang.GroovyObjectSupport#wait(long, int), groovy.lang.GroovyObjectSupport#equals(java.lang.Object), groovy.lang.GroovyObjectSupport#toString(), groovy.lang.GroovyObjectSupport#hashCode(), groovy.lang.GroovyObjectSupport#getClass(), groovy.lang.GroovyObjectSupport#notify(), groovy.lang.GroovyObjectSupport#notifyAll() |
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Constructor Detail |
---|
public OpenRicoBuilder(HttpServletResponse response)
Method Detail |
---|
@Override protected java.lang.Object createNode(java.lang.Object name)
@SuppressWarnings("rawtypes") @Override protected java.lang.Object createNode(java.lang.Object name, java.util.Map attributes, java.lang.Object value)
@Override protected java.lang.Object createNode(java.lang.Object name, java.lang.Object value)
@Override protected void nodeCompleted(java.lang.Object parent, java.lang.Object node)
Groovy Documentation