RequestBuilder

4 views
Skip to first unread message

charlie

unread,
Dec 9, 2009, 10:22:07 AM12/9/09
to Google-We...@googlegroups.com
I have a php page http://the-charlie.com/artwork/index.php?artist=Kanye+West&album=Graduation , that when I hit it directly gives me an image URL. 

I have this code in my app

RequestBuilder builder = new RequestBuilder(RequestBuilder.GET,"http://the-charlie.com/artwork/index.php?artist=Kanye+West&album=Graduation" );
               
                try {
                    builder.sendRequest("", new RequestCallback() {
                       
                        @Override
                        public void onResponseReceived(Request request, Response response) {

                           
                            Window.alert(response.getText() );
                            Window.alert(response.getHeadersAsString());
                            Window.alert(response.getStatusText() );
                            Window.alert(Integer.toString(response.getStatusCode()));
                        }
                       
                        @Override
                        public void onError(Request request, Throwable exception) {

                           
                        }
                    });
                } catch (RequestException e) {

                    e.printStackTrace();
                }
               
            }

Which is always returning null , with a status code of 200.

If my app runs on port 8080, is it a problem hitting a page on port 80 ( the php page ) ?

Why would this constantly be returning blank ?

Thanks!
Charlie

P.G.Taboada

unread,
Dec 9, 2009, 10:51:40 AM12/9/09
to Google Web Toolkit
Hi,

different ports are indeed an issue, see SOP http://en.wikipedia.org/wiki/Same_origin_policy...

I tried your code here and got a status code 0.

For test purposes, dump your response data into your war folder and
change the url to the new location.

If it works, it is not your code, it most probably is SOP.

brgds,

Papick

ps: I use GWT.log("Got status code " + response.getStatusCode(), null)
to log instead of Window.alert.



On 9 Dez., 16:22, charlie <charlie.f...@gmail.com> wrote:
> I have a php pagehttp://the-charlie.com/artwork/index.php?artist=Kanye+West&album=Grad...,
> that when I hit it directly gives me an image URL.
>
> I have this code in my app
>
> RequestBuilder builder = new RequestBuilder(RequestBuilder.GET,"http://the-charlie.com/artwork/index.php?artist=Kanye+West&album=Grad..."
Reply all
Reply to author
Forward
0 new messages