From: GOTOU Yuuzou Date: 2005-01-13T05:40:40+09:00 Subject: Re: Webrick, erb, and .rhtml In message , `Belorion ' wrote: > That's tough luck for me then. I have a significantly large rhtml > project that uses lots of puts and print because that works fine in > Apache/eRuby/mod_ruby. Guess I have a lot of busy work ahead of me, > changing all my puts/prints to <%= "" %> if I want to support Webrick > serving. Thanks for the help! You can make a custom handler class using eruby command. -- require "webrick" class ERubyHandler < WEBrick::HTTPServlet::ERBHandler ERuby = "/usr/local/bin/eruby" def initialize(server, name) super @script_filename = name end def do_GET(req, res) IO.popen("#{ERuby} #{@script_filename}"){|io| res.body = io.read } res["content-type"] = "text/html" end end # register new handler class WEBrick::HTTPServlet::FileHandler.add_handler("rhtml", ERubyHandler) s = WEBrick::HTTPServer.new(:Port=> 2000) s.mount("/~test", WEBrick::HTTPServlet::FileHandler, Dir.pwd) trap("INT"){ s.shutdown } s.start -- > One last question... using ERBHanlde instead of FileHanlder, this > works fine (brining up index.html): > > localhost:2000/~test/ > > However, if I use: > > locahost:2000/~test/index.html > > I get a permission denied error. Why? They are both accessing the same files... What arguments did you pass to mount method? ERBHandler cannot process directories. It is designed to be used by FileHandler. However, it can be mounted on the server with a eruby script filename like: s.mount("/~test", ERBHandler, "/somewhere/index.html") -- gotoyuzo