public class HttpResponse extends Object implements Result
HttpResponse.setContentPath(String) の値を設定することで後者の方式がとられるようになる。| 修飾子とタイプ | クラスと説明 | 
|---|---|
static class  | 
HttpResponse.Status
HTTPレスポンスステータス。 
 | 
Result.Success| コンストラクタと説明 | 
|---|
HttpResponse()
HttpResponseオブジェクトを生成する。 | 
HttpResponse(int statusCode)
指定されたステータスコードの 
HttpResponseオブジェクトを生成する。 | 
HttpResponse(int statusCode,
            String contentPath)
指定されたHTTPステータスコードとコンテンツパスの 
HttpResponseオブジェクトを生成する。 | 
HttpResponse(String contentPath)
指定されたコンテンツパスの 
HttpResponseオブジェクトを生成する。 | 
| 修飾子とタイプ | メソッドと説明 | 
|---|---|
HttpResponse | 
addCookie(nablarch.fw.web.HttpCookie cookie)
サーバ側から送信されたクッキー情報を設定する。 
 | 
String | 
getContentLength()
Content-Lengthの値を取得する。 
 | 
ResourceLocator | 
getContentPath()
コンテンツパスを取得する。 
 | 
String | 
getContentType()
Content-Typeの値を取得する。 
 | 
nablarch.fw.web.HttpCookie | 
getCookie()
非推奨です。 
 
本メソッドは、複数のクッキー情報のうち先頭のクッキーを返すことしかできません。
              複数のクッキー情報を返すことができる 
#getCookieList()を使用してください。 | 
String | 
getHeader(String headerName)
HTTPレスポンスヘッダの値を返す。 
 | 
Map | 
getHeaderMap()
HTTPレスポンスヘッダを格納するMapを返す。 
 | 
String | 
getHttpVersion()
HTTPバージョンを表す文字列を返す。 
 | 
String | 
getLocation()
Locationの値を取得する。 
 | 
String | 
getMessage()
処理結果に対する詳細情報を返す。 
 | 
String | 
getReasonPhrase()
HTTPレスポンスのステータスフレーズを返す。 
 | 
int | 
getStatusCode()
HTTPレスポンスのステータスコードの値を返す。 
 | 
HttpResponse | 
setContentDisposition(String fileName)
Content-Dispositionの値を設定する。 
 | 
HttpResponse | 
setContentDisposition(String fileName,
                     boolean inline)
Content-Dispositionの値を設定する。 
 | 
HttpResponse | 
setContentPath(ResourceLocator resource)
コンテンツパスを設定する。 
 | 
HttpResponse | 
setContentPath(String path)
コンテンツパスを設定する。 
 | 
HttpResponse | 
setContentType(String contentType)
Content-Typeを設定する。 
 | 
HttpResponse | 
setCookie(nablarch.fw.web.HttpCookie cookie)
非推奨です。 
 
本メソッドは、複数のクッキー情報を設定することを意図したメソッド名を持つ
              
HttpResponse.addCookie(HttpCookie)に置き換わりました。 | 
void | 
setHeader(String headerName,
         String value)
HTTPレスポンスヘッダの値を設定する。 
 | 
HttpResponse | 
setLocation(String location)
Locationの値を設定する。 
 | 
HttpResponse | 
setStatusCode(int code)
HTTPレスポンスのステータスコードを設定する。 
 | 
HttpResponse | 
write(byte[] bytes)
HTTPレスポンスボディにバイト配列を書き込む。 
 | 
HttpResponse | 
write(ByteBuffer bytes)
HTTPレスポンスボディにバイト配列を書き込む。 
 | 
HttpResponse | 
write(CharSequence text)
HTTPレスポンスボディに文字列を書き込む。 
 | 
@Published public HttpResponse()
HttpResponseオブジェクトを生成する。
 
 以下のHTTPレスポンスメッセージに相当するHttpResponseオブジェクトを生成する。
 
     HTTP/1.1 200 OK
     Content-Type: text/plain;charset=UTF-8
 @Published public HttpResponse(int statusCode)
HttpResponseオブジェクトを生成する。
 
 このメソッドの処理は以下のソースコードと等価である。
 
     new HttpResponse().setStatusCode(statusCode);
 statusCode - HTTPステータスコード@Published
