|
FlatServe 0.3 |
||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | ||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | ||||||||
java.lang.Objectcom.small_it_office.flatserve.core.response.Response
com.small_it_office.flatserve.core.response.ByteArrayResponse
public class ByteArrayResponse
バイト配列による応答をあらわすクラスです。 このクラスのオブジェクトをHTTPサービスメソッドの戻り値として返すことで、 バイト配列を応答で返すことができます。 content-typeを自由に設定可能なので、任意の応答に汎用的に利用できます。
| コンストラクタの概要 | |
|---|---|
ByteArrayResponse()
|
|
| メソッドの概要 | |
|---|---|
byte[] |
getContent()
レスポンスボディの内容を取得します。 |
java.lang.String |
getContentType()
content-typeヘッダの値を返します。 |
void |
setContent(byte[] content)
レスポンスボディの内容を設定します。 |
void |
setContentType(java.lang.String contentType)
content-typeヘッダの値を設定します。 |
protected void |
writeResponse(com.small_it_office.flatserve.core.process.internal.RequestContext context)
HTTP応答を書き込みます。 |
| クラス com.small_it_office.flatserve.core.response.Response から継承されたメソッド |
|---|
getHeader, getHeaders, getStatusCode, sendResponse, setHeader, setStatusCode |
| クラス java.lang.Object から継承されたメソッド |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| コンストラクタの詳細 |
|---|
public ByteArrayResponse()
| メソッドの詳細 |
|---|
public java.lang.String getContentType()
Response 内の getContentTypepublic void setContentType(java.lang.String contentType)
contentType - content-typeヘッダの値public byte[] getContent()
public void setContent(byte[] content)
content - レスポンスボディの内容
protected void writeResponse(com.small_it_office.flatserve.core.process.internal.RequestContext context)
throws java.io.IOException
応答を書き込む前後に何らかの処理が必要であれば、それもこのメソッドで行います。
ただし、Response.setHeader(String, String)メソッドで設定したHTTPヘッダは
Response.sendResponse(RequestContext)メソッド内で行われるので、実装する必要はありません。
また、HttpServletResponse#flushBuffer()についても同様にこのメソッド内で行う必要はありません。
Response 内の writeResponsecontext - サーブレットとリクエストのコンテキスト情報
java.io.IOException - 応答の書き込み時にIOエラーが発生した場合
|
FlatServe 0.3 |
||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | ||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | ||||||||