Merge "JSON: Use browser native JSON object for json serialization"

This commit is contained in:
Edwin Kempin 2014-02-24 09:57:52 +00:00 committed by Gerrit Code Review
commit 10687b0ec1

View File

@ -32,7 +32,6 @@ import com.google.gwt.http.client.RequestException;
import com.google.gwt.http.client.Response;
import com.google.gwt.http.client.URL;
import com.google.gwt.json.client.JSONException;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONParser;
import com.google.gwt.json.client.JSONValue;
import com.google.gwt.user.client.rpc.AsyncCallback;
@ -373,15 +372,16 @@ public class RestApi {
if (!background) {
RpcStatus.INSTANCE.onRpcStart();
}
String body = new JSONObject(content).toString();
RequestBuilder req = request(method);
req.setHeader("Content-Type", JSON_UTF8);
req.sendRequest(body, httpCallback);
req.sendRequest(str(content), httpCallback);
} catch (RequestException e) {
httpCallback.onError(null, e);
}
}
private static native String str(JavaScriptObject jso) /*-{ return JSON.stringify(jso); }-*/;
private <T extends JavaScriptObject> void sendRaw(Method method, String body,
AsyncCallback<T> cb) {
HttpCallback<T> httpCallback = new HttpCallback<T>(background, cb);