Synchronous GET or POST with HTTPRequest

100 views
Skip to first unread message

hvs...@googlemail.com

unread,
May 30, 2006, 11:08:38 AM5/30/06
to Google Web Toolkit
If you are using the HTTPRequest of the package
com.google.gwt.user.client, you asynchronously GET or POST data.

Is there a way for a synchronous request, too?

This would be helpful for "questions" to the server, where you need to
wait for an answer.

Any sugg. would be great, many thanks ...

Mr. Monster

unread,
May 30, 2006, 11:15:46 AM5/30/06
to Google Web Toolkit
If I remember correctly they disabled this option because it was
freezing the browser.

You can use asynch communication and simply stop the user interface
from doing anything else untill the response is received.

hvs...@googlemail.com

unread,
May 30, 2006, 11:20:42 AM5/30/06
to Google Web Toolkit
Thanks for your quick answer.

I have tried this by setting a boolean called mbWAITING to true, and
wanted to run in a while-loop, until the onCompletion-handler set this
mbWaiting to false. I can do this in VB i. e. by using the DoEvents -
function to give the rest of the Browser any time to handle the
onCompletion-hanlder. But there is no such method, so the Browser
freezes, too.

What methods can be used to tell the Browser to do nothing and let the
other part of the script let do the work? I tried sleep or yield, but
they only work with threads.

Again: Thanks ...

Mr. Monster

unread,
May 30, 2006, 11:29:04 AM5/30/06
to Google Web Toolkit
I don't think theres build in funcionality for this since it will be
different for every application.

What you can do is "disable" all your events while you're waiting for
the response. You could set some variable that all events, eg buttons,
check before performing their actions, you would modify this variable
depending on the state of your asynch request. So unless your
appliclation "enables" this variable once a response is received, all
your butons would be disabled.

Just one idea, you could also draw a panel ontop of your entire
application using z-index, set it to be transparant to some degree to
show that the application is disabled. This would prevent anything
under this panel from being clicked and inturn "disabling" your
application untill you enable it again.

hvs...@googlemail.com

unread,
May 30, 2006, 11:33:55 AM5/30/06
to Google Web Toolkit
OK, this is the way I did in some of my VB-programs (i. e. the
GPS-Explorer on http://www.gpsoverip.com)

There it works, I will do it here, too.

Thanks!

Reply all
Reply to author
Forward
0 new messages