4

I'm trying to make a POST request, but I'm not sure how to set parameters. Something like:

RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, url);

StringBuilder sb = new StringBuilder();
sb.append("key1=val1");
sb.append("&key2=val2");
sb.append("&key3=val3");
rb.setRequestData(sb.toString());

that does not seem to be the current way, though. What's the right way to send params like this with the POST?

user291701
  • 38,411
  • 72
  • 187
  • 285

2 Answers2

15

The answer should be in here Making POST requests with parameters in GWT Try with builder.setHeader("Content-type", "application/x-www-form-urlencoded");

Community
  • 1
  • 1
SamGamgee
  • 564
  • 1
  • 4
  • 12
-1

It is opening new window but not passing Post parameters to new window using GWT.

rb.setRequestData(json);
Request response = rb.sendRequest(json.toString(), new RequestCallback() {
    public void onError(Request request, Throwable exception) {}
    public void onResponseReceived(Request request, Response response) {
        Window.open(rb.getUrl(), postTarget, postWinFeatures);
    }
});
prex
  • 719
  • 4
  • 17