別のキーワード
クラス
-
WEBrick
:: HTTPResponse (144)
キーワード
- []= (12)
- body= (12)
- chunked= (12)
-
content
_ length (12) -
content
_ length= (12) -
http
_ version (12) -
reason
_ phrase= (12) -
set
_ redirect (12) - status= (12)
-
status
_ line (12) -
to
_ s (12)
検索結果
先頭5件
-
WEBrick
:: HTTPResponse # set _ redirect(status , url) -> () (9209.0) -
指定された url にリダイレクトするためのヘッダと内容(エンティティボディ)を 設定し例外 status を発生させます。
...url にリダイレクトするためのヘッダと内容(エンティティボディ)を
設定し例外 status を発生させます。
@param status WEBrick::HTTPStatus::Redirect を指定します。
@param url URL を指定します。
例:
require 'webrick'
res.set_redirect WEBrick::H......TTPStatus::TemporaryRedirect... -
WEBrick
:: HTTPResponse # http _ version -> WEBrick :: HTTPVersion (6209.0) -
レスポンスの HTTP のバージョンを表す WEBrick::HTTPVersion オブジェクトを返します。
...ージョンを表す WEBrick::HTTPVersion オブジェクトを返します。
require 'webrick'
res = WEBrick::HTTPResponse.new( { :HTTPVersion => "1.1" } )
p res.http_version.class #=> WEBrick::HTTPVersion
p res.http_version.to_s... -
WEBrick
:: HTTPResponse # reason _ phrase=(val) (6109.0) -
HTTP のレスポンスの最初の行の reason phrase をセットします。 この値が nil の場合 reason phrase は status から生成されます。 デフォルトは nil です。
...行の reason phrase をセットします。
この値が nil の場合 reason phrase は status から生成されます。
デフォルトは nil です。
@param val reason phrase を表す文字列を指定します。
require 'webrick'
res = WEBrick::HTTPResponse.new( { :HTTPVersion => "......1.1" } )
res.status = 404
p res.reason_phrase #=> "Not Found"... -
WEBrick
:: HTTPResponse # status _ line -> String (3115.0) -
HTTP のステータスラインを CR+LF 付き文字列で返します。
...HTTP のステータスラインを CR+LF 付き文字列で返します。
require 'webrick'
res = WEBrick::HTTPResponse.new( { :HTTPVersion => "1.1" } )
res.status = 404
p res.status_line #=> "HTTP/1.1 404 Not Found \r\n"... -
WEBrick
:: HTTPResponse # content _ length -> Integer | nil (3109.0) -
Content-Length ヘッダの値を整数で表すアクセサです。デフォルトは nil です。
...Content-Length ヘッダの値を整数で表すアクセサです。デフォルトは nil です。
: body が String オブジェクトである場合
content_length の値が nil のとき Content-Length ヘッダには
body のサイズが使われます。nil でないとき body の実......せん。
@param len ヘッダの値を整数で指定します。nil を指定することは出来ません。
require 'webrick'
include WEBrick
res = HTTPResponse.new( { :HTTPVersion => "1.1" } )
f = File.new('testfile')
res.body = f
res.content_length = 2
print res.to_s
#=>......出力結果
HTTP/1.1 200 OK
Connection: Keep-Alive
Date: Sat, 27 Oct 2007 12:04:32 GMT
Server:
Content-Length: 2
ho... -
WEBrick
:: HTTPResponse # cookies -> [WEBrick :: Cookie] (3109.0) -
レスポンスの Set-Cookie ヘッダの値を表す WEBrick::Cookie オブジェクトの配列です。 レスポンスに新たに Cookie を加えたい場合はこの配列に WEBrick::Cookie オブジェクトを加えます。
...スの Set-Cookie ヘッダの値を表す WEBrick::Cookie オブジェクトの配列です。
レスポンスに新たに Cookie を加えたい場合はこの配列に WEBrick::Cookie オブジェクトを加えます。
require 'webrick'
res.cookies << WEBrick::Cookie.parse_set_cookie(k)... -
WEBrick
:: HTTPResponse # to _ s -> String (3109.0) -
実際にクライアントに送られるデータを文字列として返します。
...字列として返します。
require 'webrick'
include WEBrick
res = HTTPResponse.new( { :HTTPVersion => "1.1" } )
res.body = 'hoge'
print res.to_s
#=> 出力結果
HTTP/1.1 200 OK
Connection: Keep-Alive
Date: Sat, 27 Oct 2007 08:58:49 GMT
Server:
Content-Length: 4
hog... -
WEBrick
:: HTTPResponse # []=(field , val) (3009.0) -
レスポンスの該当するヘッダに val を設定します。
...@param field ヘッダ名を文字列で指定します。大文字と小文字を区別しません。
@param val ヘッダの値を指定します。to_s メソッドによって文字列に変換されます。
require 'time'
res['last-modified'] = Time.now.httpdate
@see WEBrick::HTTPResp......onse#chunked?, WEBrick::HTTPResponse#content_length,
WEBrick::HTTPResponse#content_type... -
WEBrick
:: HTTPResponse # body=(val) (3009.0) -
クライアントに返す内容(エンティティボディ)をセットします。
...。
@param val メッセージボディを文字列か IO オブジェクトで指定します。
自身が chunked であってもチャンク形式にする必要はありません。
適切にチャンク形式エンコーディングされます。
require 'webrick'
i......nclude WEBrick
res = HTTPResponse.new( { :HTTPVersion => "1.1" } )
res.body = 'hoge'
print res.to_s
#=> 出力結果
HTTP/1.1 200 OK
Connection: Keep-Alive
Date: Sat, 27 Oct 2007 08:58:49 GMT
Server:
Content-Length: 4
hoge...