Class: WEBrick::HTTPServlet::DefaultFileHandler
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
AbstractServlet
|
|
Instance Chain:
self,
AbstractServlet
|
|
Inherits: |
WEBrick::HTTPServlet::AbstractServlet
|
Defined in: | lib/webrick/httpservlet/filehandler.rb |
Overview
Servlet for serving a single file. You probably want to use the FileHandler servlet instead as it handles directories and fancy indexes.
Example:
server.mount('/my_page.txt', WEBrick::HTTPServlet::DefaultFileHandler,
'/path/to/my_page.txt')
This servlet handles If-Modified-Since and Range requests.
Class Method Summary
-
.new(server, local_path) ⇒ DefaultFileHandler
constructor
Creates a
DefaultFileHandler
instance for the file atlocal_path
.
AbstractServlet - Inherited
.get_instance | Factory for servlet instances that will handle a request from |
.new | Initializes a new servlet for |
Instance Method Summary
AbstractServlet - Inherited
#do_GET | Raises a NotFound exception. |
#do_HEAD | Dispatches to do_GET. |
#do_OPTIONS | Returns the allowed HTTP request methods. |
#service | Dispatches to a |
#redirect_to_directory_uri | Redirects to a path ending in /. |
Constructor Details
.new(server, local_path) ⇒ DefaultFileHandler
Creates a DefaultFileHandler
instance for the file at local_path
.
# File 'lib/webrick/httpservlet/filehandler.rb', line 38
def initialize(server, local_path) super(server, local_path) @local_path = local_path end