Class: Waitress::Handler404
- Inherits:
-
ErrorHandler
- Object
- Handler
- ErrorHandler
- Waitress::Handler404
- Defined in:
- lib/waitress/handlers/handler404.rb
Overview
The 404 Handler is a simple “Catch-All” handler which will be triggered if a valid handler is not found for the page, and will show an error page telling the user the page cannot be found
Instance Attribute Summary
Attributes inherited from Handler
Instance Method Summary collapse
Methods inherited from ErrorHandler
Methods inherited from Handler
#initialize, #respond?, #serve!
Constructor Details
This class inherits a constructor from Waitress::ErrorHandler
Instance Method Details
#serve(request, response, client, vhost) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/waitress/handlers/handler404.rb', line 8 def serve request, response, client, vhost response.status 404 e404page = vhost.get_404 if !e404page.nil? && (Waitress::Chef.find_file(e404page)[:result]==:ok) Waitress::Chef.serve_file request, response, client, vhost, e404page else if vhost.resources? h = File.join Waitress::Chef.resources_http, "404.html" Waitress::Chef.serve_file request, response, client, vhost, h else response.mime ".html" response.body "<h1> 404 - Not Found </h1> <p> The page you have requested is not here </p>" end end end |