Return-Path: Delivered-To: apmail-geronimo-user-archive@www.apache.org Received: (qmail 16398 invoked from network); 1 Feb 2007 20:27:00 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Feb 2007 20:27:00 -0000 Received: (qmail 6462 invoked by uid 500); 1 Feb 2007 20:27:05 -0000 Delivered-To: apmail-geronimo-user-archive@geronimo.apache.org Received: (qmail 6437 invoked by uid 500); 1 Feb 2007 20:27:05 -0000 Mailing-List: contact user-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: user@geronimo.apache.org List-Id: Delivered-To: mailing list user@geronimo.apache.org Received: (qmail 6426 invoked by uid 99); 1 Feb 2007 20:27:05 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Feb 2007 12:27:05 -0800 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of dccarew@gmail.com designates 64.233.182.188 as permitted sender) Received: from [64.233.182.188] (HELO nf-out-0910.google.com) (64.233.182.188) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Feb 2007 12:26:56 -0800 Received: by nf-out-0910.google.com with SMTP id m19so1003731nfc for ; Thu, 01 Feb 2007 12:26:34 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=lF9vkyxdZXnF7MIb2EdsEP0ZBVRv2PO9AI/gU+20LXHI+9ysm7YApizffCdZ/S4WOg08hbGbDnQ+Ua5bPq7ja7bOj05XTGzc7AOS2qsz5fMMm5yaeYYnVgtA0LvbaGyu58GRGaiBbPUlo/ptzThigog3Np8yhRkn1Cc75XsiK4o= Received: by 10.82.175.2 with SMTP id x2mr845842bue.1170361593639; Thu, 01 Feb 2007 12:26:33 -0800 (PST) Received: by 10.82.136.9 with HTTP; Thu, 1 Feb 2007 12:26:33 -0800 (PST) Message-ID: <419beb980702011226y68f12cdag9fb600185f88eac4@mail.gmail.com> Date: Thu, 1 Feb 2007 14:26:33 -0600 From: "David Carew" To: user@geronimo.apache.org Subject: Re: Servlet init params not being picked up In-Reply-To: <71B3593EF5502D4EB58FFFC6D3D30549035FB4FD@HEMV2BUKER.he.local> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_11505_27898489.1170361593592" References: <71B3593EF5502D4EB58FFFC6D3D30549035FB4FC@HEMV2BUKER.he.local> <419beb980701311702s6088c124kdb0b111eed44d053@mail.gmail.com> <71B3593EF5502D4EB58FFFC6D3D30549035FB4FD@HEMV2BUKER.he.local> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_11505_27898489.1170361593592 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline I think this might be a grey area in the spec.AFAIK it doesn't actually say that the ServletContext needs to be have the init params before the call to the init method completes. So some implementations might do that post init and others might do it pre init. On 2/1/07, John Hawkins wrote: > > > Ah - that did it - thankyou ! > > This works in other servers - is this a "feature"? > > > Any clue if I can override the servlet params in my geronimo-web.xml file? > > > many thanks, > John. > > > > > -----Original Message----- > From: David Carew [mailto:dccarew@gmail.com] > Sent: Thu 01/02/2007 01:02 > To: user@geronimo.apache.org > Subject: Re: Servlet init params not being picked up > > I don't think the init parameters are available via the method you're > using > until after the servlet is initialized. Try using this signature for init > > public void init(ServletConfig config) throws ServletException > > and then using the getParameterNames method on the ServletConfig object. > > > > On 1/31/07, John Hawkins wrote: > > > > Hi, > > > > My servlet isn't picking up the init params. Am I doing something wrong? > > > > Additionally - can I change these params in the geronimo-web.xml file so > > they change at deployment? > > > > My servlet init method > > > > public void init() throws ServletException > > { > > super.init(); > > // I used to get a specific param but that failed too so I moved to this > > test case > > Enumeration names = getServletContext().getInitParameterNames(); > > System.out.println("Printing out init params"); > > while(names.hasMoreElements()) > > { > > System.out.println("'"+names.nextElement()+"'"); > > } > > > > outputs this to stdio -> > > Printing out init params > > > > but no params ! > > > > This is the web.xml.... > > > > > 2.3//EN" > > "http://java.sun.com/dtd/web-app_2_3.dtd"> > > > > > > my servlet > > Test servlet > > > > > > TestServlet > > mytest.MyServlet > > > > > > > > myParam > > myParamValue > > > > > > > > > > Here's my geronimo-web.xml.... > > > > > > > > > > mygroup > > myartifactID > > war > > > > > > > > > > > > /mycontextroot > > > > > > > ------=_Part_11505_27898489.1170361593592 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I think this might be a grey area in the spec.AFAIK it doesn't actually say that the ServletContext needs to be have the init params  before the call to the  init method completes. So some  implementations might do that post init and others might do it pre init.

On 2/1/07, John Hawkins <hawkins_j@btconnect.com> wrote:

Ah - that did it - thankyou !

This works in other servers - is this a "feature"?


Any clue if I can override the servlet params in my geronimo-web.xml file?


many thanks,
John.




-----Original Message-----
From: David Carew [mailto:dccarew@gmail.com]
Sent: Thu 01/02/2007 01:02
To: user@geronimo.apache.org
Subject: Re: Servlet init params not being picked up

I don't think the init parameters are available via the method you're using
until after  the servlet is initialized. Try using this signature for init

public void init(ServletConfig config) throws ServletException

and then using the getParameterNames method on the ServletConfig object.



On 1/31/07, John Hawkins < hawkins_j@btconnect.com> wrote:
>
> Hi,
>
> My servlet isn't picking up the init params. Am I doing something wrong?
>
> Additionally - can I change these params in the geronimo-web.xml file so
> they change at deployment?
>
> My servlet init method
>
> public void init() throws ServletException
> {
> super.init();
> // I used to get a specific param but that failed too so I moved to this
> test case
> Enumeration names = getServletContext().getInitParameterNames();
> System.out.println("Printing out init params");
> while(names.hasMoreElements())
> {
> System.out.println ("'"+names.nextElement()+"'");
> }
>
> outputs this to stdio ->
> Printing out init params
>
> but no params !
>
> This is the web.xml....
>
> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
> 2.3//EN"
> "http://java.sun.com/dtd/web-app_2_3.dtd ">
>
> <web-app>
> <display-name>my servlet</display-name>
> <description>Test servlet</description>
> <distributable> </distributable>
> <servlet>
> <servlet-name>TestServlet</servlet-name>
> <servlet-class>mytest.MyServlet</servlet-class>
> <init-param>
> <description>
> </description>
> <param-name>myParam</param-name>
> <param-value>myParamValue</param-value>
> </init-param>
> </servlet>
> </web-app>
>
> Here's my geronimo-web.xml....
>
> <web-app xmlns=" http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.1">
> <dep:environment xmlns:dep="
> http://geronimo.apache.org/xml/ns/deployment-1.1">
> <dep:moduleId>
> <dep:groupId>mygroup</dep:groupId>
> <dep:artifactId>myartifactID</dep:artifactId>
> <dep:type>war</dep:type>
> </dep:moduleId>
> <dep:dependencies />
> <dep:hidden-classes />
> <dep:non-overridable-classes />
> </dep:environment>
> <context-root>/mycontextroot</context-root>
> </web-app>
>



------=_Part_11505_27898489.1170361593592--