Resolve HTTP 304 - not modified in AJAX call made via GWT

Posted by Salvin Francis on Stack Overflow See other posts from Stack Overflow or by Salvin Francis
Published on 2010-03-19T08:31:27Z Indexed on 2010/04/18 6:43 UTC
Read the original article Hit count: 198

We are using an application made in GWT with the server as tomcat. The project runs fine normally, however there are situations where the server is restarted. At such point of time, the ajax call made by the code below returns blank text with the status code as 304

RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.POST, URL.encode(serverUrl)); //-- serverUrl is the url to which this call is posted to.
requestBuilder.setHeader("Content-Type", "application/x-www-form-urlencoded");
requestBuilder.setHeader("Expires","0");
requestBuilder.sendRequest(
    postData, 
    new RequestCallback()
    {

        public void onError(Request request, Throwable exception)
        {
            //Do nothing
        }

        public void onResponseReceived(Request request, Response response)
        {
            //sometimes when the server is restarted, I get response.getStatusCode() = 304 and the response.getText() as blank
        }
    }
);

normally we get back some data from the server inside this response text. How do we now get the data when the response itself is blank ?

© Stack Overflow or respective owner

Related posts about gwt

Related posts about AJAX