FlatServe
0.2

com.small_it_office.flatserve.core.response
クラス ByteArrayResponse

java.lang.Object
  上位を拡張 com.small_it_office.flatserve.core.response.AbstractResponse
      上位を拡張 com.small_it_office.flatserve.core.response.ByteArrayResponse

public class ByteArrayResponse
extends AbstractResponse

バイト配列による応答をあらわすクラスです。 このクラスのオブジェクトを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.AbstractResponse から継承されたメソッド
getHeader, getHeaders, sendResponse, setHeader
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

ByteArrayResponse

public ByteArrayResponse()
メソッドの詳細

getContentType

public java.lang.String getContentType()
content-typeヘッダの値を返します。

定義:
クラス AbstractResponse 内の getContentType
戻り値:
content-typeヘッダの値

setContentType

public void setContentType(java.lang.String contentType)
content-typeヘッダの値を設定します。

パラメータ:
contentType - content-typeヘッダの値

getContent

public byte[] getContent()
レスポンスボディの内容を取得します。

戻り値:
レスポンスボディの内容

setContent

public void setContent(byte[] content)
レスポンスボディの内容を設定します。

パラメータ:
content - レスポンスボディの内容

writeResponse

protected void writeResponse(com.small_it_office.flatserve.core.process.internal.RequestContext context)
                      throws java.io.IOException
HTTP応答を書き込みます。 このメソッドはアプリケーションから呼び出すことはありません。

応答を書き込む前後に何らかの処理が必要であれば、それもこのメソッドで行います。 ただし、AbstractResponse.setHeader(String, String)メソッドで設定したHTTPヘッダは AbstractResponse.sendResponse(RequestContext)メソッド内で行われるので、実装する必要はありません。 また、HttpServletResponse#flushBuffer()についても同様にこのメソッド内で行う必要はありません。

定義:
クラス AbstractResponse 内の writeResponse
パラメータ:
context - サーブレットとリクエストのコンテキスト情報
例外:
java.io.IOException - 応答の書き込み時にIOエラーが発生した場合

FlatServe
0.2