You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Romain Manni-Bucau <rm...@gmail.com> on 2012/05/21 18:26:36 UTC

tomcat & deploywar & context.xml

Hi,

how does tomcat manage context.xml at startup?

from what i saw it uses org.apache.catalina.startup.HostConfig.DeployWar
but in org.apache.catalina.startup.HostConfig#deployWAR it reads the
context.xml file before overriding it with contextname info which ignores
the context.xml file:

            context.setName(cn.getName());
            context.setPath(cn.getPath());
            context.setWebappVersion(cn.getVersion());
            context.setDocBase(cn.getBaseName() + ".war");


did i miss sthg or is it a bug?

- Romain

Re: tomcat & deploywar & context.xml

Posted by Romain Manni-Bucau <rm...@gmail.com>.
ok thank you for the quick answer

sorry to have missed it on the website

- Romain


2012/5/21 Konstantin Kolinko <kn...@gmail.com>

> 2012/5/21 Romain Manni-Bucau <rm...@gmail.com>:
> > Hi,
> >
> > how does tomcat manage context.xml at startup?
> >
> > from what i saw it uses org.apache.catalina.startup.HostConfig.DeployWar
> > but in org.apache.catalina.startup.HostConfig#deployWAR it reads the
> > context.xml file before overriding it with contextname info which ignores
> > the context.xml file:
> >
> >            context.setName(cn.getName());
> >            context.setPath(cn.getPath());
> >            context.setWebappVersion(cn.getVersion());
> >            context.setDocBase(cn.getBaseName() + ".war");
> >
> >
> > did i miss sthg or is it a bug?
> >
>
> 1. There are several context.xml files  (App's context.xml, Host's
> "context.xml.default" file, common conf/context.xml). See Context in
> config. reference for details.
>
> 2. App's context.xml is read twice, with different configuration of
> Digester.
>
> When it is read by the second time, the name etc. are ignored.
>
> That relates with the following documented feature: You cannot specify
> path attribute on Context in app's own context.xml, because it is
> already known a-priori from the name and location of the context file
> itself.
>
> The name and version are calculated from path.
>
> The same with docBase.
>
> Best regards,
> Konstantin Kolinko
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>

Re: tomcat & deploywar & context.xml

Posted by Konstantin Kolinko <kn...@gmail.com>.
2012/5/21 Romain Manni-Bucau <rm...@gmail.com>:
> Hi,
>
> how does tomcat manage context.xml at startup?
>
> from what i saw it uses org.apache.catalina.startup.HostConfig.DeployWar
> but in org.apache.catalina.startup.HostConfig#deployWAR it reads the
> context.xml file before overriding it with contextname info which ignores
> the context.xml file:
>
>            context.setName(cn.getName());
>            context.setPath(cn.getPath());
>            context.setWebappVersion(cn.getVersion());
>            context.setDocBase(cn.getBaseName() + ".war");
>
>
> did i miss sthg or is it a bug?
>

1. There are several context.xml files  (App's context.xml, Host's
"context.xml.default" file, common conf/context.xml). See Context in
config. reference for details.

2. App's context.xml is read twice, with different configuration of Digester.

When it is read by the second time, the name etc. are ignored.

That relates with the following documented feature: You cannot specify
path attribute on Context in app's own context.xml, because it is
already known a-priori from the name and location of the context file
itself.

The name and version are calculated from path.

The same with docBase.

Best regards,
Konstantin Kolinko

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