blob: 373482eeb0cb5a641f4b7507c9ab0006aaebf168 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#--
# Ruwiki
# Copyright © 2002 - 2004, Digikata and HaloStatue
# Alan Chen (alan@digikata.com)
# Austin Ziegler (ruwiki@halostatue.ca)
#
# Licensed under the same terms as Ruby.
#
# $Id$
#++
require 'webrick'
class Ruwiki::Servlet < WEBrick::HTTPServlet::AbstractServlet
class << self
attr_accessor :config
end
def initialize(config)
@config = config
end
# Converts a POST into a GET.
def do_POST(req, res)
do_GET(req, res)
end
def do_GET(req, res)
# Generate the reponse handlers for Ruwiki from the request and response
# objects provided.
wiki = Ruwiki.new(Ruwiki::Handler.from_webrick(req, res))
# Configuration defaults to certain values. This overrides the defaults.
wiki.config = Ruwiki::Servlet.config unless Ruwiki::Servlet.config.nil?
wiki.config!
wiki.config.logger = @config.logger
wiki.run
end
end
|