Ok, here's what I want to do:

a) create lots and lots of 'false' directories for users (ie /bill /fred
/jim) and use one servlet to serve them all
b) have some 'real' directories in there
c) serve files normally from the root directory

I have one servlet mapped to / that checks the URL being requested. If the
URL contains a . (eg /default.htm) it uses request dispatcher to palm off
the request to the com.livesoftware.servlets.file.FileServlet servlet. (see
code below)

ServletConfig config = getServletConfig();
ServletContext application = config.getServletContext();

if (req.getRequestURI().substring(1).indexOf("/") < 0) {
        RequestDispatcher rd =
application.getRequestDispatcher("/servlet/com.livesoftware.servlets.file.Fi
leServlet");
        rd.forward(req, res);
}

Herein lies my problem - it doesn't serve files properly. I can create the
false and real directories beautifully, but when I try to serve files, the
FileServlet can't find it. After research, this is because the path it's
looking for is gone. (ie the dispatched request that FileServlet receives
has a URI of /servlet/com.livesoftware.servlets.file.FileServlet) and the
/default.htm is lost - so FileServlet throws an error.

Is the source available for FileServlet? If it was I could pass it a custom
variable for the file I wanted.

Otherwise, what are my options? (Besides writing my own FileServlet?) Can I
perform some tricky mapping or coding to get this working? Am I nuts? ;)

Opinions, flames and comments gratefully appreciated,

Cheers,
Mike

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to