Wade,

Browsers don't display the error page for missing GIF or JPEG elements in a
page, only when the entire requested URL gets a 404. If you have hyperlinks
to images, as opposed to HTML pages with images embedded, then what you are
looking for can be accomplished. You could create a JSP which does the
following to get the original URI:
                // If this is an error page, get the original URI
                String missingURI = (String) req.getAttribute(
                        "javax.servlet.forward.request_uri");
                if (missingURI == null) missingURI =req.getRequestURI();

Fritz

-----Original Message-----
From: Wade Billings [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 18, 2005 8:10 AM
To: tomcat-user@jakarta.apache.org
Subject: ***SPAM*** 404 redirection question

I have the need to redirect visitors to my site to different error pages
depending on the type of element missing. For example, if the element
that is missing is an image file (e.g. *.jpg, *.gif), then I want to
present them with a custom 404 error page. If the missing element is an
entire page, then I want to present them with a completely different 404
error page.
 
I know that I can set Tomcat to catch the 404 errors and present a
custom page, but what I need to know is can I get as granular as I need
to get using the configuration, or do I have to put this in an jsp file
and solve it programmatically?
 
Thanks,
 
Q. Wade Billings
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to