The URL you are trying to access is wrong...

Assuming you module is named hangman, this line
               final RequestBuilder requestBuilder = new RequestBuilder(
RequestBuilder.POST, "movies.txt" );

makes  a request to http://myserver.com/mywar/hangman/movies.txt, whereas
you want it to be http://myserver.com/mywar/movies.txt

Try using "../movies.txt", or use GWT.getHostPageBaseURL() ..


--Sri


2009/12/22 Juan M.M.M. <knn0n....@gmail.com>

> 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<google-web-toolkit%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>
>

--

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