Class: Mongrel::Error404Handler
- Inherits:
-
HttpHandler
- Object
- HttpHandler
- Mongrel::Error404Handler
- Defined in:
- lib/mongrel/handlers.rb
Overview
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.
Instance Method Summary collapse
-
#initialize(msg) ⇒ Error404Handler
constructor
Sets the message to return.
-
#process(request, response) ⇒ Object
Just kicks back the standard 404 response with your special message.
Constructor Details
#initialize(msg) ⇒ Error404Handler
Sets the message to return. This is constructed once for the handler so it’s pretty efficient.
21 22 23 |
# File 'lib/mongrel/handlers.rb', line 21 def initialize(msg) @response = Const::ERROR_404_RESPONSE + msg end |
Instance Method Details
#process(request, response) ⇒ Object
Just kicks back the standard 404 response with your special message.
26 27 28 |
# File 'lib/mongrel/handlers.rb', line 26 def process(request, response) response.socket.write(@response) end |