You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Jan Labanowski <jk...@osc.edu> on 2000/04/01 03:56:32 UTC

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 and 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@osc.edu

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


Re: in /test

Posted by Costin Manolache <co...@eng.sun.com>.
I agree - on unix it's not allowed to have space in env variables, and probably most people
are not using space prefix/suffix.

The servlet API doesn't mention any restriction in the name or value - it's just a string.
It will also be confusing - it's better to use the same rules ( i.e. you have to leave no
space between <tag>and body</tag> ).




Costin


Jan Labanowski wrote:

> If I may...
>
> The white space should be probably trimmed from "name"s, but not from
> values. At least in UNIX, if we use analogy of Environment variable, the
> name should not have spaces inside, I believe, since shells assume
> that it does not have white space (again, I believe).
>
> Jan
> Jan K. Labanowski            |    phone: 614-292-9279,  FAX: 614-292-7168
> Ohio Supercomputer Center    |    Internet: jkl@osc.edu
> 1224 Kinnear Rd,             |    http://www.ccl.net/chemistry.html
> Columbus, OH 43212-1163      |    http://www.osc.edu/
>
> On Mon, 3 Apr 2000, Costin Manolache wrote:
>
> > I will fix web.xml, I don't think trim() is the right solution - what if the user
> > wants the
> > spaces ?
> > ( I guess it can use a CDATA - but that will be useless too if we strip the spaces ).
> >
> > Costin
> >
> >
> > Anil Vijendran wrote:
> >
> > > 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 +<:-)
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: in /test

Posted by Jan Labanowski <jk...@osc.edu>.
If I may...

The white space should be probably trimmed from "name"s, but not from
values. At least in UNIX, if we use analogy of Environment variable, the
name should not have spaces inside, I believe, since shells assume
that it does not have white space (again, I believe).

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


On Mon, 3 Apr 2000, Costin Manolache wrote:

> I will fix web.xml, I don't think trim() is the right solution - what if the user
> wants the
> spaces ?
> ( I guess it can use a CDATA - but that will be useless too if we strip the spaces ).
> 
> Costin
> 
> 
> Anil Vijendran wrote:
> 
> > 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 +<:-)
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> 



Re: in /test

Posted by Costin Manolache <co...@eng.sun.com>.
I will fix web.xml, I don't think trim() is the right solution - what if the user
wants the
spaces ?
( I guess it can use a CDATA - but that will be useless too if we strip the spaces ).

Costin


Anil Vijendran wrote:

> 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 +<:-)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: in /test

Posted by Anil Vijendran <ak...@pipedream.org>.
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 +<:-)