Class: BitClust::RequestHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/bitclust/requesthandler.rb

Overview

Actions of BitClust server.

Direct Known Subclasses

RackRequestHandler

Instance Method Summary collapse

Constructor Details

#initialize(db, manager) ⇒ RequestHandler

Returns a new instance of RequestHandler.


21
22
23
24
25
26
27
28
29
# File 'lib/bitclust/requesthandler.rb', line 21

def initialize(db, manager)
  if db.is_a? Array
    @db, @cdb = db
  else
    @db = db
  end
  @screenmanager = manager
  @conf = { :database => @db }
end

Instance Method Details

#handle(webrick_req) ⇒ Object


31
32
33
34
35
36
37
38
39
# File 'lib/bitclust/requesthandler.rb', line 31

def handle(webrick_req)
  _handle(Request.new(webrick_req))
rescue WEBrick::HTTPStatus::Status
  raise
rescue BitClust::NotFoundError => err
  return not_found_response(err)
rescue => err
  return error_response(err)
end