Chris,
The application is an image gallery. I want to be able to drop images into
directories anywhere underneath the "gallery" webapp directory and have the
images automatically displayed as thumbnails in a table. Users can click on a
thumbnail for the full-size image. I have an index.jsp file that creates
thumbnails for all the images in a directory and then generates the html to
display them. Since I don't want to have to drop an index.jsp file into every
image directory, I set up a forwarding filter that forwards any request for a
directory to "/index.jsp" (the filter ignores other request urls). To get the
real path of the directory that corresponds to the requested url, I use:
String servletPath = (String)
request.getAttribute("javax.servlet.forward.servlet_path");
String realPath = application.getRealPath(servletPath);
> You still have to add the request's URI to the end of that.
I don't seem to. For example, a request for:
http://www.nomad.org/gallery/test yields a servlet path of "/test/" and a real
path of:
C:\Documents and Settings\Peter\My
Documents\dev\webapps\www.nomad.org\gallery\pg
which is just what I need. Now with the real path, I can process the target
image directory by making thumbnails if necessary and laying out the html
thumbnail table.
It's up and working at http://www.nomad.org/gallery.
Peter
---------------------------------
Cheap Talk? Check out Yahoo! Messenger's low PC-to-Phone call rates.