調査後の私自身の答え。
パート 1: 私がテストしたアプリケーション サーバーに、「コミット」フェーズを過ぎてネットワークにエラーを送信するよう説得する方法はないようです。次のサーブレット コードは、ソケットに正当な HTTP Chunked Transfer ヘッダーを作成します。興味深いことに、WebSphere の場合、エンド マークの前のストリームの末尾にエラー メッセージが追加されます。
public class Servlet extends HttpServlet {
public static final int ARRAY_SIZE = 65536;
private static final int SEND_COUNT = 100000;
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException {
String testData = "This is a fairly long piece of test text, running on and on and on, over and over.";
final ServletOutputStream outputStream = response.getOutputStream();
for (int i = 0; i < SEND_COUNT; ++i) {
outputStream.println(testData);
}
throw new ServletException("Break it now");
}
}
パート 2: アプリケーション サーバーが偽のデータをワイヤに書き込むか、長さ 0 のチャンクを閉じずにソケットを閉じようとしても、一般的なクライアントはエラーを報告しません。IE7、FF3、および cURL は、チャンク エンコーディングのエラーを報告しません。これは HTTP ダウンロードを本質的に信頼できないものにし、HTTP 1.1 RFC の文言ではないにしても精神に反します。