|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object groovy.lang.GroovyObjectSupport groovy.util.BuilderSupport grails.util.JSonBuilder
@Deprecated public class JSonBuilder extends groovy.util.BuilderSupport
JSonBuilder provides support for creating JSON 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 "application/json"
Sending a simple key value pair to the client requires this code:
new JsonBuilder(response).json{ message('Hello World') }
will produce output as follows:
{"message":"Hello World"}
Constructor Summary | |
JSonBuilder(HttpServletResponse response)
|
|
JSonBuilder(JSONWriter _writer)
|
|
JSonBuilder(java.io.Writer writer)
|
Method Summary | |
---|---|
protected java.lang.Object
|
createNode(java.lang.Object name)
|
protected java.lang.Object
|
createNode(java.lang.Object key, java.util.Map valueMap)
|
protected java.lang.Object
|
createNode(java.lang.Object arg0, java.util.Map arg1, java.lang.Object arg2)
|
protected java.lang.Object
|
createNode(java.lang.Object key, java.lang.Object value)
|
protected void
|
nodeCompleted(java.lang.Object parent, java.lang.Object node)
|
protected void
|
setParent(java.lang.Object arg0, java.lang.Object arg1)
|
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 JSonBuilder(HttpServletResponse response)
public JSonBuilder(JSONWriter _writer)
public JSonBuilder(java.io.Writer writer)
Method Detail |
---|
@Override protected java.lang.Object createNode(java.lang.Object name)
@SuppressWarnings("rawtypes") @Override protected java.lang.Object createNode(java.lang.Object key, java.util.Map valueMap)
@SuppressWarnings("rawtypes") @Override protected java.lang.Object createNode(java.lang.Object arg0, java.util.Map arg1, java.lang.Object arg2)
@SuppressWarnings("rawtypes") @Override protected java.lang.Object createNode(java.lang.Object key, java.lang.Object value)
@Override protected void nodeCompleted(java.lang.Object parent, java.lang.Object node)
@Override protected void setParent(java.lang.Object arg0, java.lang.Object arg1)
Groovy Documentation