-----Original Message-----
From: Igal @ getRailo.org [mailto:i...@getrailo.org] 
Sent: Friday, July 04, 2014 9:05 PM
To: Tomcat Users List
Subject: Host appBase vs Context docBase

I'm a little confused about the Host appBase attribute.

Let's say that my website resides in D:\www\site1

I don't like using {Tomcat}/webapps so I don't want to have it as a base 
directory for websites.  What I've been doing so far is create an empty 
folder alongside "webapps", named "empty", and use it as appBase, e.g.

<Host name="Site1" appBase="empty" unpackWARs="false" autoDeploy="false">
   <!-- this works but what's the deal with appBase? !-->
   <Context path="/" docBase="D:/www/site1" />
</Host>

But it feels like I'm doing something wrong.  I expect this to work, but 
it doesn't:

<Host name="Site1" appBase="D:/www/site1" unpackWARs="false" 
autoDeploy="false">
   <!-- this doesn't work !-->
</Host>

Can anyone explain why the snippet above doesn't work, and if that is 
the way it should be, then what is the purpose of Host/appBase?

TIA

-- 
Igal Sapir
Railo Core Developer
http://getRailo.org/
----
Igal -
For the way you want to configure your setup, your original configuration will 
work, except that you need to change the path from "/" to "".
That's kind of the one thing bothered me from the beginning: if you wanted a 
named path, like "virtdir" you have to specify it with a leading slash, 
"/virtdir" but for the ROOT you don't specify it. Seemed like an inconsistent 
treatment to me.
That said, I'd really recommend following current practices and moving the 
<Context> element to its own file under the conf/engine_name/host_name 
directory structure.  For one, you don't have to worry about that path 
parameter ever again. The name of the XML file becomes the path value, with the 
exception of needing to name the file ROOT.xml to get the null path. Also, this 
allows you to store the file under the META-INF directory of your application 
and maintain the information there and have it copied to the correct place on 
deployment.  Read the docs for more info.
Here's how to remember the difference between appbase and docbase:  The appbase 
is the path to a directory where the applications for the host reside.  Any 
directory or war file stored there will be deployed under the host.
The docbase is the path to the directory containing the files for a specific 
application.  If it is a relative path, the directory is expected to reside 
under the appbase (take care to avoid double-deployment).  If it is a 
fully-qualified path, then the appbase value is ignored. 
It is possible to mix the two, but you need to be careful if you attempt that. 
Creating a new directory for each host is a good idea, even if they are empty.
If I were you, I'd really look at moving to the current configuration 
mechanism.  After you get used to it, you'll see it makes a lot more sense.  As 
an added plus, any change you make to the context can take effect without 
having to restart the entire Tomcat service.
Jeff



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

Reply via email to