Class: WEBrick::HTTPServlet::FileHandler
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
Serves a directory including fancy indexing and a variety of other options.
Example:
server.mount('/assets', WEBrick::HTTPServlet::FileHandler,
'/path/to/assets')
Class Method Summary
-
.add_handler(suffix, handler)
Allow custom handling of requests for files with
suffix
by classhandler
-
.new(server, root, options = {}, default = Config::FileHandler) ⇒ FileHandler
constructor
Creates a
FileHandler
servlet onserver
that serves files starting at directory :: -
.remove_handler(suffix)
Remove custom handling of requests for files with
suffix
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, root, options = {}, default = Config::FileHandler) ⇒ FileHandler
Creates a FileHandler
servlet on server
that serves files starting at directory ::
options
may be a Hash containing keys from Config::FileHandler or true
or false
.
If options
is true or false then :FancyIndexing
is enabled or disabled respectively.
Class Method Details
.add_handler(suffix, handler)
Allow custom handling of requests for files with suffix
by class handler
# File 'lib/webrick/httpservlet/filehandler.rb', line 183
def self.add_handler(suffix, handler) HandlerTable[suffix] = handler end
.remove_handler(suffix)
Remove custom handling of requests for files with suffix
# File 'lib/webrick/httpservlet/filehandler.rb', line 190
def self.remove_handler(suffix) HandlerTable.delete(suffix) end