Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 43545 invoked from network); 1 Jul 2007 20:01:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Jul 2007 20:01:47 -0000 Received: (qmail 76181 invoked by uid 500); 1 Jul 2007 20:01:35 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 76159 invoked by uid 500); 1 Jul 2007 20:01:35 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 76148 invoked by uid 99); 1 Jul 2007 20:01:35 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 01 Jul 2007 13:01:35 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=MSGID_FROM_MTA_HEADER,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of mgainty@hotmail.com designates 65.54.246.106 as permitted sender) Received: from [65.54.246.106] (HELO bay0-omc1-s34.bay0.hotmail.com) (65.54.246.106) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 01 Jul 2007 13:01:31 -0700 Received: from hotmail.com ([65.54.162.74]) by bay0-omc1-s34.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2668); Sun, 1 Jul 2007 13:01:10 -0700 Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Sun, 1 Jul 2007 13:01:10 -0700 Message-ID: Received: from 66.31.123.13 by BAY108-DAV2.phx.gbl with DAV; Sun, 01 Jul 2007 20:01:04 +0000 X-Originating-IP: [66.31.123.13] X-Originating-Email: [mgainty@hotmail.com] X-Sender: mgainty@hotmail.com Reply-To: "Martin Gainty" From: "Martin Gainty" To: "Tomcat Users List" References: <4687720A.1000501@iki.fi> Subject: Re: How to inject a webapp listener? Date: Sun, 1 Jul 2007 16:00:58 -0400 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.3138 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-OriginalArrivalTime: 01 Jul 2007 20:01:10.0492 (UTC) FILETIME=[91D119C0:01C7BC1A] X-Virus-Checked: Checked by ClamAV on apache.org I would suggest spring ..but springs injected entities are *usually* classical pojos such as DBDrivers Here is a project which shows great promise of injecting whole listeners which may be of help for your effort http://oranjestad.sourceforge.net/spring-oranjestad.html hyva? Martin- This email message and any files transmitted with it contain confidential information intended only for the person(s) to whom this email message is addressed. If you have received this email message in error, please notify the sender immediately by telephone or email and destroy the original message without making a copy. Thank you. ----- Original Message ----- From: "Juha Laiho" To: Sent: Sunday, July 01, 2007 5:21 AM Subject: How to inject a webapp listener? > Hello, > > I would like to have the Tomcat container to inject a specific > ServletContextListener to each loaded webapp on my server - without > touching the individual web.xml files, and am looking for advise on > how to achieve this. > > In other words, I'd like to have the container act as if there was > > MyListenerClass > > section in the web.xml file for each application? > > Currently, I have added a ContainerListener on my Host, which > is listening on ADD_CHILD messages to discover newly added > StandardContext instances, and performs the following on each > new StandardContext (where ctx is a reference to the added context): > > Object[] listeners = ctx.getApplicationLifecycleListeners(); > Object[] newListeners = new Object[listeners.length+1]; > System.arraycopy(listeners,0,newListeners,0,listeners.length); > newListeners[newListeners.length-1]=ctxListener; > ctx.setApplicationLifecycleListeners(newListeners); > > With this, my listener is already able to capture the contextDestroyed > events from the webapp - but not the contextInitialized. It looks like the > Context is added to the host only after it has been already initialized. > > What I'm looking for is a way to be able to inject the webapp listener > in an earlier phase, so that I can also capture the contextInitialized > messages. Any ideas? Also, if there's an overall better way to inject > the webapp listener, please let me know -- the above way feels rather > crude. > > Thanks, > -- > ..Juha > > --------------------------------------------------------------------- > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > For additional commands, e-mail: users-help@tomcat.apache.org > > --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org