You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Korhonen, Kalle" <kk...@cisco.com> on 2005/11/01 21:03:19 UTC

error-page problem with Myfaces extensionsfilter and tiles

Hi all,

I have a problem with getting custom error-page definitions in web.xml
to properly work with MyFaces. I use path mapping for the faces servlet
and I have error-page for 404 defined. If I request URL "/blablaa.html"
that doesn't exist either as a tile definition or as a physical page,
the page is successfully forwarded to my custom error page
/faces/errors/404.html. However, if I request a page
"/faces/blablaa.html" that doesn't exist, I get a
java.lang.IllegalStateException "getOutputStream() has already been
called for this response" and in the end, the default Tomcat 404 page is
displayed. 

The problem is caused by the extensionsfilter that writes header
information to the (empty) response, but afterwards the container tries
to forward it to the defined error page. There are several approaches to
fix the problem, but one of the easiest that comes to my mind is that
the extensionfilter would only handle responses that are OK (though how
to find out?). The limitation is that extensionsfilter's functionality
couldn't be used on a custom error page but it might be understandable.
Since the container handles the response after the filter chain, I think
we'd otherwise need to deal with the custom error-pages ourselves. Can
you see any major problems if extensionsfilter would skip handling the
response for error responses or do you have any other good ideas on how
to solve this?

Kalle