com.dyuproject.web.rest
Class JSONDispatcher

java.lang.Object
  extended by org.mortbay.util.ajax.JSON
      extended by com.dyuproject.json.StandardJSON
          extended by com.dyuproject.web.rest.JSONDispatcher
All Implemented Interfaces:
LifeCycle, ViewDispatcher

public final class JSONDispatcher
extends StandardJSON
implements ViewDispatcher

Generates a JSON response from the object on the request attribute identified by JSON_DATA.

Author:
David Yu
Date created:
Feb 13, 2009

Nested Class Summary
static class JSONDispatcher.SimpleResponse
           
 
Nested classes/interfaces inherited from class org.mortbay.util.ajax.JSON
org.mortbay.util.ajax.JSON.Convertible, org.mortbay.util.ajax.JSON.Convertor, org.mortbay.util.ajax.JSON.Generator, org.mortbay.util.ajax.JSON.Literal, org.mortbay.util.ajax.JSON.Output, org.mortbay.util.ajax.JSON.ReaderSource, org.mortbay.util.ajax.JSON.Source, org.mortbay.util.ajax.JSON.StringSource
 
Field Summary
static org.mortbay.util.ajax.JSON.Generator EMPTY_RESPONSE_MAP
           
static String JSON_DATA
           
 
Fields inherited from class com.dyuproject.json.StandardJSON
_addClass, _convertorCache
 
Constructor Summary
JSONDispatcher()
           
 
Method Summary
 void destroy(WebContext webContext)
           
 void dispatch(String errorMsg, HttpServletRequest request, HttpServletResponse response)
           
 void init(WebContext webContext)
           
 void write(Object data, HttpServletRequest request, HttpServletResponse response)
           
 void writeSimpleResponse(String msg, boolean error, HttpServletRequest request, HttpServletResponse response)
           
 
Methods inherited from class com.dyuproject.json.StandardJSON
getConvertor, getConvertorCache, getResource, getResource, isAddClass, isCheckParents, loadClass, loadClass, parseObject, setAddClass, setCheckParents
 
Methods inherited from class org.mortbay.util.ajax.JSON
addConvertor, addConvertorFor, append, appendArray, appendArray, appendBoolean, appendJSON, appendJSON, appendJSON, appendMap, appendNull, appendNumber, appendString, complete, contextFor, contextForArray, convertTo, fromJSON, getConvertorFor, getDefault, getStringBufferSize, handleUnknown, newArray, newMap, parse, parse, parse, parse, parse, parse, parse, parse, parseArray, parseNumber, parseString, registerConvertor, seekTo, seekTo, setDefault, setStringBufferSize, toJSON, toString, toString, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JSON_DATA

public static final String JSON_DATA
See Also:
Constant Field Values

EMPTY_RESPONSE_MAP

public static final org.mortbay.util.ajax.JSON.Generator EMPTY_RESPONSE_MAP
Constructor Detail

JSONDispatcher

public JSONDispatcher()
Method Detail

dispatch

public void dispatch(String errorMsg,
                     HttpServletRequest request,
                     HttpServletResponse response)
              throws ServletException,
                     IOException
Specified by:
dispatch in interface ViewDispatcher
Throws:
ServletException
IOException

write

public void write(Object data,
                  HttpServletRequest request,
                  HttpServletResponse response)
           throws ServletException,
                  IOException
Throws:
ServletException
IOException

writeSimpleResponse

public void writeSimpleResponse(String msg,
                                boolean error,
                                HttpServletRequest request,
                                HttpServletResponse response)
                         throws ServletException,
                                IOException
Throws:
ServletException
IOException

destroy

public void destroy(WebContext webContext)
Specified by:
destroy in interface LifeCycle

init

public void init(WebContext webContext)
Specified by:
init in interface LifeCycle


Copyright © 2008-2013. All Rights Reserved.