Return-Path: Delivered-To: apmail-myfaces-dev-archive@www.apache.org Received: (qmail 52682 invoked from network); 14 Jan 2011 20:30:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 14 Jan 2011 20:30:07 -0000 Received: (qmail 74802 invoked by uid 500); 14 Jan 2011 20:30:07 -0000 Delivered-To: apmail-myfaces-dev-archive@myfaces.apache.org Received: (qmail 74748 invoked by uid 500); 14 Jan 2011 20:30:06 -0000 Mailing-List: contact dev-help@myfaces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "MyFaces Development" Delivered-To: mailing list dev@myfaces.apache.org Received: (qmail 74741 invoked by uid 99); 14 Jan 2011 20:30:06 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Jan 2011 20:30:06 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Jan 2011 20:30:06 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id p0EKTjEZ020225 for ; Fri, 14 Jan 2011 20:29:45 GMT Message-ID: <11688440.375491295036985833.JavaMail.jira@thor> Date: Fri, 14 Jan 2011 15:29:45 -0500 (EST) From: "Gerhard Petracek (JIRA)" To: dev@myfaces.apache.org Subject: [jira] Resolved: (EXTCDI-120) StartupEventBroadcaster In-Reply-To: <11240603.375271295036265657.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/EXTCDI-120?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Gerhard Petracek resolved EXTCDI-120. ------------------------------------- Resolution: Fixed Fix Version/s: 0.9.3 > StartupEventBroadcaster > ----------------------- > > Key: EXTCDI-120 > URL: https://issues.apache.org/jira/browse/EXTCDI-120 > Project: MyFaces CODI > Issue Type: New Feature > Components: Core > Reporter: Gerhard Petracek > Fix For: 0.9.3 > > > before codi configures anything it should be possible to process initialization tasks. > public interface StartupEventBroadcaster > { > void broadcastStartup(); > } > example for an use-case: > it can be used for an improved app-server support in combination with mojarra > the basic problem is the early config approach of mojarra. > if mojarra gets invoked before the bootstrapping process of a cdi container, it starts to configure everything immediately and codi gets invoked (outside a cdi context). > in such a case it's possible to use a custom ServletContextListener for bootsrapping the container. > in case of owb it's possible to extend WebBeansConfigurationListener > example: > public class MojarraAwareWebBeansConfigurationListener extends WebBeansConfigurationListener implements StartupEventBroadcaster > { > private static Boolean initialized = false; > private static ContainerLifecycle storedContainerLifecycle; > public void contextInitialized(ServletContextEvent event) > { > if (!initialized) > { > //in this case CDI is bootstrapped already > super.contextInitialized(event); > initialized = true; > storedContainerLifecycle = this.lifeCycle; > } > } > public void broadcastStartup() > { > if (initialized) > { > return; > } > //in this case Mojarra was invoked too soon > FacesContext facesContext = FacesContext.getCurrentInstance(); > if (facesContext != null && facesContext.getExternalContext() != null) > { > //force bootstrapping of OWB > contextInitialized(new ServletContextEvent((ServletContext) facesContext.getExternalContext().getContext())); > initialized = true; > } > } > public void requestInitialized(ServletRequestEvent event) > { > if (this.lifeCycle == null) > { > //here we have a different instance > this.lifeCycle = storedContainerLifecycle; > } > super.requestInitialized(event); > } > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.