Class WEBrick::HTTPServlet::AbstractServlet
In: webrick/httpservlet/abstract.rb
Parent: Object

Methods

do_GET   do_HEAD   do_OPTIONS   get_instance   new   service  

Public Class methods

[Source]

# File webrick/httpservlet/abstract.rb, line 22
      def self.get_instance(config, *options)
        self.new(config, *options)
      end

[Source]

# File webrick/httpservlet/abstract.rb, line 26
      def initialize(server, *options)
        @server = @config = server
        @logger = @server[:Logger]
        @options = options
      end

Public Instance methods

[Source]

# File webrick/httpservlet/abstract.rb, line 42
      def do_GET(req, res)
        raise HTTPStatus::NotFound, "not found."
      end

[Source]

# File webrick/httpservlet/abstract.rb, line 46
      def do_HEAD(req, res)
        do_GET(req, res)
      end

[Source]

# File webrick/httpservlet/abstract.rb, line 50
      def do_OPTIONS(req, res)
        m = self.methods.grep(/^do_[A-Z]+$/)
        m.collect!{|i| i.sub(/do_/, "") }
        m.sort!
        res["allow"] = m.join(",")
      end

[Source]

# File webrick/httpservlet/abstract.rb, line 32
      def service(req, res)
        method_name = "do_" + req.request_method.gsub(/-/, "_")
        if respond_to?(method_name)
          __send__(method_name, req, res)
        else
          raise HTTPStatus::MethodNotAllowed,
                "unsupported method `#{req.request_method}'."
        end
      end

[Validate]

ruby-doc.org is hosted and maintained by James Britt and Happy Camper Studios, a Ruby application development company in Phoenix, Arizona. The site was created in 2002 as part of the Ruby Documentation Project to promote the Ruby language and to help other Ruby hackers.

Documentation content on ruby-doc.org is provided by remarkable members of the Ruby community.

For more information on the Ruby programming language, visit ruby-lang.org.

Want to help improve Ruby's API docs? See Ruby Documentation Guidelines.