55件ヒット
[1-55件を表示]
(0.027秒)
種類
- インスタンスメソッド (44)
- ライブラリ (11)
ライブラリ
-
webrick
/ httpresponse (44)
クラス
キーワード
-
content
_ length (11) -
content
_ length= (11) -
to
_ s (11) -
webrick
/ cgi (11)
検索結果
先頭5件
-
WEBrick
:: HTTPResponse # body=(val) (18118.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
hoge... -
WEBrick
:: HTTPResponse # content _ length -> Integer | nil (6196.0) -
Content-Length ヘッダの値を整数で表すアクセサです。デフォルトは nil です。
...Content-Length ヘッダの値を整数で表すアクセサです。デフォルトは nil です。
: body が String オブジェクトである場合
content_length の値が nil のとき Content-Length ヘッダには
body のサイズが使われます。nil でないとき body の実......時には
content_length の値は無視され Content-Length ヘッダはレスポンスに含まれません。
@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 # content _ length=(len) (6196.0) -
Content-Length ヘッダの値を整数で表すアクセサです。デフォルトは nil です。
...Content-Length ヘッダの値を整数で表すアクセサです。デフォルトは nil です。
: body が String オブジェクトである場合
content_length の値が nil のとき Content-Length ヘッダには
body のサイズが使われます。nil でないとき body の実......時には
content_length の値は無視され Content-Length ヘッダはレスポンスに含まれません。
@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
/ cgi (66.0) -
一般の CGI 環境で webrick ライブラリのサーブレットと同じように CGI スクリプトを書くための ライブラリです。サーバが WEBrick でなくても使うことが出来ます。
...brick/cgi'
class MyCGI < WEBrick::CGI
def do_GET(req, res)
res["content-type"] = "text/plain"
ret = "hoge\n"
res.body = ret
end
end
MyCGI.new.start()
==== do_XXX メソッド
do_XXX メソッドの XXX には GET, HEAD, POST, PUT, DELETE, OPTIONS が使用できます。......GET(req, res)
req.query #=> Hash を返します。
req.query['q']
req.query['num']
end
end
MyCGI.new.start()
同じ名前のフィールドが複数ある場合、list メソッドや each_data メソッドを使います。
require "webrick/cgi......class MyCGI < WEBrick::CGI
def do_GET(req, res)
req.content_length
req.content_type
req.path_info
req.query_string
req.peeraddr
req.host
req.user
req.request_method
req.script_name
req.port
end
end
MyCGI.new.start()
=== リンク
* 3875... -
WEBrick
:: HTTPResponse # to _ s -> String (18.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
hoge...