How to set parameters in com.google.gwt.http.client.RequestBuilder

1,424 views
Skip to first unread message

Jax

unread,
Jan 18, 2009, 7:44:56 PM1/18/09
to Google Web Toolkit
PigIron's PigLet Servlet (http://pigiron.sourceforge.net) accepts POST
and has a forms-based request builder. I'm looking at creating a GWT-
based fancier front end to PigIron.

I've tried using com.google.gwt.http.client.RequestBuilder but when I
POST my request parameter "requestor" is always empty. I've tried
various permutations with RequestBuilder.setRequestData() but no luck.
How do I do a POST with a parameter "requestor" set to some text?

Jax

unread,
Jan 19, 2009, 11:00:54 AM1/19/09
to Google Web Toolkit


On Jan 18, 5:44 pm, Jax <j...@well.com> wrote:

> I've tried using com.google.gwt.http.client.RequestBuilder but when I
> POST my request parameter "requestor" is always empty. I've tried
> various permutations with RequestBuilder.setRequestData() but no luck.
> How do I do a POST with a parameter "requestor" set to some text?

Actually embedding the params in the URL I pass to
com.google.gwt.http.client.RequestBuilder works. Do I have
to do this or am I missing some function that will build this string
for me?

jake H

unread,
Jan 20, 2009, 6:15:51 AM1/20/09
to Google Web Toolkit
I dont know , if i understood u well but here is the implementation
for RequestBuilder POST
url - url to send
postData - data to send.

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

try {
builder.setHeader("Content-Type", "application/x-www-form-
urlencoded");
Request response = builder.sendRequest(postData, new RequestCallback
() {

Jax

unread,
Jan 22, 2009, 1:04:37 PM1/22/09
to Google Web Toolkit
Thanks, Jake, I'll give that a try. The problem I was addressing is
that I had not figured out
a way to attach the "?foo=bar&woof=arf" post data. I'd tried
setRequestData but it did not
work. I interpreted builder.sendRequest(postData, RequestCall) as
semantically equivalent
to httpRequest.setRequestData(), httpRequest.setCallback(),
httpReqeuest.send() which
I already tried.
Reply all
Reply to author
Forward
0 new messages