开发者

Modify the HTML of a servlet's errorPage from a Filter

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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