I am stuck at the first task, input would be appreciated!!
Spec section 6.2.3 explains the Default Error Page, which is generated in MyFaces via the package private class javax.faces.webapp._ErrorPageWriter. The spec says, if we have an <error-page> definition in web.xml that points to a facelet page, this facelet page must be able to include the information produced by (in case of MyFaces) _ErrorPageWriter via <ui:include src="javax.faces.error.xhtml" />.
<ui:include> is handled by org.apache.myfaces.view.facelets.tag.ui.IncludeHandler, thus it is part of myfaces-impl and it cannot access _ErrorPageWriter.
So there a few ways to solve this problem:
1) Duplicate _ErrorPageWriter to myfaces-impl, which is just ugly
2) Move _ErrorPageWriter to myfaces-impl and make it public. This would also allow custom error handlers (org.apache.myfaces.ERROR_HANDLER) to fall back to the default behaviour (there was a request for that in the myfaces-user-list recently).
However, we would not be able to invoke the ErrorPageWriter in FacesServlet's service method any more. So we would have to invoke it either from LifecycleImpl or from ResourceHandlerImpl, if the current request is a resource request. Looking at the code in FacesServlet maybe makes things clearer:
ResourceHandler resourceHandler = facesContext.getApplication().getResourceHandler();
catch (Exception e)
This solution would also allow us to generate different error pages for resource requests, because currently we always a text/html error page, also if the request was for example image/jpg.
3) Invoke the _ErrorPageWriter in FacesServlet in either way, but if there is an <error-page> in web.xml, save the output in a request-scoped variable, which can be accessed by IncludeHandler, instead of writing it directly to the request writer.
Input would be highly appreciated!!!!!