public HttpResponse(int statusCode,
                               String contentPath)
HttpResponseオブジェクトを生成する。
 
 このメソッドの処理は以下のソースコードと等価である。
 
     new HttpResponse().setStatusCode(statusCode)
                       .setContentPath(contentPath);
 statusCode - HTTPステータスコードcontentPath - コンテンツパス@Published public HttpResponse(String contentPath)
HttpResponseオブジェクトを生成する。
 
 このメソッドの処理は以下のソースコードと等価である。
 
     new HttpResponse().setStatusCode(200)
                       .setContentPath(contentPath);
 contentPath - コンテンツパス@Published public int getStatusCode()
302を返す。HttpResponse.setStatusCode(int)@Published public HttpResponse setStatusCode(int code)
200である。code - HTTPステータスコードIllegalArgumentException - 指定されたステータスコードが無効な場合@Published public String getReasonPhrase()
@Published public String getMessage()
(ステータスコード): (ステータスフレーズ)
@Published public String getHttpVersion()
@Published public Map getHeaderMap()
@Published public String getHeader(String headerName)
headerName - ヘッダー名@Published public void setHeader(String headerName, String value)
headerName - ヘッダー名value - ヘッダーの値@Published public String getContentType()
   this.headers().get("Content-Type")
 @Published public HttpResponse setContentType(String contentType)
contentType - Content-Typeの値HttpResponse.getContentType()@Published public String getLocation()
   this.headers().get("Location")
 @Published public HttpResponse setLocation(String location)
location - 遷移先URIHttpResponse.Status.SEE_OTHER@Published public HttpResponse setContentDisposition(String fileName)
fileName - ファイル名@Published public HttpResponse setContentDisposition(String fileName, boolean inline)
inlineにtrueを指定した場合、ダウンロードされたファイルは
 クライアントアプリで自動的に開かれる。fileName - ファイル名inline - インライン表示する場合はtrue@Published @Deprecated public nablarch.fw.web.HttpCookie getCookie()
#getCookieList()を使用してください。null@Published @Deprecated public HttpResponse setCookie(nablarch.fw.web.HttpCookie cookie)
HttpResponse.addCookie(HttpCookie)に置き換わりました。cookie - クッキー情報オブジェクト@Published public HttpResponse addCookie(nablarch.fw.web.HttpCookie cookie)
cookie - クッキー情報オブジェクト@Published public HttpResponse setContentPath(String path)
HttpResponse.setContentPath(ResourceLocator)に委譲する。path - コンテンツパス@Published public HttpResponse setContentPath(ResourceLocator resource)
ResourceLocatorオブジェクトがnullでない場合は、
 リソース名からContent-Typeを自動的に設定した後、コンテンツパスを設定する。ResourceLocatorオブジェクトがnullの場合は、コンテンツパスのみ設定する。resource - コンテンツパスHttpResponse.setContentPath(String)@Published public ResourceLocator getContentPath()
@Published public String getContentLength()
nullを返す。@Published public HttpResponse write(CharSequence text) throws HttpErrorResponse
nablarch.fw.web.handler.HttpResponseHandlerにレスポンスオブジェクトが戻された後である。
 また、このオブジェクトにコンテンツパスが設定されている場合、
 このライタに書き込まれた内容は単に無視される。text - 書き込む文字列HttpErrorResponse - バッファの上限を越えてデータが書き込まれた場合@Published public HttpResponse write(byte[] bytes) throws HttpErrorResponse
nablarch.fw.web.handler.HttpResponseHandlerにレスポンスオブジェクトが戻された後である。
 また、このオブジェクトにコンテンツパスが設定されている場合、
 このライタに書き込まれた内容は単に無視される。bytes - 書き込むバイト配列HttpErrorResponse - バッファの上限を越えてデータが書き込まれた場合@Published public HttpResponse write(ByteBuffer bytes) throws HttpErrorResponse
nablarch.fw.web.handler.HttpResponseHandlerにレスポンスオブジェクトが戻された後である。
 また、このオブジェクトにコンテンツパスが設定されている場合、
 このライタに書き込まれた内容は単に無視される。bytes - 書き込むバイト列を格納したバッファHttpErrorResponse - バッファの上限を越えてデータが書き込まれた場合