Daniel V?lkerts wrote:

> Hi,
> 
> I went on playing on my syslog analyser and tried the webrick framework 
> wich I like a lot as it is simple but powerful. I defined a servlet 
> which should read a definition file and render its result.
> 
> My dir structur looks like
> 
> htdocs
>  - filter/
>      - filter1.fd
>      - filter2.fd
> 
> I mount my servlet to /filter and it should take any file argument in 
> the url after /filter as a filename to a filter definition file e.g. 
> http://localhost/filter/filter1.fd should render the output produced by 
> filter one.

And it doesn't?

> 
> I browsed the webrick source (httprequest.rb etc. but I can't find a var 
> for that. Is there a better way then extract the information from the 
> request_uri var?

I believe request.script_name gives the the text after the leading part 
of the URL.  But it looks to me that this should just work as it is.

You should not have to explicitly  extract the file name; WEBrick should 
just serve back the file, since filter/ maps to the directory where the 
filter files are.

For example, if I start a server, running from  /some/dir/, with this:

   port = 12000
   puts "URL: http://#{Socket.gethostname}:#{port}"
     s = HTTPServer.new(
       :Port            => port
   )
   s.mount("/", WEBrick::HTTPServlet::FileHandler, dir, true)


then if some/dir/  has a file foo.txt, I can load it with

http://localhost:12000/foo.txt

James


> 
> Other solutions are also welcome.
>