I try to suggest you something, but I hope not to give a trivial 
suggestion to you...

Are you sure that you call MediaStation.getXMLContent() after the 
callback returns? For what I can read in your code, you send the 
callback in the try / catch block, then the next statement that is 
executed is "return MediaStation.result". So you may not have finished 
the callback execution at that point. Anyway this is a way of using a 
getter function in conjunction with a request that I have never seen before.

BR,
Federica



reinika ha scritto:
> hi!
>
> maybe somebody could help me with this. i'm trying to set the
> "MediaStation" static variable "result" in an inner class,
> unfortunately the the method "getXMLContent(...)" still returns the
> initially set string "nothing" when calling it with:
> ---
> Window.alert("Content: " + MediaStation.getXMLContent(XML_FILEPATH));
> ---
> I also checked, that the inner method "onResponseReceived" is called
> and "response.getText();" also returns a result (see the commended
> alert window statement).
>
> source follows:
> ---
> ...
>
> public class MediaStation{
>       private static String result = "0";
>
>        ...
>
>       public static String getXMLContent(String path){
>               RequestBuilder requestBuilder = new RequestBuilder
> (RequestBuilder.GET, path);
>               MediaStation.result = "nothing";
>
>               try {
>
>                       requestBuilder.sendRequest(null, new RequestCallback() {
>                               public void onError(Request request, Throwable 
> exception) {
>                                       MediaStation.requestFailed(exception);
>                               }
>                               public void onResponseReceived(Request request, 
> Response response)
> {
>                                       MediaStation.result = 
> response.getText();
>                                       //Window.alert("XML file successfully 
> read: " +
> MediaStation.result);
>                               }
>                       });
>               } catch (RequestException ex) {
>                       MediaStation.requestFailed(ex);
>               }
>               return MediaStation.result;
>       }
> ...
> }
> ---
>
> thanks for your help! bye!
>
> >
>
>   


--~--~---------~--~----~------------~-------~--~----~
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