Package nablarch.common.web.download
Class FileResponse
java.lang.Object
nablarch.fw.web.HttpResponse
nablarch.common.web.download.FileResponse
- All Implemented Interfaces:
- Result
FileオブジェクトからHTTPレスポンスを生成するHttpResponse継承クラス。- 
Nested Class SummaryNested classes/interfaces inherited from class nablarch.fw.web.HttpResponseHttpResponse.StatusNested classes/interfaces inherited from interface nablarch.fw.ResultResult.ClientError, Result.Error, Result.MultiStatus, Result.NotFound, Result.Success
- 
Field SummaryFields inherited from class nablarch.fw.web.HttpResponseCONTENT_DISPOSITION, LS
- 
Constructor SummaryConstructorsConstructorDescriptionFileResponse(File file) コンストラクタ。FileResponse(File file, boolean deleteOnCleanup) コンストラクタ。
- 
Method SummaryModifier and TypeMethodDescriptioncleanup()リソースを開放する。HTTPレスポンスボディの内容を保持するストリームを取得する。HTTPレスポンスボディの内容を表す文字列を返す。Content-Lengthの値を取得する。コンテンツパスを取得する。booleanHTTPレスポンスボディの内容が設定されていなければtrueを返す。setBodyStream(InputStream bodyStream) HTTPレスポンスボディの内容を保持するストリームを設定する。setContentPath(String path) コンテンツパスを設定する。setContentPath(ResourceLocator resource) コンテンツパスを設定する。toString()オブジェクトの内容と等価なHTTPレスポンスメッセージを返す。write(byte[] bytes) HTTPレスポンスボディにバイト配列を書き込む。write(CharSequence text) HTTPレスポンスボディに文字列を書き込む。write(ByteBuffer bytes) HTTPレスポンスボディにバイト配列を書き込む。Methods inherited from class nablarch.fw.web.HttpResponseaddCookie, getCharset, getContentDisposition, getContentType, getCookie, getCookieList, getHeader, getHeaderMap, getHttpCookies, getHttpVersion, getLocation, getMessage, getReasonPhrase, getStatusCode, getTransferEncoding, isSuccess, parse, parse, setContentDisposition, setContentDisposition, setContentType, setCookie, setHeader, setHttpVersion, setLocation, setStatusCode, setTransferEncoding
- 
Constructor Details- 
FileResponseコンストラクタ。 本コンストラクタを使用してインスタンスを生成した場合、 リクエスト処理の終了時に自動的にファイルは削除されない。- Parameters:
- file- ファイル
 
- 
FileResponseコンストラクタ。- Parameters:
- file- ファイル
- deleteOnCleanup- リクエスト処理の終了時に自動的にファイルを削除する場合は- true
 
 
- 
- 
Method Details- 
getContentLengthDescription copied from class:HttpResponseContent-Lengthの値を取得する。 HTTPレスポンスボディの内容がこのオブジェクト自体に保持されている場合に限り、 そのバイト数を返す。
 それ以外はnullを返す。- Overrides:
- getContentLengthin class- HttpResponse
- Returns:
- Content-Lengthの値
 
- 
isBodyEmpty- Overrides:
- isBodyEmptyin class- HttpResponse
- Returns:
- 必ず{@link false}を返す
 
- 
getBodyStringDescription copied from class:HttpResponseHTTPレスポンスボディの内容を表す文字列を返す。- Overrides:
- getBodyStringin class- HttpResponse
- Returns:
- ボディの内容を表す文字列を返す
 
- 
getBodyStreamDescription copied from class:HttpResponseHTTPレスポンスボディの内容を保持するストリームを取得する。- Overrides:
- getBodyStreamin class- HttpResponse
- Returns:
- HTTPレスポンスボディの内容を保持するストリーム
 
- 
toStringDescription copied from class:HttpResponseオブジェクトの内容と等価なHTTPレスポンスメッセージを返す。- Overrides:
- toStringin class- HttpResponse
 
- 
cleanupDescription copied from class:HttpResponseリソースを開放する。- Overrides:
- cleanupin class- HttpResponse
- Returns:
- 本オブジェクト
 
- 
getContentPathコンテンツパスを取得する。 HTTPレスポンスボディに書き込むコンテンツパスを取得する。 本クラスではコンテンツパスを設定できないため、 本メソッドは必ずnullを返す。- Overrides:
- getContentPathin class- HttpResponse
- Returns:
- 必ずnullを返す。
 
- 
setBodyStreamDescription copied from class:HttpResponseHTTPレスポンスボディの内容を保持するストリームを設定する。- Overrides:
- setBodyStreamin class- HttpResponse
- Parameters:
- bodyStream- HTTPレスポンスボディの内容を保持するストリーム
- Returns:
- 本オブジェクト
 
- 
setContentPathDescription copied from class:HttpResponseコンテンツパスを設定する。 本処理はHttpResponse.setContentPath(ResourceLocator)に委譲する。- Overrides:
- setContentPathin class- HttpResponse
- Parameters:
- path- コンテンツパス
- Returns:
- 本オブジェクト
 
- 
setContentPathDescription copied from class:HttpResponseコンテンツパスを設定する。 指定したResourceLocatorオブジェクトがnullでない場合は、 リソース名からContent-Typeを自動的に設定した後、コンテンツパスを設定する。
 ResourceLocatorオブジェクトがnullの場合は、コンテンツパスのみ設定する。- Overrides:
- setContentPathin class- HttpResponse
- Parameters:
- resource- コンテンツパス
- Returns:
- 本オブジェクト
- See Also:
 
- 
writeDescription copied from class:HttpResponseHTTPレスポンスボディに文字列を書き込む。 このメソッドで書き込まれたデータは、本オブジェクトが保持する バッファに保持され、クライアントソケットに対する書き込みは一切発生しない。 (このライタに対するflush()は単に無視される。)
 実際にソケットに対するレスポンス処理が行われるのは、HttpResponseHandlerにレスポンスオブジェクトが戻された後である。 また、このオブジェクトにコンテンツパスが設定されている場合、 このライタに書き込まれた内容は単に無視される。- Overrides:
- writein class- HttpResponse
- Parameters:
- text- 書き込む文字列
- Returns:
- 本オブジェクト
 
- 
writeDescription copied from class:HttpResponseHTTPレスポンスボディにバイト配列を書き込む。 このメソッドで書き込まれたデータは、本オブジェクトが保持する バッファに保持され、クライアントソケットに対する書き込みは一切発生しない。 (このライタに対するflush()は単に無視される。)
 実際にソケットに対するレスポンス処理が行われるのは、HttpResponseHandlerにレスポンスオブジェクトが戻された後である。 また、このオブジェクトにコンテンツパスが設定されている場合、 このライタに書き込まれた内容は単に無視される。- Overrides:
- writein class- HttpResponse
- Parameters:
- bytes- 書き込むバイト配列
- Returns:
- 本オブジェクト
 
- 
writeDescription copied from class:HttpResponseHTTPレスポンスボディにバイト配列を書き込む。 このメソッドで書き込まれたデータは、本オブジェクトが保持する バッファに保持され、クライアントソケットに対する書き込みは一切発生しない。 (このライタに対するflush()は単に無視される。)
 実際にソケットに対するレスポンス処理が行われるのは、HttpResponseHandlerにレスポンスオブジェクトが戻された後である。 また、このオブジェクトにコンテンツパスが設定されている場合、 このライタに書き込まれた内容は単に無視される。- Overrides:
- writein class- HttpResponse
- Parameters:
- bytes- 書き込むバイト列を格納したバッファ
- Returns:
- 本オブジェクト
 
 
-