Richard, You could use HttpServletRequest.getPathInfo() to read the extra path information after servlet name, read the corresponding object from disk, set an appropriate MIME type, and then send the object back in the response.
But it's a lot of new code for something that doesn't seem like a good thing to do. Why not just, - use a standard webapp structure, - map the servlet to '/someservlet' as you describe, - make an images subdirectory, and - link to the images using <img src="images/foo.gif"> from within your servlet? Then, Tomcat does all the work for you. Use the ROOT webapp if you don't want the name of the webapp in the URL. If you want all requests to run through the servlet for security reasons, or something, then you should possibly consider using a Servlet 2.3 Filter instead - this is exactly what they're designed for. Dan. > -----Original Message----- > From: Richard Wallace [mailto:[EMAIL PROTECTED]] > Sent: 30 January 2003 00:17 > To: [EMAIL PROTECTED] > Subject: web.xml servlet and resources > > > Hello all, > > This is a fairly simple problem but I haven't been able to find an > answer anywhere (I've been looking for the past day or two). I'm hoping > this is a common situation and is possible, but from what I've seen I > can't see how. > > What I want is for the resources (images, css files, etc.) to be in a > path relative to the servlet. So, if I have an images directory and the > servlet URL is http://www.domain.com/some-servlet, the images should be > accessible from this URL, http://www.domain.com/some-servlet/images. > So, I want to set the URL pattern for some-servlet to be /. If I do > that then every URL beginning with that will be grabbed by the servlet, > including http://www.domain.com/some-servlet/images/logo.gif (as an > example). > > Suggestions? Thanks. > -- > Richard Wallace > AIM, Inc. (www.a--i--m.com) > Information Systems Consultants > > "Providing New Technology, > the Old-Fashioned Way" > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
