Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 19472 invoked from network); 5 Nov 2007 10:19:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Nov 2007 10:19:28 -0000 Received: (qmail 26041 invoked by uid 500); 5 Nov 2007 10:19:02 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 26017 invoked by uid 500); 5 Nov 2007 10:19:02 -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 26006 invoked by uid 99); 5 Nov 2007 10:19:02 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Nov 2007 02:19:02 -0800 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [196.25.240.79] (HELO ctb-mesg-1-1.saix.net) (196.25.240.79) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Nov 2007 10:19:29 +0000 Received: from animal (dsl-243-86-88.telkomadsl.co.za [41.243.86.88]) by ctb-mesg-1-1.saix.net (Postfix) with SMTP id 8EFA118CF3 for ; Mon, 5 Nov 2007 12:18:38 +0200 (SAST) Message-ID: <008001c81f95$3b6ac3e0$0300000a@animal> From: "Johnny Kewl" To: "Tomcat Users List" References: <961039.69551.qm@web57413.mail.re1.yahoo.com> Subject: Re: running! a servlet at tomcat startup Date: Mon, 5 Nov 2007 12:18:38 +0200 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Antivirus: avast! (VPS 000780-1, 2007/10/10), Outbound message X-Antivirus-Status: Clean X-Virus-Checked: Checked by ClamAV on apache.org --------------------------------------------------------------------------- HARBOR: http://coolharbor.100free.com/index.htm Now Tomcat is also a cool pojo application server --------------------------------------------------------------------------- ----- Original Message ----- From: "loredana loredana" To: "Tomcat Users List" Sent: Monday, November 05, 2007 11:48 AM Subject: Re: running! a servlet at tomcat startup thanks for the response johnny. That's probably the only way it can be done.. Unfortunatelly for me, I need variables like request.getContextPath() and from init() method i can't "retrieve" those values. 10x a lot anyway. =================================== Ah, I see now... Yes parsing context.xml is too much hassle.. Heres an idea... When someone drops a WAR in, the context always takes on the webapp name. ie for most apps... webapp name = context So try this... ServletContext context = getServletContext(); String sWebBase = context.getRealPath("/"); Than last folder is the context name... Some String parsing and you got it ;) Good luck =================================== ----- Original Message ---- From: Johnny Kewl To: Tomcat Users List Sent: Monday, November 5, 2007 10:58:54 AM Subject: Re: running! a servlet at tomcat startup --------------------------------------------------------------------------- HARBOR: http://coolharbor.100free.com/index.htm Now Tomcat is also a cool pojo application server --------------------------------------------------------------------------- ----- Original Message ----- From: "loredana loredana" To: Sent: Monday, November 05, 2007 10:32 AM Subject: running! a servlet at tomcat startup This issue is a classic one already I think. I've googled it and haven't found anything that could help solving this problem. I'm probably not the one to think about this but...if you would add the 1 to a servlet, and from the init() method you would somehow try to call the doGet() method, wouldn't that do it? wouldn't that run the servlet at startup? did anybody try this already? I am trying to do this but I'm having some problem creating HttpServletRequest and Response objects so I can call doGet(). So if anyone did this already, pls let me know how this issue can be fixed! 10x a lot! ======================= Hi loredana, Not sure if you asking or answering ;) Yes, and then do stuff in the INIT method. No, why try call doGet().... just init the functions that need initing, like the dBPool, or image processing. The doGet implies you want to return info to a browser.... there isnt one? The Init method runs just once.... thats the idea. just lets you get the INIT out of the way, otherwise it will happen on the first browser request, and if it takes a long time the browser will seem very slow to the user... but that only happens once anyway. ???????? ======================== __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com --------------------------------------------------------------------- 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 __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com --------------------------------------------------------------------- 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