You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Richard Evans <rd...@webtrak.co.uk> on 2000/11/21 17:22:39 UTC
Changing root webapp
In the default tomcat build there is a ROOT webapp which maps to /. Now I
would like to map the pages and servlets in ROOT to some other path and have a
webapp of my own which handles /.
I tried something like this in server.xml:
<Context path="/root"
docBase="webapps/ROOT"
debug="0"
reloadable="true"
trusted="true" >
</Context>
<!-- Main applications and servlets -->
<Context path=""
docBase="webapps/main"
debug="1"
reloadable="true"
trusted="true" >
</Context>
In other words, /root will map to the tomcat home page, etc. It works fine
except of course my main web app is loaded twice: once when server.xml is read
and once at autosetup time. AutoSetup scans the webapps directory, finds
"main" and because there isn't a /main context, loads the context again. This
means that my load-on-startup servlets get loaded twice.
Is there a better way of doing this?
Richard
Re: Changing root webapp
Posted by "Julio Serje (@canada.com)" <js...@home.com>.
You may define your root app in a different location than webapps. Just move
it to another directory and give the absolute path in your server.xml:
<Context path=""
docBase="/absolutepath/main"
debug="1"
reloadable="true"
trusted="true" >
</Context>
I have a setup like this and works fine.
Julio
----- Original Message -----
From: Richard Evans <rd...@webtrak.co.uk>
To: <to...@jakarta.apache.org>
Sent: Tuesday, November 21, 2000 11:22 AM
Subject: Changing root webapp
> In the default tomcat build there is a ROOT webapp which maps to /. Now I
> would like to map the pages and servlets in ROOT to some other path and
have a
> webapp of my own which handles /.
>
> I tried something like this in server.xml:
>
> <Context path="/root"
> docBase="webapps/ROOT"
> debug="0"
> reloadable="true"
> trusted="true" >
> </Context>
>
> <!-- Main applications and servlets -->
>
> <Context path=""
> docBase="webapps/main"
> debug="1"
> reloadable="true"
> trusted="true" >
> </Context>
>
> In other words, /root will map to the tomcat home page, etc. It works
fine
> except of course my main web app is loaded twice: once when server.xml is
read
> and once at autosetup time. AutoSetup scans the webapps directory, finds
> "main" and because there isn't a /main context, loads the context again.
This
> means that my load-on-startup servlets get loaded twice.
>
> Is there a better way of doing this?
>
> Richard