You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by boris <bo...@ipunplugged.com> on 2006/12/21 11:11:41 UTC

Tomcat-6.0.6 - path attribute not honored in Context descriptor files.

Problem:
The "path" attribute in the Context descriptor file no used in
TC 5.5 and 6.0.

Background:
In an application deployment you whish to be able to install and
upgrade both tomcat and your WARS individually. In TC 4.1 this was
easily done by dropping a Context descriptor file in the webapps
directory. This Context descriptor contained beside local
configurations mainly what was deployed (docBase - which WAR) and where
it should be deployed (path - mount point for the WAR). Name of the
Context descriptor file was arbitrary except it had an '.xml'
extension.

The ability to drop Context descriptor files are now moved to the
$CATALINA_HOME/conf/[enginename]/[hostname] directory OK. The problem
is that the "path" attribute is ignored in the Context read from this
directory. Only Contexts defined in the server.xml file honors the
path attribute. Defining the Contexts in the server.xml file is though
discouraged of obvious reasons.

Boris

-- 
                              \\V//
                              (o o)
--------------------------ooO--(_)--Ooo-----------------------------
    You know you've achieved perfection in design,
        NOT when you have nothing more to add,
            but when you have nothing more to remove.
.....................................................................
Boris Prochazka                 E-mail: boris@ipunplugged.com
Arenavagen 23, Box 101 60       http://www.ipunplugged.com
SE-121 28 Stockholm Globen      [home]   +46  8  - 6040786
                                [office] +46  8  - 7255919
SWEDEN                          [mobile] +46 70  - 5125122

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: Tomcat-6.0.6 - path attribute not honored in Context descriptor files.

Posted by Markus Schönhaber <ma...@schoenhaber.de>.
boris wrote:
> I know that it works according to the documentation but I can't
> ignore the fact that I believe it's wrong. 

If you think the way Tomcat handles deployment is wrong, OK. But I don't think 
you convince the developers (I'm not one, BTW) to change their point of view 
by hijacking a thread and posting a "problem" report.

> If you look closer in 
> the code of HostConfig.deployDescriptors() you note that others has
> missed the ability to set the context path and has hidden it in the
> filename which is neither portable nor documented.

1. I don't know whether this mechanism is supposed to be portable (in fact, I 
strongly doubt it). If you think it violates the specs, you should quote the 
correspondig passage which says it has to be done otherwise.
2. It's documented. I even quoted the relevant part of the documentation in my 
previous post.

>
>             File contextXml = new File(configBase, files[i]);
>             if (files[i].toLowerCase().endsWith(".xml")) {
>
>                 // Calculate the context path and make sure it is unique
>                 String nameTmp = files[i].substring(0, files[i].length() -
> 4); String contextPath = "/" + nameTmp.replace('#', '/'); if
> (nameTmp.equals("ROOT")) {
>                     contextPath = "";
>                 }
>
> If you understand me I believe it's a mistake to tie the Context
> descriptors file name to the context path while there is a clean and
> documented way of defining the path in the context tag. In this aspect
> I believe the way it worked in TC-4.1 is to prefer and I ask you
> to reconsider it.

You could file an enhancement request in bugzilla.
Or, you could search the list archives. I'd consider it possible that you find 
some explanation why the devs decided to change the way how the app-path is 
set.

Regards
  mks

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: Tomcat-6.0.6 - path attribute not honored in Context descriptor files.

Posted by boris <bo...@ipunplugged.com>.
I know that it works according to the documentation but I can't
ignore the fact that I believe it's wrong. If you look closer in
the code of HostConfig.deployDescriptors() you note that others has
missed the ability to set the context path and has hidden it in the
filename which is neither portable nor documented.


            File contextXml = new File(configBase, files[i]);
            if (files[i].toLowerCase().endsWith(".xml")) {

                // Calculate the context path and make sure it is unique
                String nameTmp = files[i].substring(0, files[i].length() - 4);
                String contextPath = "/" + nameTmp.replace('#', '/');
                if (nameTmp.equals("ROOT")) {
                    contextPath = "";
                }

If you understand me I believe it's a mistake to tie the Context
descriptors file name to the context path while there is a clean and
documented way of defining the path in the context tag. In this aspect
I believe the way it worked in TC-4.1 is to prefer and I ask you
to reconsider it.

Boris

Markus Schönhaber wrote:
> boris wrote:
> 
>> The problem 
>> is that the "path" attribute is ignored in the Context read from this
>> directory. Only Contexts defined in the server.xml file honors the
>> path attribute.
> 
> That's not a problem. It's exactly the way it's meant to be:
> http://tomcat.apache.org/tomcat-6.0-doc/config/context.html
> 
> | The value of this field must not be set except when statically defining a
> | Context in server.xml, as it will be infered from the filenames used for
> | either the .xml context file or the docBase.  
> 
> BTW: for support questions you should post to the users list.
> 
> Regards
>   mks
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
> 


-- 
                              \\V//
                              (o o)
--------------------------ooO--(_)--Ooo-----------------------------
    You know you've achieved perfection in design,
        NOT when you have nothing more to add,
            but when you have nothing more to remove.
.....................................................................
Boris Prochazka                 E-mail: boris@ipunplugged.com
Arenavagen 23, Box 101 60       http://www.ipunplugged.com
SE-121 28 Stockholm Globen      [home]   +46  8  - 6040786
                                [office] +46  8  - 7255919
SWEDEN                          [mobile] +46 70  - 5125122

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: Tomcat-6.0.6 - path attribute not honored in Context descriptor files.

Posted by Markus Schönhaber <ma...@schoenhaber.de>.
boris wrote:

> The problem 
> is that the "path" attribute is ignored in the Context read from this
> directory. Only Contexts defined in the server.xml file honors the
> path attribute.

That's not a problem. It's exactly the way it's meant to be:
http://tomcat.apache.org/tomcat-6.0-doc/config/context.html

| The value of this field must not be set except when statically defining a
| Context in server.xml, as it will be infered from the filenames used for
| either the .xml context file or the docBase.  

BTW: for support questions you should post to the users list.

Regards
  mks

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org