tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: Single virtual tomcat application which serves multiple contexts
Date Fri, 20 Jan 2012 16:25:53 GMT
Egor Samarkhanov wrote:
> Hello !
> I have multiple clients:
>   client 1 - 40 users
>   client 2 - 50 users
>   client 3 - 60 users
> And I have a web application that is supposed to serve the clients.
> The application is deployed into Tomcat. Each client has it's own database.
> What I want to implement is the single web application instance which
> servers all  the clients. The client (and the database to connect to)
> is identified by the context path from the URL.
> I.e. I imply the following scenario:
> 1. Some user requestes the
> 2. Tomcat invokes a single instance of my application (no matter
>    which  context is requested)
> 3. My application processes the rest of the request thinking that it's
>    deployed to /client1 context path, i.e. all redirect or relative URLs
>    should be resolved against
> When the client 2 requests the, I want my
> application (the same instance) now process it just like if it was
> deployed to /client2 context path.
> Is this possible in Tomcat?
Personal opinion:

By putting some considerable effort into it, it is certainly possible to do something like

that, by rewriting URLs and/or proxying and/or making all your pages refer to the context


But the question is : why ?
- you have many, many "clients"
- or you application is so big that having multiple copies of it totally fills your disk
- or your application for "client1" needs to share data with the application for "client2"
then it may be worth thinking about this.

But otherwise, you probably would immensely simplify your life by using a separate virtual

host for each client, and have for each virtual host a separate appBase, in which you just

deploy a copy of your application.

Think of the security issues otherwise, to avoid one client being ever able to access the

data of another; or think of what happens when one of these clients in the future asks you

for that little change just for him.. etc..

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message