Hi,
RequestBuilder sends a request to the server.  I've never used it (I
use GWT-RPC) .

But perhaps you need to put your server address into the request?

Or maybe  call the GWT.getModuleBaseUrl() or  GWT.getHostPageBaseUrl()
to get the Base URL you need, and concat the file name to the baseUrl?

Sorry if this is not helpful.
Thanks,
Mike.


On Dec 22, 6:45 am, "Juan M.M.M." <knn0n....@gmail.com> wrote:
> Hi!
>
> I'm doing an example that I found ina book about GWT. It's the typical
> example of the hangman. I'm using Eclipse and GWT 2.0. This is my
> code:
>
> public class AhorGwt implements EntryPoint {
>
>         private FlowPanel letters = new FlowPanel();
>         private Label wordLabel = new Label();
>         private Image image = new Image();
>
>         private final int MAX_GUESSES = 6;
>         private int misses;
>         private String[] words;
>         private String word;
>         private char[] visibleWord;
>
>         @Override
>         public void onModuleLoad() {
>                 //create interface
>                 RootPanel ahorcado = RootPanel.get("ahorcado");
>                 ahorcado.add(letters);
>                 ahorcado.add(image);
>                 ahorcado.add(wordLabel);
>
>                 //load words
>                 final RequestBuilder requestBuilder = new RequestBuilder
> ( RequestBuilder.POST, "movies.txt" );
>                 try {
>                          requestBuilder.sendRequest( null, new 
> RequestCallback(){
>
>                                 public void onError(Request request, 
> Throwable exception) {
>                                         GWT.log( "failed getting movie list", 
> exception );
>                                 }
>
>                                 public void onResponseReceived(Request 
> request, Response response)
> {
>                                         words = 
> response.getText().split("\n");
>                                         GWT.log(words[2], null);
>                                         startGame();
>                                 }} );
>                 } catch (RequestException e) {
>                         GWT.log( "failed getting movie list", e );
>                 }
>                 wordLabel.setStyleName("word");
>         }
>         // ...
>
> }
>
> My movies.txt file is under /war/ file next to my index.html. Ok, once
> I get the supossed text file into 'words' variable I do a 'GWT.log
> (words[2], null);' in the console developent mode of eclipse I get
> this "HTTP Status 404 - Status report". As you can see, the file
> movies.txt hasn't been loaded. Instead of this, the program has red a
> kind of default text/html file. I don't know if the problem is in the
> location of the file or If I'm using a wrong method to read files on
> the client side.
>
> Thanks,
>
> Juanma

--

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


Reply via email to