In WEBrick, redirecting to a FileHandler?

L

Lloyd Zusman

In WEBrick, I have a mount_proc that handles a range of URL's. For a
subset of these URL's, I want to pass them to a FileHandler, and for the
rest of them, I just want to output a message.

A simplified version of what I want to do looks like this:

my_mount_proc = lambda {
|req, res|
# First, do some stuff in all cases, no matter what req.path
# happens to be. But then ...
if req.path =~ /some-sort-of-special-pattern/ then
### send the request to a FileHandler
else
res.body = 'No FileHandler -- just this simple message'
res['Content-type'] = 'text/plain'
end
}

What do I do between the 'if' and the 'else' in order to send the
matching requests to a FileHandler?

Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,161
Messages
2,570,892
Members
47,430
Latest member
7dog123

Latest Threads

Top