CCL Home Page
Up Directory CCL bug.html
init-param bug
Date: Fri, 31 Mar 2000 20:56:32 -0500 (EST)
From: Jan Labanowski <jkl@ccl.net>
To: tomcat-dev@jakarta.apache.org
Cc: Jan Labanowski <jkl@ccl.net>
Subject: <init-param> in /test

Small bug to fix, but for me it took a good hour to get it (I was born slow...)

Tomcat 3.1 Beta 1, Apache 1.3.12, both RH 6.1 linux and Solaris 2.7

If you mount <TOMCAT_HOME>/webapps/test/ in tomcat.conf as:
  ApJServMount /test /root
and you play with it on tomcat port, e.g.:

          http://xxx.xxx.xxx:8080/test/servlet/ServletParam

your response is:

   <html>
   <body>
   <h1>ServletParam</h1>
   <dl>
   </dl>
   </body></html>

To my surprise (after reading <TOMCAT_HOME>/webapps/test/WEB-INF/web.xml) the 
    http://xxx.xxx.xxx:8080/test/servlet/servletParam1
and 
    http://xxx.xxx.xxx:8080/test/servlet/servletParam2

gave the same response as the "naked servlet" with no init-params


However, when I replaced the following fragment:

================================
    <servlet>
        <servlet-name>
            servletParam1
        </servlet-name>
        <servlet-class>
            ServletParam
        </servlet-class>
        <init-param>
            <param-name>
                param1
            </param-name>
            <param-value>
                value1
            </param-value>
        </init-param>
        <init-param>
            <param-name>
                param2
            </param-name>
            <param-value>
                value2
            </param-value>
        </init-param>
    </servlet>

    <servlet>
        <servlet-name>
            servletParam2
        </servlet-name>
        <servlet-class>
            ServletParam
        </servlet-class>
        <init-param>
            <param-name>
                param3
            </param-name>
            <param-value>
            </param-value>
        </init-param>
        <init-param>
            <param-name>
                param4
            </param-name>
            <param-value>
                value4
            </param-value>
        </init-param>
    </servlet>

=======================

With the following fragment:

=======================================
    <servlet>
        <servlet-name>
            servletParam1
        </servlet-name>
        <servlet-class>
            ServletParam
        </servlet-class>
        <init-param>
            <param-name>param1</param-name>
            <param-value>value1</param-value>
        </init-param>
        <init-param>
            <param-name>param2</param-name>
            <param-value>value2</param-value>
        </init-param>
    </servlet>
    <servlet>
        <servlet-name>
            servletParam2
        </servlet-name>
        <servlet-class>
            ServletParam
        </servlet-class>
        <init-param>
            <param-name>param3</param-name>
            <param-value>value3</param-value>
        </init-param>
        <init-param>
            <param-name>param4</param-name>
            <param-value>value4</param-value>
        </init-param>
    </servlet>
=================================

i.e., when I removed the white space from around the tags
I got correct responses, e.g., the:
  http://xxx.xxx.xxx:8080/test/servlet/servletParam1
gives me:


<html>
<body>
<h1>servletParam1</h1>
<dl>
<dt>param2</dt><dd>value2</dd>
<dt>param1</dt><dd>value1</dd>
</dl>
</body></html>

Conclusion:  White space should be removed from around initialized
parameters, and the file <TOMCAT_HOME>/webapps/test/WEB-INF/web.xml is BAD.

Try it yourself, if you do not believe me. I do not want to go into
"Should XML parser remove the white space?" here...
I like it as is, but the fact remains... Keep the good work... Thanks for
everything...


Jan
jkl@ccl.net

Jan K. Labanowski            |    phone: 614-292-9279,  FAX: 614-292-7168
Ohio Supercomputer Center    |    Internet: jkl@ccl.net 
1224 Kinnear Rd,             |    http://www.ccl.net/chemistry.html
Columbus, OH 43212-1163      |    http://www.ccl.net/

[][][][][][][][][][][][][][][][]

Date: Fri, 31 Mar 2000 18:04:48 -0800
From: Anil Vijendran <akv@pipedream.org>
To: tomcat-dev@jakarta.apache.org
Cc: Jan Labanowski <jkl@ccl.net>
Subject: Re: <init-param> in /test

Jan Labanowski wrote:

> Conclusion:  White space should be removed from around initialized
> parameters, and the file <TOMCAT_HOME>/webapps/test/WEB-INF/web.xml is BAD.

Thanks for pointing this out. This should just be a trim() on the Text node in
the
web.xml parsing code. Can you please file a bug report so we don't lose things
like these? (http://jakarta.apache.org/bugs)


--
Peace, Anil +<:-)



[][][][][][][][]





  
Modified: Sat Apr 1 02:34:09 2000 GMT
Page accessed 463 times since Thu Apr 11 21:53:27 2002 GMT