I'm trying to send JSON data to a server.
RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, url);
builder.setHeader("Content-Type", "application/json");
builder.setRequestData(getJSONString());
builder.setCallback(myCallbackObject);
builder.send();
I do this in eclipse and I saw in the TCP/IP Monitor that my JSON Data is not transmitted as post in the request. If I ask for
builder.getRequestData();
I can see the JSON data is right there.
What do I need for the data to get on the server?
Best Answer
You might be running into the browser's same-origin policy if the url that you are attempting to connect to is not from the same origin as your GWT
nocache.js
file. Is your callback'sonFailure()
being called? Also, see ifRequest.getSatusCode()
returns0
, which is indicative of SOP problems.