Hi,

I am working on a basic GWT project. Application sends a GET methos
HTTP request and gets the response back.

It works fine on IE on Windows XP SP3.

(1)
But on firefox 3.6.2 response can not be received successfully,
response status code=0 and getText() returns empty.

I monitor HTTP traffice with a HTTP sniffer and I can see that the
response has the 200 OK success code. Why the application receives
nothing and statuscode=0 even though real response the 200 OK success
status code. I deployed application on tomcat 6.0.24 and called the
sample html page on that tomcat url.

Request Stream
GET /search?hl=tr&source=hp&q=apple&meta=&aq=f&aqi=&aql=&oq=&gs_rfai=
HTTP/1.1
Host: www.google.com.tr
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:
1.9.2.2) Gecko/20100316 Firefox/3.6.2 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/
*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Content-Type: text/html; charset=ISO-8859-1
Referer: 
http://localhost:8080/StockWatcher/stockwatcher/EEDD04E251D881A733F7A7251EFFFBFD.cache.html
Origin: http://localhost:8080

Response Stream
HTTP/1.1 200 OK
Cache-Control: private, max-age=0
Date: Sun, 04 Apr 2010 18:22:51 GMT
Expires: -1
Content-Type: text/html; charset=UTF-8
Set-Cookie:
PREF=ID=f343ff66f82b5a7c:TM=1270405371:LM=1270405371:S=WMVizvlmsZXcvgcT;
expires=Tue, 03-Apr-2012 18:22:51 GMT; path=/; domain=.google.com.tr
Set-Cookie:
NID=33=nN5HNdmh3tKGEDIuziRVX62GEWKxqrMHKyYI0mDwPoEdwYpn2CL08CSg-
yRzmdlpiByuhneRvO9e-7J8z9cZYz04hpqOUdcJhrGuo0gjjHXjc-5KCMtvEL5rlkviVZqx;
expires=Mon, 04-Oct-2010 18:22:51 GMT; path=/; domain=.google.com.tr;
HttpOnly
Server: gws
Content-Length: 43811
X-XSS-Protection: 0


(2)
On Safari 4.0.4, it is also failed.. GET method is replaced with
OPTIONS.. I did not understand why?

Request Stream
OPTIONS /search?
hl=tr&source=hp&q=apple&meta=&aq=f&aqi=&aql=&oq=&gs_rfai= HTTP/1.1
Host: www.google.com.tr
Referer: 
http://localhost:8080/StockWatcher/stockwatcher/85835FC08E93A4C27665C5565E7E3A47.cache.html
Accept: */*
Accept-Language: en-US
Access-Control-Request-Method: GET
Origin: http://localhost:8080
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US)
AppleWebKit/531.21.8 (KHTML, like Gecko) Version/4.0.4 Safari/
531.21.10
Accept-Encoding: gzip, deflate
Access-Control-Request-Headers: Content-Type
Cookie: HSID=A09AOg9VSbXdm0HHx;
NID=33=EXvpxyJYXqCf6ZK64XEZT2whqcm5eoQygIxkMqVPU6sUtey1AwhNWpPore6J_JcHejKJBlQTaSwo6FCql-3kRi-
QrnDH1mw9tI2GNEgpd9TxERrrSGLjMzm-o19KauBG;
PREF=ID=ca46045e0b6247bc:TM=1270335214:LM=1270335214:S=6AQVsDeddcZEEDi4;
SID=DQAAAI4AAABIRgYmp1mOrZToVGj5BLNgHuA310aFV7JpnzVcKkiiyLLlDRNTKoNW8kWTWQhUbCCI2u2gmGPpQcb5AFGZZ2ujim9qYewQ-
Wh_dvjmC3TwFLqZGY7zLLJLZy6sm0cfk9PmZK2oDnFKl4nDncOxBc54ISH3iJqh9uMmZv2auPVv05s9UPn-
jVEtPd99_Y_h4nU
Content-Length: 0
Connection: keep-alive

Response Stream
HTTP/1.1 405 Method Not Allowed
Content-Type: text/html; charset=UTF-8
Content-Length: 1400
Date: Sun, 04 Apr 2010 18:17:14 GMT
Server: GFE/2.0
X-XSS-Protection: 0

Code..
        public void onModuleLoad() {
                String url = "http://www.google.com.tr/search";;
                String sendData =
"hl=tr&source=hp&q=apple&meta=&aq=f&aqi=&aql=&oq=&gs_rfai=";

                String url2 = url + "?" + sendData;
                RequestBuilder rqst = new RequestBuilder(RequestBuilder.GET, URL
                                .encode(url2));
                try {
                        Window.alert("URL=" + rqst.getUrl());
                        rqst.setHeader("Content-Type", "text/html; 
charset=ISO-8859-1");
                        rqst.setTimeoutMillis(15000);

                        Request request = rqst.sendRequest(null, new 
RequestCallback() {

                                @Override
                                public void onError(Request request, Throwable 
exception) {
                                        Window.alert("HATA====" + 
exception.getMessage());
                                }

                                @Override
                                public void onResponseReceived(Request request,
                                                Response response) {
                                         Window.alert("Status Code=" + 
response.getStatusCode());
                                         Window.alert("Return Data=" + 
response.getText());
                                        if (response.getStatusCode() == 200) {
                                                Window
                                                                .alert("SUCCESS 
-- Reponse="
                                                                                
+ response.getText());
                                                Window.alert("response_text="
                                                                + 
response.getText());
                                                Window.alert("response="
                                                                + 
response.getHeadersAsString());
                                                Window.alert("response="
                                                                + 
response.getStatusText());
                                                Window.alert("response="
                                                                + 
response.getStatusCode());
                                        } else {
                                                Window.alert("error");
                                        }
                                        Window.alert("request="
                                                        + (request.isPending() 
== Boolean.TRUE ? "PENDING"
                                                                        : 
"OK"));
                                        Window.alert("Reponse Text=" + 
response.getText());

                                }
                        });

                } catch (RequestException e) {
                        Window.alert("HATa" + e.getLocalizedMessage());
                        e.printStackTrace();
                } catch (StatusCodeException e) {
                        Window.alert("STATUA HATASI: " + 
e.getLocalizedMessage());
                        e.printStackTrace();
                }

                // RootPanel.get().add(img);
}

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