Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error Pages and sendError in filters

 
Peter Kovac
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 90
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic