Class: WikiServlet

Inherits:
HTTPServlet::AbstractServlet
  • Object
show all
Defined in:
lib/Wiki2Go/WebrickServlet.rb

Instance Method Summary collapse

Constructor Details

#initialize(server, config) ⇒ WikiServlet

Returns a new instance of WikiServlet.


18
19
20
21
22
23
24
# File 'lib/Wiki2Go/WebrickServlet.rb', line 18

def initialize(server,config)
  super(server)
  @server = server
  @config = config
  @file_servlet = WEBrick::HTTPServlet::FileHandler.new(@server,@config.site_directory)
  @servlet = Wiki2Go::Servlet.new(config)
end

Instance Method Details

#do_GET(req, res) ⇒ Object


26
27
28
29
30
31
32
# File 'lib/Wiki2Go/WebrickServlet.rb', line 26

def do_GET(req, res)
  request = Web2Go::WebrickRequest.new(req)
  response = Web2Go::WebrickResponse.new(res)
  if !@servlet.execute(request,response) then
    @file_servlet.do_GET(req,res)
  end
end

#do_POST(req, res) ⇒ Object


34
35
36
37
38
39
40
# File 'lib/Wiki2Go/WebrickServlet.rb', line 34

def do_POST(req, res)
  request = Web2Go::WebrickRequest.new(req)
  response = Web2Go::WebrickResponse.new(res)
  if !@servlet.execute(request,response) then
    @file_servlet.do_GET(req,res)
  end
end