tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pid <...@pidster.com>
Subject Re: Single virtual tomcat application which serves multiple contexts
Date Fri, 20 Jan 2012 16:23:40 GMT
On 20/01/2012 15:56, 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 http://mydomain.com/client1/
> 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 http://mydomain.com/client1/
> 
> When the client 2 requests the http://mydomain.com/client2/, 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?

No, it's not.

If you want to build a multi-tenant application, you should:

1. Make your application the ROOT application.
2. Then use the first part of the path to determine which tenant.
3. Use the path data to select a configuration as required.

What is the benefit in making it one application?


p



-- 

[key:62590808]


Mime
View raw message