Why GWT HTTP client can't receive HTTP response

2011-12-26 Thread Justin@GWT
I follow the example code provided by Google GWT to send a HTTP GET
request and receive the response. The GET request was sent out
successfully, but can't receive response message. Actually the
response message has been sent back, according to Wireshark trace.
Does anybody know why?

String urlCityList = "http://www.abcdeft.com/abc/def";;  // Here is
just a fake url, but I used real url when trouble shooting.
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET,
URL.encode(urlCityList));


try {
  Request request = builder.sendRequest(null, new
RequestCallback() {
public void onError(Request request, Throwable exception) {

}

public void onResponseReceived(Request request, Response
response) {
  //
Window.alert(Integer.toString(response.getStatusCode()));  // I tried
to print out the status code.It's 0, means nothing is received. But
actually I can see the response message in wireshark tracing.
Window.alert("Could not get HTTP response.");   // The 
code
goes to this branch.
  //Window.alert(response.getText());
  if (200 == response.getStatusCode()) {

  text = response.getText();
  parseMessage(response.getText());
  //text = response.getStatusText();
  } else {
//Window.alert(response.getStatusText());

//Window.alert(Integer.toString(response.getStatusCode()));

  }
}
  });
} catch (RequestException e) {

}
  }

-- 
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-toolkit@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.



Re: Why GWT HTTP client can't receive HTTP response

2011-12-26 Thread Alfredo Quiroga-Villamil
See:

http://code.google.com/webtoolkit/doc/1.6/FAQ_Server.html

Look for SOP.

Regards,

Alfredo

On Mon, Dec 26, 2011 at 8:57 PM, Justin@GWT  wrote:

> I follow the example code provided by Google GWT to send a HTTP GET
> request and receive the response. The GET request was sent out
> successfully, but can't receive response message. Actually the
> response message has been sent back, according to Wireshark trace.
> Does anybody know why?
>
>String urlCityList = "http://www.abcdeft.com/abc/def";;  // Here is
> just a fake url, but I used real url when trouble shooting.
>RequestBuilder builder = new RequestBuilder(RequestBuilder.GET,
> URL.encode(urlCityList));
>
>
>try {
>  Request request = builder.sendRequest(null, new
> RequestCallback() {
>public void onError(Request request, Throwable
> exception) {
>
>}
>
>public void onResponseReceived(Request request, Response
> response) {
>  //
> Window.alert(Integer.toString(response.getStatusCode()));  // I tried
> to print out the status code.It's 0, means nothing is received. But
> actually I can see the response message in wireshark tracing.
>Window.alert("Could not get HTTP response.");   //
> The code
> goes to this branch.
>  //Window.alert(response.getText());
>  if (200 == response.getStatusCode()) {
>
>  text = response.getText();
>  parseMessage(response.getText());
>  //text = response.getStatusText();
>  } else {
>//Window.alert(response.getStatusText());
>
>  //Window.alert(Integer.toString(response.getStatusCode()));
>
>  }
>}
>  });
>} catch (RequestException e) {
>
>}
>  }
>
> --
> 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-toolkit@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.
>
>


-- 
Alfredo Quiroga-Villamil

AOL/Yahoo/Gmail/MSN IM:  lawwton

-- 
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-toolkit@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.



Re: Why GWT HTTP client can't receive HTTP response

2011-12-26 Thread Justin@GWT
Thanks.
Is there any workaround about the SOP? I would like to fetch some XML data, 
but not JSON data.
I tried to enable the cross-site host mode, but I was told "cross-site 
hosted mode not yet implemented" by GWT.

Best Regards,
Justin

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/VSJJiQgt088J.
To post to this group, send email to google-web-toolkit@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.



Re: Why GWT HTTP client can't receive HTTP response

2011-12-27 Thread Alan Chaney
If you can limit your target audience to ff 3.5+, Webkit 4+ (chrome, 
safari) and ie8+ you can also use CORS.


See http://saltybeagle.com/2009/09/cross-origin-resource-sharing-demo/

If you need to support IE8/9 then you will have to add a few lines of 
JSNI to provide M/S XDR support.



CORS is unbelievably easy to implement at the server end, because all 
you have to do is add one or two extra headers to the output.


This assumes that you have some control over the server, or can get the 
server's owners to make a small change. If they are serving to a public 
community, its a change that they should make, IMHO, because the wide 
scale deployment of CORS would solve many problems with SOP, which, 
after all, is why it was invented!


HTH

Alan



On 12/27/2011 5:20 AM, Jens wrote:
1.) If the domain of the external URL is actually your production 
domain (the one where you would deploy and access the app for 
production) but you are developing using localhost as domain or 
similar, you can disable SOP in several browsers (google for "disable 
SOP"). But this is only useful for developing.


2.) Make a request from GWT client to your GWT server and your GWT 
server makes a request to the external URL.


3.) Use a reverse proxy where you can map any external URLs to URLs of 
your domain, e.g. a GWT client request to 
http://www.yourdomain.com/external/mydata may be redirected by the 
reverse proxy to http://www.mydata.com/api.



-- J.
--
You received this message because you are subscribed to the Google 
Groups "Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/ot35lBGqwy4J.

To post to this group, send email to google-web-toolkit@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.


--
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-toolkit@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.



Re: Why GWT HTTP client can't receive HTTP response

2011-12-27 Thread Jens
1.) If the domain of the external URL is actually your production domain 
(the one where you would deploy and access the app for production) but you 
are developing using localhost as domain or similar, you can disable SOP in 
several browsers (google for "disable SOP"). But this is only useful for 
developing.

2.) Make a request from GWT client to your GWT server and your GWT server 
makes a request to the external URL.

3.) Use a reverse proxy where you can map any external URLs to URLs of your 
domain, e.g. a GWT client request to 
http://www.yourdomain.com/external/mydata may be redirected by the reverse 
proxy to http://www.mydata.com/api. 


-- J.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/ot35lBGqwy4J.
To post to this group, send email to google-web-toolkit@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.



Re: Why GWT HTTP client can't receive HTTP response

2011-12-27 Thread Alfredo Quiroga-Villamil
Unf. not a whole lot. Easiest might be to:

UI - Your server - XML API

Between the UI and your server you can use a variety of protocols. From
your server, then consume the API you need and expose it to the client.

Regards,

Alfredo
On Dec 27, 2011 12:25 AM, "Justin@GWT"  wrote:

> Thanks.
> Is there any workaround about the SOP? I would like to fetch some XML
> data, but not JSON data.
> I tried to enable the cross-site host mode, but I was told "cross-site
> hosted mode not yet implemented" by GWT.
>
> Best Regards,
> Justin
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-web-toolkit/-/VSJJiQgt088J.
> To post to this group, send email to google-web-toolkit@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.
>

-- 
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-toolkit@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.