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

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: https://issues.apache.org/jira/browse/MYFACES-2730
>             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.

Reply via email to