Alright, so you got 404'd! Things aren't that bad because you handled it nicely, but the real question you have on the tip of your tongue is "What URL caused this 404?"
The request could receive the following attributes that can indicate what caused the error
Where did it come from?
To get the original URL of the request that is in trouble, look at javax.servlet.error.request_uri request attribute.
String uri = (String) request.getAttribute("javax.servlet.error.request_uri");
What caused it?
To cause of the error can be a HTTP error or an exception that was not handled by the web application and propagated all the way up. The three attributes that will give you more insight are:
An Integer telling the error status code, if any
A Class instance indicating the type of exception that caused the error, if any
A String telling the exception message, passed to the exception constructor
A Throwable object that is the actual exception thrown