Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Servlets and the fly likes Error Pages and sendError in filters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Error Pages and sendError in filters" Watch "Error Pages and sendError in filters" New topic
Author

Error Pages and sendError in filters

Peter Kovac
Ranch Hand

Joined: Aug 08, 2010
Posts: 42
Hi,
I have the following question:

The Java Servlet Specification v3.0 pg104 says:
The error page mechanism described does not intervene when errors occur when invoked using the RequestDispatcher or filter.doFilter method. In this way, a filter or servlet using the RequestDispatcher has the opportunity to handle errors generated.

What does this mean?
If I have a web.xml with customized <error-page> section and I use sendError from a doFilter method, will the custom or the default error page be shown?

On the other hand how is it possible to skip the customized <error-page> and return for example 404? Use setStatus?

Thanks,
Dhaval J. Patel
Ranch Hand

Joined: Mar 10, 2011
Posts: 90

The best thing to do would be try it yourself. Would give you a better insight by playing around with different possibilities instead of reading an answer that someone wrote.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error Pages and sendError in filters