myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jakob Korherr (JIRA)" <>
Subject [jira] Commented: (MYFACES-2730) FacesContext not available on application startup
Date Fri, 21 May 2010 15:22:16 GMT


Jakob Korherr commented on MYFACES-2730:

I recently also ran into this problem while implementing the DebugPhaseListener, however I
was able to do a workaround in this special case.

I think we really should provide as much functionality as possible on application startup
(and shutdown). This means FacesContext, ExternalContext,.. Currently the ExternalContext
is available on some config methods, but this is not steady in the whole configuration process.

See AbstractFacesInitializer.initFaces() for an example:

// Some parts of the following configuration tasks have been implemented 
// by using an ExternalContext. However, that's no problem as long as no 
// one tries to call methods depending on either the ServletRequest or 
// the ServletResponse.
ExternalContext externalContext = new ServletExternalContextImpl(servletContext, null, null);

Introducing an InitFacesContext and an InitExternalContext seems to me to be the best solution
for this problem.

> FacesContext not available on application startup
> -------------------------------------------------
>                 Key: MYFACES-2730
>                 URL:
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0
>            Reporter: Nick Belaevski
> If custom ResourceHandler calls FacesContext.getCurrentInstance() in constructor to read
init parameters, null value is returned. This affects latest MyFaces 2.0.0-SNAPSHOT. Mojarra
2.0 provides InitFacesContext in this case.

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

View raw message