class WebApp::WEBrickServletHandler

Constants

LoadedServlets

Public Class Methods

get_instance(config, name) click to toggle source
# File webapp/webrick-servlet.rb, line 65
def WEBrickServletHandler.get_instance(config, name)
  unless LoadedServlets[name]
    LoadedServlets[name] = load_servlet(name)
  end
  LoadedServlets[name]
end
load_servlet(path) click to toggle source

load a WEBrick servlet written using webapp. ::load_servlet returns a WEBrick servlet generated by WEBrick::HTTPServlet::ProcHandler.

# File webapp/webrick-servlet.rb, line 75
def WEBrickServletHandler.load_servlet(path)
  begin
    Thread.current[:webrick_load_servlet] = true
    load path, true
    unless Thread.current[:webrick_load_servlet].respond_to? :call
      raise "WEBrick servlet is not registered: #{path}"
    end
    procedure = Thread.current[:webrick_load_servlet]
    return WEBrick::HTTPServlet::ProcHandler.new(procedure)
  ensure
    Thread.current[:webrick_load_servlet] = nil
  end
end