Resolve HTTP 304 - not modified in AJAX call made via GWT
- by Salvin Francis
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 ?