class 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
(HTTPServer server, String local_path) → void
Source
# File vendor/bundle/ruby/4.0.0/gems/webrick-1.9.2/lib/webrick/httpservlet/filehandler.rb, line 37 def initialize(server, local_path) super(server, local_path) @local_path = local_path end
Creates a DefaultFileHandler instance for the file at local_path.
Calls superclass method
WEBrick::HTTPServlet::AbstractServlet::new
Public Instance Methods
(HTTPRequest req, HTTPResponse res) → void
Source
# File vendor/bundle/ruby/4.0.0/gems/webrick-1.9.2/sig/httpservlet/filehandler.rbs, line 8
def do_GET: (HTTPRequest req, HTTPResponse res) -> void
# File vendor/bundle/ruby/4.0.0/gems/webrick-1.9.2/sig/httpservlet/filehandler.rbs, line 15
def make_partial_content: (HTTPRequest req, HTTPResponse res, String filename, Integer filesize) -> void
(File body, Array[[ Numeric, Numeric ]] parts, String boundary, String mtype, Integer filesize) → HTTPResponse::_CallableBody
Source
# File vendor/bundle/ruby/4.0.0/gems/webrick-1.9.2/sig/httpservlet/filehandler.rbs, line 13
def multipart_body: (File body, Array[[Numeric, Numeric]] parts, String boundary, String mtype, Integer filesize) -> HTTPResponse::_CallableBody
returns a lambda for webrick/httpresponse.rb send_body_proc