I have a requirement to rewrite HTML generated by a web application. The requirement applies to all pages equally so naturally we went for a Filter.
I cribbed the stream wrapping approach from this Oracle documentation on filters and this works for most cases. Unfortunately, if the servlet throws an exception the flow of execution leaves my filter and the rewriting logic is not executed. This means the HTML of error p开发者_JS百科ages is not modified.
I want to intercept the error page response as well. How do I do that?
Try adding this to your filter-mapping
:
<dispatcher>FORWARD</dispatcher>
<dispatcher>ERROR</dispatcher>
精彩评论