Class: Mongrel::StatusHandler

### Home Classes Methods

### In Files

- lib/mongrel/handlers.rb

### Parent

Mongrel::HttpHandler

### Methods

- ::new
- #describe_listener
- #process
- #table

### Files

- CHANGELOG
- COPYING
- LICENSE
- README
- Makefile

### Class/Module Index

Quicksearch

- Mongrel
- Mongrel::CGIWrapper
- Mongrel::Camping
- Mongrel::Camping::CampingHandler
- Mongrel::Command
- Mongrel::Command::Base
- Mongrel::Command::Registry
- Mongrel::Configurator
- Mongrel::Const
- Mongrel::DeflateFilter
- Mongrel::DirHandler
- Mongrel::Error404Handler
- Mongrel::Gems
- Mongrel::HeaderOut
- Mongrel::HttpHandler
- Mongrel::HttpHandlerPlugin
- Mongrel::HttpParams
- Mongrel::HttpParser
- Mongrel::HttpParserError
- Mongrel::HttpRequest
- Mongrel::HttpResponse
- Mongrel::HttpServer
- Mongrel::Rails
- Mongrel::Rails::RailsConfigurator
- Mongrel::Rails::RailsHandler
- Mongrel::RedirectHandler
- Mongrel::StatisticsFilter
- Mongrel::Stats
- Mongrel::StatusHandler
- Mongrel::StopServer
- Mongrel::TimeoutError
- Mongrel::URIClassifier
- Mongrel::URIClassifier::RegistrationError
- Mongrel::URIClassifier::UsageError
- RequestLog
- RequestLog::Access
- RequestLog::Files
- RequestLog::Objects
- RequestLog::Params
- RequestLog::Threads
- IO
- Kernel
- MongrelDbg
- TCPServer

No matching classes.

# Mongrel::StatusHandler

The :stats_filter is basically any configured stats filter that you've added to this same URI. This lets the status handler print out statistics on how Mongrel is doing.

### Public Class Methods

new(ops={}) click to toggle source

    # File lib/mongrel/handlers.rb, line 371
    def initialize(ops={})
      @stats = ops[:stats_filter]
    end

### Public Instance Methods

describe_listener() click to toggle source

    # File lib/mongrel/handlers.rb, line 385
    def describe_listener
      results = ""
      results << "<h1>Listener #{listener.host}:#{listener.port}</h1>"
      results << table("settings", [
                       ["host",listener.host],
                       ["port",listener.port],
                       ["throttle",listener.throttle],
                       ["timeout",listener.timeout],
                       ["workers max",listener.num_processors],
      ])

      if @stats
        results << "<h2>Statistics</h2><p>N means the number of samples, pay attention to MEAN, SD, MIN and MAX."
        results << "<pre>#{@stats.dump}</pre>"
      end

      results << "<h2>Registered Handlers</h2>"
      handler_map = listener.classifier.handler_map
      results << table("handlers", handler_map.map {|uri,handlers|
        [uri,
            "<pre>" +
            handlers.map {|h| h.class.to_s }.join("\n") +
            "</pre>"
        ]
      })

      results
    end

process(request, response) click to toggle source

    # File lib/mongrel/handlers.rb, line 414
    def process(request, response)
      response.start do |head,out|
        out.write         <html><body><title>Mongrel Server Status</title>        #{describe_listener}        </body></html>
      end
    end

table(title, rows) click to toggle source

    # File lib/mongrel/handlers.rb, line 375
    def table(title, rows)
      results = "<table border=\"1\"><tr><th colspan=\"#{rows[0].length}\">#{title}</th></tr>"
      rows.each do |cols|
        results << "<tr>"
        cols.each {|col| results << "<td>#{col}</td>" }
        results << "</tr>"
      end
      results + "</table>"
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.