Hello,

while reading the documentation in
https://tomcat.apache.org/tomcat-8.5-doc/config/context.html#Naming
it is not clear to me how to achieve the following:

Have one WAR file with corresponding directory, for example:

app#1.war => app#1 (directory) => /app/1 (context path)

But have another context path pointing to same application:

/app/latest (context path) => app#1 (directory)

I tried adding <Context> to server.xml inside <Host> like:

<Context docBase="app#1 " path="/app/latest"/>

But Tomcat created another directory app#latest from this, and copied app#1 
there.
I would like to avoid having duplicate directories.

Doc says that:
* To define multiple contexts that use a single WAR file or directory, use one 
of the options described in the Naming section above for creating a Context 
that has a path that is not related to the base file name.
* If you want to deploy a WAR file or a directory using a context path that is 
not related to the base file name then one of the following options must be 
used to prevent double-deployment:
** Disable autoDeploy and deployOnStartup and define all Contexts in server.xml
** Locate the WAR and/or directory outside of the Host's appBase and use a 
context.xml file with a docBase attribute to define it.

Don't quite understand what to do.
Do I need add <Context> also to the existing application:

<Context docBase="app#1 " path="/app/1"/>

Or what does "define all Contexts in server.xml" mean?
And what does the second option (Locate the WAR...) mean?

Thanks,

-Harri

Reply via email to