class WAB::Impl::WEBrick::ExportProxy

A handler that provides missing files in an assets directory where the files are the wab and wab UI files.

Public Class Methods

new(server, path) click to toggle source
Calls superclass method
# File lib/wab/impl/webrick/export_proxy.rb, line 12
def initialize(server, path)
  super
end

Public Instance Methods

do_GET(req, res) click to toggle source
Calls superclass method
# File lib/wab/impl/webrick/export_proxy.rb, line 16
def do_GET(req, res)
  super
rescue Exception => e
  path = req.path
  path = '/index.html' if '/' == path
  begin
    mime = nil
    index = path.rindex('.')
    unless index.nil?
      mime = WEBrick::HTTPUtils::DefaultMimeTypes[path[index + 1..-1]]
    end
    mime = 'text/plain' if mime.nil?
    content = WAB.get_export(path)
    res.status = 200
    res['Content-Type'] = mime
    res.body = content
  rescue Exception
    # raise the original error for a normal not found error
    raise e
  end
end