Support for the Ruby 2.4 series has ended. See here for reference.

In Files

  • webrick/httpservlet/filehandler.rb

WEBrick::HTTPServlet::DefaultFileHandler

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.

Public Class Methods

new(server, local_path) click to toggle source

Creates a DefaultFileHandler instance for the file at local_path.

 
               # File webrick/httpservlet/filehandler.rb, line 38
def initialize(server, local_path)
  super(server, local_path)
  @local_path = local_path
end