サーバーをTomcatとして、GWTで作成されたアプリケーションを使用しています。プロジェクトは正常に実行されますが、サーバーが再起動される場合があります。そのような時点で、以下のコードによって行われた 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
}
}
);
通常、この応答テキスト内でサーバーから何らかのデータが返されます。応答自体が空白の場合、どうすればデータを取得できますか?