Class: Mongrel::Error404Handler

### Home Classes Methods

### In Files

- lib/mongrel/handlers.rb

### Parent

Mongrel::HttpHandler

### Methods

- ::new
- #process

### 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::Error404Handler

The server normally returns a 404 response if an unknown URI is requested, but it also returns a lame empty message. This lets you do a 404 response with a custom message for special URIs.

### Public Class Methods

new(msg) click to toggle source

Sets the message to return. This is constructed once for the handler so it's pretty efficient.

    # File lib/mongrel/handlers.rb, line 80
    def initialize(msg)
      @response = Const::ERROR_404_RESPONSE + msg
    end

### Public Instance Methods

process(request, response) click to toggle source

Just kicks back the standard 404 response with your special message.

    # File lib/mongrel/handlers.rb, line 85
    def process(request, response)
      response.socket.write(@response)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.