public class HttpResponseHandler extends java.lang.Object implements Handler<HttpRequest,HttpResponse>
| 修飾子とタイプ | フィールドと説明 |
|---|---|
protected static java.lang.String |
USER_AGENT
User-Agentヘッダ。
|
| コンストラクタと説明 |
|---|
HttpResponseHandler() |
| 修飾子とタイプ | メソッドと説明 |
|---|---|
HttpResponse |
handle(HttpRequest req,
ExecutionContext ctx)
入力データに対する処理を実行する。
|
protected boolean |
isErrorResponse(HttpResponse res)
レスポンスがエラーか否かを判定する。
|
void |
setContentPathRule(ResourcePathRule contentPathRule)
言語対応コンテンツパスのルールを設定する。
|
void |
setConvertMode(java.lang.String convertMode)
HTTPレスポンスコードの変換モードを設定する。
|
HttpResponseHandler |
setDownloadFileNameEncoderFactory(DownloadFileNameEncoderFactory factory)
ダウンロードファイル名のエンコーダを取得するクラスを設定する
|
void |
setForceFlushAfterWritingHeaders(boolean usesFlush)
HTTPヘッダーをwriteした直後にFlushするかどうかの設定
デフォルト値はtrueである。
|
protected static void |
setStatusCode(HttpResponse res,
ServletExecutionContext ctx)
クライアントに送信するステータスコードを設定する。
|
static void |
writeBody(java.io.InputStream in,
javax.servlet.http.HttpServletResponse nativeRes)
メッセージボディの内容をクライアントに送信する。
|
void |
writeResponse(HttpResponse res,
ServletExecutionContext ctx)
HTTPレスポンスオブジェクトの内容をもとに、
クライアントにレスポンスを返す。
|
protected static final java.lang.String USER_AGENT
public void setForceFlushAfterWritingHeaders(boolean usesFlush)
usesFlush - Flushの有無public HttpResponseHandler setDownloadFileNameEncoderFactory(DownloadFileNameEncoderFactory factory)
factory - ダウンロードファイル名のエンコーダを取得するクラスpublic void setConvertMode(java.lang.String convertMode)
HTTPレスポンスコードの変換モードは以下のいずれかである。
設定した値は、HttpResponseUtil.chooseResponseStatusCode(HttpResponse, ServletExecutionContext)で使用される。
変換の仕様については、HttpResponseUtil.chooseResponseStatusCode(HttpResponse, ServletExecutionContext)を参照。
convertMode - HTTPレスポンスコードの変換モード。public HttpResponse handle(HttpRequest req, ExecutionContext ctx) throws java.lang.ClassCastException
この実装では、後続ハンドラの処理結果(HttpResponse)の内容をもとに、 クライアントに対するレスポンス処理を行う。
handle インタフェース内 Handler<HttpRequest,HttpResponse>req - 入力データctx - 実行コンテキストjava.lang.ClassCastException - 引数 ctx の実際の型が ServletExecutionContext でない場合。public void writeResponse(HttpResponse res, ServletExecutionContext ctx)
res - HTTPレスポンスオブジェクトctx - 実行コンテキストprotected boolean isErrorResponse(HttpResponse res)
ステータスコードが200~300系以外であればtrue、 それ以外であればfalseを返す。
res - HTTPレスポンスpublic void setContentPathRule(ResourcePathRule contentPathRule)
contentPathRule - 言語対応コンテンツパスのルールprotected static void setStatusCode(HttpResponse res, ServletExecutionContext ctx)
res - HTTPレスポンスオブジェクトctx - 実行コンテキストpublic static void writeBody(java.io.InputStream in,
javax.servlet.http.HttpServletResponse nativeRes)
throws java.io.IOException
in - 入力ストリームの内容nativeRes - サーブレットレスポンスjava.io.IOException - ソケットI/Oにおけるエラー