私のアプリケーションが行っているのは、大きな csv ファイル (レポート) を作成することであり、実際にファイルを保存せずに csv ファイルの内容を配信するという考えです。これが私のコードです
String csvData; //this is the string that contains the csv contents
byte[] csvContents = csvData.getBytes();
response.contentType = "text/csv";
response.headers.put("Content-Disposition", new Header(
"Content-Disposition", "attachment;" + "test.csv"));
response.headers.put("Cache-Control", new Header("Cache-Control",
"max-age=0"));
response.out.write(csvContents);
ok();
生成されているcsvファイルはかなり大きく、私が得ているエラーは
org.jboss.netty.handler.codec.frame.TooLongFrameException: HTTP 行が 4096 バイトを超えています。
この問題を克服する最善の方法は何ですか?
私の技術スタックは、Play フレームワーク 1.2.5 の Java 6 です。
注: 応答オブジェクトのオリジンは play.mvc.Controller.response です