tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Kolinko <knst.koli...@gmail.com>
Subject Re: Host appBase
Date Sat, 09 Nov 2013 04:22:17 GMT
2013/11/8 Leo Donahue - OETX <LeoDonahue@mail.maricopa.gov>:
> Tomcat 7.0.47
>
> Reading over the security benchmark I posted a link to earlier, there is one that suggests
to separate out the web content directory from the Tomcat system files.  Reading the Tomcat
docs for appBase, I see I can set this value.
>
> Reading further down in the Tomcat docs for Host, other questions have spawned... and
I blame it on being Friday.
>
> 1.  When/Why would I change the xmlBase directory location?  For the same reasons I would
change the appBase directory?

Maybe you do not like the default naming,
or you do not want those to be in /conf,
or maybe you want to share them between installations or between
several <Host>s.

> 2.  What is the benefit of un-packing WAR files?

You can have direct access to those files. E.g. you can use
java.io.RandomAccessFile and other APIs that do not work with an
InputStream.

ServletContext.getRealPath(foo) returns a non-null.

The "sendfile" feature in Connectors needs direct access to files.

Note that in Tomcat 7 and earlier even it you run with
unpackWARs=false, the WEB-INF/*.jar files are unpacked into the
webapp's work directory.  It is easier for classloaders to work with
them this way. It is not so easy to read a file from a jar archive
that is packed into another archive.

>         a.  If you drop a WAR file into your webapps directory (appBase I guess), and
it unpacks, should you leave the WAR file there or remove it?

Already answered by others.

> 3.  WAR files located outside of the Host's appBase will not be expanded...

Tomcat 6 did unpack them. Tomcat 7 does not unpack them, as we deemed
this as an useless feature.

Some small number of people complained after the change -- see mailing
list archives and Bugzilla issue 51294 for their stories.

>         a.  Why would I deploy WAR files outside of the Host's appBase?
>         b.  Where are those deployed?  By specifying the docBase?

yes, a docBase that points to a war file.

> 4. What is the difference exactly between appBase and docBase?
>
> If the Context is specified in server.xml, I can have an appBase and a docBase?

Already answered by others.

>  I know docBase has to be set outside of the Host's appBase,

Host's xmlBase and appBase are processed by auto-deployment and by
deploy-on-startup.

If they see you app in appBase, they will try to deploy it.  If at the
same time the same application is also deployed manually with an
explicit docBase  then you may end up with two copies of the same app.

Too many people got that wrong in the past, thus such warning was
added in documentation, and some protection was added in the code.

Best regards,
Konstantin Kolinko

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


Mime
View raw message