That won't be very helpful either. The issue is that the call is
happening asynchronously and you have no idea when it's going to come
back with the server response. The idea is that your
onResponseReceived() method calls a some other method, passing the
response. So whatever object needs the response should have a public
method that is called in the onResponseReceived() method.

Make sense?

On Jun 11, 1:43 pm, Jeff Chimene <[email protected]> wrote:
> On 06/10/2010 08:55 AM, Andy wrote:
>
>
>
>
>
> > public void doGet(String myurl) {
>
> >         myurl = URL.encode(myurl);
>
> >         RequestBuilder builder = new
> > RequestBuilder(RequestBuilder.GET, myurl );
>
> >         try {
> >           Request request = builder.sendRequest(null, new
> > RequestCallback() {
> >             public void onError(Request request, Throwable exception)
> > {
> >                    Window.alert("ERROR. Could not connect to server.");
> >             }
>
> >             public void onResponseReceived(Request request, Response
> > response) {
> >               if (200 == response.getStatusCode()) {
> >                     String ServerResponse = response.getText();
>
> >               } else {
> >                      Window.alert("ERROR. Errorcode: " +
> > response.getStatusCode());
> >               }
> >             }
> >           });
>
> > How can i make this function return SereverResponce variable?
>
> You can't. It's a void function. Stash the response in a private
> variable and define a getter for that variable.

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

Reply via email to