るりまサーチ

最速Rubyリファレンスマニュアル検索!
12件ヒット [1-12件を表示] (0.019秒)
トップページ > クエリ:script_name[x] > クエリ:webrick/cgi[x]

別のキーワード

  1. _builtin name
  2. resolv each_name
  3. net/imap name
  4. openssl name
  5. win32ole name

検索結果

webrick/cgi (38048.0)

一般の CGI 環境で webrick ライブラリのサーブレットと同じように CGI スクリプトを書くための ライブラリです。サーバが WEBrick でなくても使うことが出来ます。

...do_XXX メソッドを呼び出します。このようにしてスクリプトは実行されます。

例:

#!/usr/local/bin/ruby
require 'webrick/cgi'

class MyCGI < WEBrick::CGI
def do_GET(req, res)
res["content-type"] = "text/plain"
ret = "hoge\n"
res.body = ret
end
e...
...ムフィールドの値は WEBrick::HTTPRequest#query メソッドが返す Hash オブジェクトに
収納されています。

require "webrick/cgi"
class MyCGI < WEBrick::CGI
def do_GET(req, res)
req.query #=> Hash を返します。
req.query['q']...
...できます。

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
MyC...