title: Gwt Request builder - how to return the response string
body: <p>I need to implement a function that calls a web service and return the response.</p>
  
  <p>I tried</p>
  
  <pre><code>public String getFolderJson(String path) {  
             String result="initial_value";
             StringBuilder param = new StringBuilder();  
             param.append("?sessionId=").append(getSessionId());  
             param.append("&amp;path=").append(path);  
             RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, "https://localhost/folder" + param);  
                     try {  
                          builder.sendRequest(null, new RequestCallback() {  
                          @Override  
                          public void onResponseReceived(Request request,
                                  Response response) {  
                                result = response.getText();
                                System.out.println(response.getText());  
                                              //I need to return "result"   
                          }  
                          @Override  
                          public void onError(Request request, Throwable exception) {}  
                            });  
                      return result; //the result get returned before the response is recieved.So i am getting the return value "initial_value".
                     }      
                     catch (RequestException e) {}  
          return null;
      }
  </code></pre>
  
  <p>On calling  <code>getFolderJson()</code> the web service is called succesfully. But <code>result</code> is returned before the respnse is recieved. So I am getting the retunr value "initial_value".<br>
  How to return the value from the response when <code>getFolderJson()</code> function ?</p>