| Author |
Custom Error Page Filter
|
Michael J. Makunas
Ranch Hand
Joined: Mar 11, 2002
Posts: 37
|
|
Hi all- I'm trying to write a servlet filter that displays custom error pages. (Yes, I do know the standard way of specifying error pages in web.xml but the template of the error page needs to vary and I'd rather not put that logic in a jsp.) I'm doing all the normal wrapping of the response, etc. in order to be able to modify the response, but no matter what I do it just seams to ignore anything written to the output stream. I seem to remember someone telling me once that you cannot modify the response when the status is an error. Is this the case or am I doing something else wrong? [ August 14, 2008: Message edited by: Michael J. Makunas ]
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56210
|
|
|
I still don't get the filter. Why not just declare a controller servlet as the error handler in the deployment descriptor and handle any decision making there?
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Michael J. Makunas
Ranch Hand
Joined: Mar 11, 2002
Posts: 37
|
|
Originally posted by Bear Bibeault: I still don't get the filter. Why not just declare a controller servlet as the error handler in the deployment descriptor and handle any decision making there?
Good point. I thought of something like that after I just posted this. But my concern is that I need/want: 1. To know what the originally requested URL was. 2. To know what the original status code was. 3. To minimize what I have to add to web.xml. In other words can I do something like:
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56210
|
|
|
Except for the wild-carding. I usually handle the most common 500, 404, and 403 error codes.
|
 |
 |
|
|
subject: Custom Error Page Filter
|
|
|