Class: Merb::Rack::WEBrick

Inherits:
Object show all
Defined in:
lib/merb-core/rack/adapter/webrick.rb

Class Method Summary collapse

Class Method Details

.start(opts = {}) ⇒ Object

Parameters

opts<Hash>

Options for WEBrick (see below).

Options (opts)

:host<String>

The hostname that WEBrick should serve.

:port<Fixnum>

The port WEBrick should bind to.

:app<String>>

The application name.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/merb-core/rack/adapter/webrick.rb', line 16

def self.start(opts={})
  Merb.logger.warn!("Using Webrick adapter")

  options = {
    :Port        => opts[:port],
    :BindAddress => opts[:host],
    :Logger      => Merb.logger,
    :AccessLog   => [
      [Merb.logger, ::WEBrick::AccessLog::COMMON_LOG_FORMAT],
      [Merb.logger, ::WEBrick::AccessLog::REFERER_LOG_FORMAT]
    ]
  }
     
  server = ::WEBrick::HTTPServer.new(options)
  Merb::Server.change_privilege
  server.mount("/", ::Rack::Handler::WEBrick, opts[:app])
  server.start
end