POST values should be encoded in the request data string, not the headers.
Not sure why there isn't an addPostValue method too. Here's some code I used
recently:

class CustomPOSTBuilder extends RequestBuilder {

    private String request = "";

    public CustomPOSTBuilder(String url, RequestCallback callback) {
        super(RequestBuilder.POST, url);
        this.setHeader("Content-Type", "application/x-www-form-urlencoded");

        this.setCallback(callback);
    }

    public void addPost(String key, String value) {
        request += key + "=" + value + "&";
    }

    public void go() {
        this.setRequestData(request);
        try {
            this.send();
        }
        catch (RequestException r){
            System.out.print(r.getMessage());
        }
    }

}

then send a request by:
CustomPOSTBuilder builder...
builder.addPost("key1", "value1");
builder.addPost("key2", "value2");
builder.send();


2010/10/21 Márcio Menezes <marcio....@gmail.com>

> Hi!.
> Why does everytime I try to send a POST through RequestBuilder class and if
> I add some header into it, the method goes as an OPTIONS, instead of post?
>
> Has anyone experienced this? How can I work around it?
>
> Regards,
> Marcio
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to google-web-tool...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com<google-web-toolkit%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to