404 error page

Posted: 3 September 2012 in Uncategorized

I was playing about with the error page configuration of my web app. I configured the app to intercept page not found errors and display a nice page instead of the default response from Tomcat.


I was bemused when it wouldn’t intercept the error.
It turns out that setting the status code to 404 on the response is not the same as sending a 404 error.

response.setStatus(404); /* does not get intercepted */
response.sendError(404); /* gets intercepted */

another little mistery explained. 😀


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s