私は GWT-RPC を使用してサーブレットを呼び出してデータをエクスポートしようとしています。ケースを単純化するために、RemoteServiceServlet に次のコードを使用して、最初に出力テキストをハードコードしようとしています。
public void exportHistory(ArrayList<String> sqlHistory){
this.sqlHistory = sqlHistory;
try {
HttpServletResponse res = this.getThreadLocalResponse();
res.setContentType("text/plain");
res.setHeader("Content-disposition", "attachment; filename=history.txt");
ServletOutputStream out = res.getOutputStream();
out.println("test1");
out.println("test2");
out.flush();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
ただし、asyncCallback で onFailure(Throwable catch) を返すと、キャッチされるのは InvocationException です。何が問題ですか?