Maintenance of Ruby 2.0.0 ended on February 24, 2016. Read more

In Files

  • webrick/httpservlet/filehandler.rb


Servlet for serving a single file. You probably want to use the FileHandler servlet instead as it handles directories and fancy indexes.


server.mount('/my_page.txt', WEBrick::HTTPServlet::DefaultFileHandler,

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 37
def initialize(server, local_path)
  super(server, local_path)
  @local_path = local_path

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit