org.apache.shindig.gadgets
Class FetchResponseUtils

java.lang.Object
  extended by org.apache.shindig.gadgets.FetchResponseUtils

public final class FetchResponseUtils
extends Object

Handles converting HttpResponse objects to the format expected by the makeRequest javascript.


Method Summary
static Map<String,Object> getResponseAsJson(HttpResponse response, String id, String body, boolean getFullHeaders)
          Convert a response to a JSON object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getResponseAsJson

public static Map<String,Object> getResponseAsJson(HttpResponse response,
                                                   String id,
                                                   String body,
                                                   boolean getFullHeaders)
Convert a response to a JSON object. The returned JSON object contains the following values: id: the id of the response rc: integer response code body: string response body headers: object, keys are header names, values are lists of header values The returned object is guaranteed to be mutable.

Parameters:
response - the response body
id - the response id, or null if not needed
body - string to use as the body of the response.
getFullHeaders - whether all response headers should be included, or only a small set
Returns:
a JSONObject representation of the response body.


Copyright © 2007-2012. All Rights Reserved.