At Sat, 20 Nov 2004 07:59:32 +0900 (JST),
GOTOU Yuuzou wrote:
>
> In message <32734.167.203.48.180.1100893533.squirrel@167.203.48.180>,
> `"Lloyd Zusman" <ljz@asfast.com>' wrote:
> >
> > [ ... ]
> >
> > What do I put between the 'if' and the 'else' in order to send the
> > matching requests to a FileHandler?
>
> Setup an instance of FileHandler by get_instance() and call
> service().
>
> [ ... ]
>
> require "webrick"
>
> IconDir = File.expand_path("~/public_html/icons")
> httpd = WEBrick::HTTPServer.new(:Port => 8080)
>
> httpd.mount_proc("/"){|req, res|
> if %r{^(/icons)(/[^/]+.png)$} =~ req.path
> req.script_name = $1
> req.path_info = $2
> klass = WEBrick::HTTPServlet::FileHandler
> fh = klass.get_instance(httpd, IconDir)
> fh.service(req, res)
> else
> res.body = 'No FileHandler -- just this simple message'
> res['Content-type'] = 'text/plain'
> end
> }
> Signal.trap(:INT){ httpd.shutdown }
> httpd.start
>
> hope this helps,
This indeed helps! It's exactly the information that I've been looking
for. Thank you very much.
--
Lloyd Zusman
ljz@asfast.com
God bless you.