Class: AutoResp::SessionViewer

Inherits:
Object
  • Object
show all
Defined in:
lib/ar/session_viewer.rb

Instance Method Summary collapse

Constructor Details

#initialize(proxy_server) ⇒ SessionViewer

Returns a new instance of SessionViewer.



8
9
10
# File 'lib/ar/session_viewer.rb', line 8

def initialize( proxy_server )
  @proxy_server = proxy_server
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/ar/session_viewer.rb', line 12

def run
  root = File.expand_path('./viewer', File.dirname(__FILE__))
  server = WEBrick::HTTPServer.new({
    :BindAddress  => '0.0.0.0',
    :Port         => 9090,
    :AccessLog    => [],
    :Logger       => WEBrick::Log.new("/dev/null"),
    :DocumentRoot => root
  })
  server.mount_proc '/sessions.har' do |req, res|
    res.body = HAR.sessions_to_har( @proxy_server.sessions )
  end
  server.start
end