Search in sources :

Example 1 with FacesApplicationArtifactHolder

use of org.apache.myfaces.cdi.FacesApplicationArtifactHolder in project myfaces by apache.

the class AbstractContextualStorageHolder method init.

@PostConstruct
public void init() {
    storageMap = new ConcurrentHashMap<>();
    FacesContext facesContext = FacesContext.getCurrentInstance();
    Object context = facesContext.getExternalContext().getContext();
    if (context instanceof ServletContext) {
        FacesApplicationArtifactHolder appBean = CDIUtils.get(beanManager, FacesApplicationArtifactHolder.class);
        if (appBean.getServletContext() != null) {
            appBean.setServletContext((ServletContext) context);
        }
    }
}
Also used : FacesContext(jakarta.faces.context.FacesContext) ServletContext(jakarta.servlet.ServletContext) FacesApplicationArtifactHolder(org.apache.myfaces.cdi.FacesApplicationArtifactHolder) PostConstruct(jakarta.annotation.PostConstruct)

Aggregations

PostConstruct (jakarta.annotation.PostConstruct)1 FacesContext (jakarta.faces.context.FacesContext)1 ServletContext (jakarta.servlet.ServletContext)1 FacesApplicationArtifactHolder (org.apache.myfaces.cdi.FacesApplicationArtifactHolder)1