Sha256: ab0a03555bccaf47d2523a7f74db5a412dba3048474805da32b0473df9729479

Contents?: true

Size: 1.45 KB

Versions: 4

Compression:

Stored size: 1.45 KB

Contents

require 'omf_common/lobject'

use ::Rack::ShowExceptions
#use ::Rack::Lint

OMF::Web::Runner.instance.life_cycle(:pre_rackup)
options = OMF::Web::Runner.instance.options

map "/resource" do
  require 'omf-web/rack/multi_file'
  run OMF::Web::Rack::MultiFile.new(options[:static_dirs])
end

map '/_ws' do
  begin
    require 'omf-web/rack/websocket_handler'
    run OMF::Web::Rack::WebsocketHandler.new #:backend => { :debug => true }
  rescue Exception => ex
    OMF::Common::Loggable.logger('web').error "#{ex}"
  end
end

map '/_update' do
  require 'omf-web/rack/update_handler'
  run OMF::Web::Rack::UpdateHandler.new
end

map '/_content' do
  require 'omf-web/rack/content_handler'
  run OMF::Web::Rack::ContentHandler.new
end

map "/tab" do
  require 'omf-web/rack/tab_mapper'
  run OMF::Web::Rack::TabMapper.new(options)
end

map "/widget" do
  require 'omf-web/rack/widget_mapper'
  run OMF::Web::Rack::WidgetMapper.new(options)
end


map "/" do
  handler = Proc.new do |env| 
    req = ::Rack::Request.new(env)
    case req.path_info
    when '/'
      [301, {'Location' => '/tab', "Content-Type" => ""}, ['Next window!']]
    when '/favicon.ico'
      [301, {'Location' => '/resource/image/favicon.ico', "Content-Type" => ""}, ['Next window!']]
    else
      OMF::Common::Loggable.logger('rack').warn "Can't handle request '#{req.path_info}'"
      [401, {"Content-Type" => ""}, "Sorry!"]
    end 
  end
  run handler
end

OMF::Web::Runner.instance.life_cycle(:post_rackup)



Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
omf_web-0.9.6 lib/omf-web/config.ru
omf_web-0.9.5 lib/omf-web/config.ru
omf_web-0.9.4 lib/omf-web/config.ru
omf_web-0.9.3 lib/omf-web/config.ru