org.apache.shindig.protocol
Class JsonRpcServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.apache.shindig.common.servlet.InjectedServlet
              extended by org.apache.shindig.protocol.ApiServlet
                  extended by org.apache.shindig.protocol.JsonRpcServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class JsonRpcServlet
extends ApiServlet

JSON-RPC handler servlet.

See Also:
Serialized Form

Field Summary
static Set<String> ALLOWED_CONTENT_TYPES
           
static String REQUEST_PARAM
          In a multipart request, the form item with field name "request" will contain the actual request, per the proposed Opensocial 0.9 specification.
 
Fields inherited from class org.apache.shindig.protocol.ApiServlet
ATOM_FORMAT, atomConverter, containerConfig, DEFAULT_ENCODING, DEFAULT_HANDLER_KEY, dispatcher, FORMAT_PARAM, HANDLERS_PARAM, JSON_FORMAT, jsonConverter, XML_FORMAT, xmlConverter
 
Fields inherited from class org.apache.shindig.common.servlet.InjectedServlet
initialized, injector
 
Constructor Summary
JsonRpcServlet()
           
 
Method Summary
protected  void addResult(Map<String,Object> result, Object data)
           
protected  void dispatch(org.json.JSONObject request, Map<String,FormDataItem> formItems, javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.http.HttpServletResponse servletResponse, SecurityToken token, String callback)
           
protected  void dispatchBatch(org.json.JSONArray batch, Map<String,FormDataItem> formItems, javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.http.HttpServletResponse servletResponse, SecurityToken token, String callback)
           
protected  RpcHandler getHandler(org.json.JSONObject rpc, javax.servlet.http.HttpServletRequest request)
          Wrap call to dispatcher to allow for implementation specific overrides and servlet-request contextual handling
protected  String getPostContent(javax.servlet.http.HttpServletRequest request, Map<String,FormDataItem> formItems)
           
protected  void sendError(javax.servlet.http.HttpServletResponse servletResponse, ResponseItem responseItem)
           
protected  void service(javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.http.HttpServletResponse servletResponse)
           
 
Methods inherited from class org.apache.shindig.protocol.ApiServlet
getResponseItem, getSecurityToken, init, responseItemFromException, sendSecurityError, setBeanConverters, setCharacterEncodings, setContainerConfig, setHandlerRegistry
 
Methods inherited from class org.apache.shindig.common.servlet.InjectedServlet
checkInitialized
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALLOWED_CONTENT_TYPES

public static final Set<String> ALLOWED_CONTENT_TYPES

REQUEST_PARAM

public static final String REQUEST_PARAM
In a multipart request, the form item with field name "request" will contain the actual request, per the proposed Opensocial 0.9 specification.

See Also:
Constant Field Values
Constructor Detail

JsonRpcServlet

public JsonRpcServlet()
Method Detail

service

protected void service(javax.servlet.http.HttpServletRequest servletRequest,
                       javax.servlet.http.HttpServletResponse servletResponse)
                throws IOException
Overrides:
service in class javax.servlet.http.HttpServlet
Throws:
IOException

getPostContent

protected String getPostContent(javax.servlet.http.HttpServletRequest request,
                                Map<String,FormDataItem> formItems)
                         throws ContentTypes.InvalidContentTypeException,
                                IOException
Throws:
ContentTypes.InvalidContentTypeException
IOException

dispatchBatch

protected void dispatchBatch(org.json.JSONArray batch,
                             Map<String,FormDataItem> formItems,
                             javax.servlet.http.HttpServletRequest servletRequest,
                             javax.servlet.http.HttpServletResponse servletResponse,
                             SecurityToken token,
                             String callback)
                      throws org.json.JSONException,
                             IOException
Throws:
org.json.JSONException
IOException

dispatch

protected void dispatch(org.json.JSONObject request,
                        Map<String,FormDataItem> formItems,
                        javax.servlet.http.HttpServletRequest servletRequest,
                        javax.servlet.http.HttpServletResponse servletResponse,
                        SecurityToken token,
                        String callback)
                 throws org.json.JSONException,
                        IOException
Throws:
org.json.JSONException
IOException

addResult

protected void addResult(Map<String,Object> result,
                         Object data)

getHandler

protected RpcHandler getHandler(org.json.JSONObject rpc,
                                javax.servlet.http.HttpServletRequest request)
Wrap call to dispatcher to allow for implementation specific overrides and servlet-request contextual handling


sendError

protected void sendError(javax.servlet.http.HttpServletResponse servletResponse,
                         ResponseItem responseItem)
                  throws IOException
Specified by:
sendError in class ApiServlet
Throws:
IOException


Copyright © 2007-2012. All Rights Reserved.