るりまサーチ

最速Rubyリファレンスマニュアル検索!
198件ヒット [1-100件を表示] (0.076秒)
トップページ > クエリ:-[x] > クエリ:body=[x]

別のキーワード

  1. _builtin -
  2. open-uri open
  3. irb/input-method new
  4. irb/input-method gets
  5. matrix -

検索結果

<< 1 2 > >>

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 (158.0)

Content-Length ヘッダの値を整数で表すアクセサです。デフォルトは nil です。

...Content-Length ヘッダの値を整数で表すアクセサです。デフォルトは nil です。

: body が String オブジェクトである場合
content_length の値が nil のとき Content-Length ヘッダには
body のサイズが使われます。nil でないとき body の実...
...同じかどうかの検証は行われません。
: body が IO オブジェクトである場合
content_length の値が nil のとき Content-Length ヘッダはレスポンスに含まれず、IO から全てを読み込ん
でそれをエンティティボディとします。nil でな...
...nt-Length ヘッダはレスポンスに含まれません。

@param len ヘッダの値を整数で指定します。nil を指定することは出来ません。

require 'webrick'
include WEBrick
res = HTTPResponse.new( { :HTTPVersion => "1.1" } )
f = File.new('testfile')
res.body = f...

Net::HTTP#post(path, data, header = nil, dest = nil) -> Net::HTTPResponse (154.0)

サーバ上の path にあるエンティティに対し文字列 data を POST で送ります。

...な body を
持ちません。

POST する場合にはヘッダに Content-Type: を指定する必要があります。
もし header に指定しなかったならば、 Content-Type として
"application/x-www-form-urlencoded" を用います。

dest は時代遅れの引数です。利用し...
...ruby]{
# net/http version 1.1
response, body = http.post('/cgi-bin/search.rb', 'query=subject&target=ruby')

# version 1.2
response = http.post('/cgi-bin/search.rb', 'query=subject&target=ruby')

# using block
File.open('save.html', 'w') {|f|
http.post('/cgi-bin/search.rb', 'query=subject&target=r...

Net::HTTP#post(path, data, header = nil, dest = nil) {|body_segment| .... } -> Net::HTTPResponse (154.0)

サーバ上の path にあるエンティティに対し文字列 data を POST で送ります。

...な body を
持ちません。

POST する場合にはヘッダに Content-Type: を指定する必要があります。
もし header に指定しなかったならば、 Content-Type として
"application/x-www-form-urlencoded" を用います。

dest は時代遅れの引数です。利用し...
...ruby]{
# net/http version 1.1
response, body = http.post('/cgi-bin/search.rb', 'query=subject&target=ruby')

# version 1.2
response = http.post('/cgi-bin/search.rb', 'query=subject&target=ruby')

# using block
File.open('save.html', 'w') {|f|
http.post('/cgi-bin/search.rb', 'query=subject&target=r...

WEBrick::HTTPResponse#to_s -> String (118.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...

絞り込み条件を変える

Net::HTTP#get(path, header = nil, dest = nil) -> Net::HTTPResponse (106.0)

サーバ上の path にあるエンティティを取得し、 Net::HTTPResponse のインスタンスとして返します。

...た、返り値が [レスポンスオブジェクト, そのボディ] となります。

//emlist[例][ruby]{
# net/http version 1.1
response, body = http.get( '/index.html' )

# net/http version 1.2
response = http.get('/index.html')

# compatible in both version
response , = http.get('/index.ht...

Net::HTTP#get(path, header = nil, dest = nil) {|body_segment| .... } -> Net::HTTPResponse (106.0)

サーバ上の path にあるエンティティを取得し、 Net::HTTPResponse のインスタンスとして返します。

...た、返り値が [レスポンスオブジェクト, そのボディ] となります。

//emlist[例][ruby]{
# net/http version 1.1
response, body = http.get( '/index.html' )

# net/http version 1.2
response = http.get('/index.html')

# compatible in both version
response , = http.get('/index.ht...

Net::HTTPGenericRequest#body -> String (106.0)

サーバに送るリクエストのエンティティボディを返します。

...クエストのエンティティボディを返します。

//emlist[例][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Post.new(uri.request_uri)
req.body = "Test Post Data"
req.body # => "Test Post Data"
//}

@see Net::HTTPGenericRequest#body=...

WEBrick::HTTPAuth.#basic_auth(req, res, realm) {|user, pass| ... } -> nil (106.0)

Basic 認証を行うためのメソッドです。

...ck::HTTPStatus::Unauthorized 認証に失敗した場合に発生します。

require 'webrick'
srv.mount_proc('/basic_auth') {|req, res|
HTTPAuth.basic_auth(req, res, "WEBrick's realm") {|user, pass|
user == 'webrick' && pass == 'supersecretpassword'
}
res.body = "hoge"
}...

WEBrick::HTTPServlet::AbstractServlet#do_DELETE(request, response) -> () (106.0)

自身の service メソッドから HTTP のリクエストに応じて 呼ばれるメソッドです。AbstractServlet のサブクラスはこれらのメソッドを適切に実装し なければいけません。返り値は特に規定されていません。

...ジェクトです。

例:

require 'webrick'
class HogeServlet < WEBrick::HTTPServlet::AbstractServlet
def do_GET(req, res)
res.body = 'hoge'
end
end

srv = WEBrick::HTTPServer.new({ :DocumentRoot => './',
:BindAddress => '127.0.0.1',...

絞り込み条件を変える

<< 1 2 > >>