Class | Mongrel::Error404Handler |
In: |
lib/mongrel/handlers.rb
lib/mongrel/handlers.rb |
Parent: | HttpHandler |
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.
Sets the message to return. This is constructed once for the handler so it‘s pretty efficient.
# File lib/mongrel/handlers.rb, line 80 80: def initialize(msg) 81: @response = Const::ERROR_404_RESPONSE + msg 82: end
Sets the message to return. This is constructed once for the handler so it‘s pretty efficient.
# File lib/mongrel/handlers.rb, line 80 80: def initialize(msg) 81: @response = Const::ERROR_404_RESPONSE + msg 82: end
Just kicks back the standard 404 response with your special message.
# File lib/mongrel/handlers.rb, line 85 85: def process(request, response) 86: response.socket.write(@response) 87: end