我们正在使用在 GWT 中制作的应用程序,服务器为 tomcat。该项目运行正常,但是存在重新启动服务器的情况。此时,下面代码的ajax调用返回空白文本,状态码为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
}
}
);
通常我们会在这个响应文本中从服务器取回一些数据。当响应本身为空白时,我们现在如何获取数据?