module Nukumi2 class Bricklet < WEBrick::HTTPServlet::AbstractServlet def initialize(blog) @blog = blog end def get_instance(config) self end def do_GET(req, res) begin time = Time.now page = @blog.fetch(req.path) res.body = page.render res['Content-Type'] = page.content_type # res.body << "Took #{Time.now-time}s" rescue Nukumi2::Blog::NotFound raise WEBrick::HTTPStatus::NotFound, $!.message || "Page not found." end end end end