Serves a directory including fancy indexing and a variety of other options.
Example:
server.mount('/assets', WEBrick::HTTPServlet::FileHandler, '/path/to/assets')
Constants
No documentation available
Class Methods
lib/webrick/httpservlet/filehandler.rb
View on GitHub
# File tmp/rubies/ruby-2.6.10/lib/webrick/httpservlet/filehandler.rb, line 182
def self.add_handler(suffix, handler)
HandlerTable[suffix] = handler
end
Allow custom handling of requests for files with suffix
by class handler
lib/webrick/httpservlet/filehandler.rb
View on GitHub
# File tmp/rubies/ruby-2.6.10/lib/webrick/httpservlet/filehandler.rb, line 203
def initialize(server, root, options={}, default=Config::FileHandler)
@config = server.config
@logger = @config[:Logger]
@root = File.expand_path(root)
if options == true || options == false
options = { :FancyIndexing => options }
end
@options = default.dup.update(options)
end
Creates a FileHandler
servlet on server
that serves files starting at directory root
options
may be a Hash
containing keys from WEBrick::Config::FileHandler or true
or false
.
If options
is true or false then :FancyIndexing
is enabled or disabled respectively.
lib/webrick/httpservlet/filehandler.rb
View on GitHub
# File tmp/rubies/ruby-2.6.10/lib/webrick/httpservlet/filehandler.rb, line 189
def self.remove_handler(suffix)
HandlerTable.delete(suffix)
end
Remove custom handling of requests for files with suffix