るりまサーチ

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

別のキーワード

  1. openssl new
  2. _builtin new
  3. rexml/document new
  4. resolv new
  5. socket new

検索結果

<< 1 2 > >>

Net::HTTPGenericRequest#body=(body) (18112.0)

サーバに送るリクエストのエンティティボディを文字列で設定します。

...

@param body 設定するボディを文字列で与えます。

//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" # => "Test Post Data"
//}

@see Net::HTTPGenericRequest#body...

WEBrick::HTTPResponse#body=(val) (18112.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...

webrick/cgi (60.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...
...GI
def do_GET(req, res)
req.query['q'].list #=> フォームの値を保持した文字列の配列を返します。
end
end
MyCGI.new.start()

query メソッドが返す Hash オブジェクトのキーと値のうち値は WEBrick::HTTPUtils::FormData クラスの
インスタ...

WEBrick::HTTPAuth::BasicAuth (24.0)

HTTP の Basic 認証のためのクラスです。

...'s realm"
srv = WEBrick::HTTPServer.new({ :BindAddress => '127.0.0.1', :Port => 10080})

htpd = WEBrick::HTTPAuth::Htpasswd.new('dot.htpasswd')
htpd.set_passwd(nil, 'username', 'supersecretpass')

authenticator = WEBrick::HTTPAuth::BasicAuth.new(:UserDB => htpd, :Realm => realm)...
...srv.mount_proc('/basic_auth') {|req, res|
authenticator.authenticate(req, res)
res.body = "hoge"
}
srv.start # http://127.0.0.1:10080/basic_auth...

WEBrick::HTTPResponse#content_length -> Integer | nil (18.0)

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

...す。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
Dat...

絞り込み条件を変える

WEBrick::HTTPResponse#content_length=(len) (18.0)

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

...す。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
Dat...

Net::HTTPGenericRequest#body -> String (12.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::HTTPResponse#chunked=(flag) (12.0)

真に設定するとクライアントに返す内容(エンティティボディ)を chunk に分けるようになります。

...ポンスを chunk に分けてクライアントに返します。

require 'webrick'
include WEBrick
res = HTTPResponse.new( { :HTTPVersion => "1.1" } )
res.body = 'hoge'
res.chunked = true
print res.to_s

#=> 出力結果
HTTP/1.1 200 OK
Connection: Keep-Alive
Date: Sat, 27 Oc...

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

WEBrick::HTTPServlet::AbstractServlet#do_DELETE(request, response) -> () (12.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 > >>