Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4591744
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T22:26:22+00:00 2026-05-21T22:26:22+00:00

In GWT is there any way to wait for asynchronous call to complete? I

  • 0

In GWT is there any way to wait for asynchronous call to complete?
I need the response to continue (It’s a login screen so succes means changing to the actual game and failure means staying in the login screen).
Here is the call:

private void execRequest(RequestBuilder builder)
{
    try
    {
        builder.sendRequest(null, new RequestCallback()
        {
            public void onError(Request request, Throwable exception)
            {
                s = exception.getMessage();
            }

            public void onResponseReceived(Request request,
                    Response response)
            {
                s = response.getText();
            }
        });
    } catch (RequestException e)
    {
        s = e.getMessage();
    }
}

And here is the calling method:`

public String check()
{
    s = null;
    RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, baseUrl
            + "check&user=" + user + "&password=" + password);
    execRequest(builder);
    return s;
}

I need the check method to return the response (or error) and not to return null.
I tried the brain-dead solution of writing:`

while (s == null);

To wait for the call to finish but that just crushed the page in development mode.
(chrome said page is unresponsive and suggested to kill it)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T22:26:22+00:00Added an answer on May 21, 2026 at 10:26 pm

    Embrace asynchrony, don’t fight it!

    In other words: make your check method asynchronous too, passing a callback argument instead of returning a value; and pass a callback to execRequest (simply replace every assignment to s with a call to the callback).
    You don’t necessarily need to fire an event on an application-wide event bus, as Jai suggested: it helps in decoupling, but that’s not always what you need/want.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

is there any way to call servlet or make a gwt-rpc call from gwt
Is there any way to subscribe from GWT to JSON objects stream and listen
Is there any way to set gwt compiler so that each permutation is compiled
How can I clear the cache in gwt ? or is there any way
Is there any way to create gwt.Image from String. I've not found anything. Pls
Hi is there any way to create something similar to Window.alert() in GWT? Basically
I am using gwt-visualisation chart But is there any way to add click handler
What is your preferred approach to serializing BigDecimal in GWT? Are there any clever
I have a simple question: Is there is any way to walk through a
quite new to GWT i was wondering if there's any solution to automatically generate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.