static public Method

DispatchServlet.dispatch(options = {})

Start the WEBrick server with the given options, mounting the DispatchServlet at /.

Source Code

# File webrick_server.rb, line 50
def self.dispatch(options = {})
  Socket.do_not_reverse_lookup = true # patch for OS X

  params = { :Port        => options[:port].to_i,
             :ServerType  => options[:server_type],
             :BindAddress => options[:ip] }
  params[:MimeTypes] = options[:mime_types] if options[:mime_types]

  server = WEBrick::HTTPServer.new(params)
  server.mount('/', DispatchServlet, options)

  trap("INT") { server.shutdown }
  server.start
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.