myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jakob Korherr (JIRA)" <...@myfaces.apache.org>
Subject [jira] Commented: (MYFACES-2454) facelet error-pages should be supported
Date Sat, 12 Dec 2009 13:33:18 GMT

    [ https://issues.apache.org/jira/browse/MYFACES-2454?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12789737#action_12789737
] 

Jakob Korherr commented on MYFACES-2454:
----------------------------------------

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:

...
        try
        {
           
            ResourceHandler resourceHandler = facesContext.getApplication().getResourceHandler();

            if (resourceHandler.isResourceRequest(facesContext))
            {
                resourceHandler.handleResourceRequest(facesContext);
            }
            else
            {
                _handleStandardRequest(facesContext);
            }
        }
        catch (Exception e)
        {
            handleLifecycleException(facesContext, 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!!!!!

> facelet error-pages should be supported
> ---------------------------------------
>
>                 Key: MYFACES-2454
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2454
>             Project: MyFaces Core
>          Issue Type: Task
>          Components: JSR-314
>    Affects Versions: 2.0.0-alpha-2
>            Reporter: Jakob Korherr
>
> see spec section »6.2.3 Default Error Page« for details.
> This includes the following tasks:
> - <ui:include src="javax.faces.error.xhtml" /> should include the standard error
page (created by _ErrorPageWriter in MyFaces) in any facelet error page defined in web.xml
> - <error-page> entries in web.xml should take priority over MyFaces' default error
page (currently you have to disable it via org.apache.myfaces.ERROR_HANDLING first)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message