|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object groovy.lang.GroovyObjectSupport groovy.util.BuilderSupport grails.util.JSonBuilder
JSONBuilder
instead
Date Created: May, 18, 2006
public class JSonBuilder
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)
Deprecated. |
|
JSonBuilder(JSONWriter _writer)
Deprecated. |
|
JSonBuilder(Writer writer)
Deprecated. |
Method Summary | |
---|---|
protected Object |
createNode(Object name)
Deprecated. |
protected Object |
createNode(Object key,
Map valueMap)
Deprecated. |
protected Object |
createNode(Object arg0,
Map arg1,
Object arg2)
Deprecated. |
protected Object |
createNode(Object key,
Object value)
Deprecated. |
protected void |
nodeCompleted(Object parent,
Object node)
Deprecated. |
protected void |
setParent(Object arg0,
Object arg1)
Deprecated. |
Methods inherited from class groovy.util.BuilderSupport |
---|
doInvokeMethod, getCurrent, getName, invokeMethod, invokeMethod, postNodeCompletion, setClosureDelegate, setCurrent |
Methods inherited from class groovy.lang.GroovyObjectSupport |
---|
getMetaClass, getProperty, setMetaClass, setProperty |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JSonBuilder(HttpServletResponse response) throws IOException
IOException
public JSonBuilder(JSONWriter _writer)
public JSonBuilder(Writer writer)
Method Detail |
---|
protected Object createNode(Object name)
createNode
in class groovy.util.BuilderSupport
protected Object createNode(Object key, Map valueMap)
createNode
in class groovy.util.BuilderSupport
protected Object createNode(Object arg0, Map arg1, Object arg2)
createNode
in class groovy.util.BuilderSupport
protected Object createNode(Object key, Object value)
createNode
in class groovy.util.BuilderSupport
protected void nodeCompleted(Object parent, Object node)
nodeCompleted
in class groovy.util.BuilderSupport
protected void setParent(Object arg0, Object arg1)
setParent
in class groovy.util.BuilderSupport
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |