Context path routing in Tomcat ( service swapping )

Posted by jojovilco on Stack Overflow See other posts from Stack Overflow or by jojovilco
Published on 2012-06-15T07:25:14Z Indexed on 2012/06/18 15:16 UTC
Read the original article Hit count: 141

Filed under:
|
|

Here is what I would like to achieve:

I have a web service A which I want to be able to deploy side by side with other web services of type A - different version(s). For now I assume 2 instances side by side. I need it because the service has a warm up stage, which takes some time to build up stuff from DB and only after it is ready it can start serving requests ...

I was thinking to deploy to Tomcat context paths like: "/ServiceA-1.0", "/ServiceA-2.0" and then have a "virtual" context like "/ServiceA" which will point to the desired physical service e.g. "/ServiceA-1.0". So external world will know about ServiceA, but internally, my ServiceA related stack would know about versioned ServiceA url ( there are more components involved but only ServiceA is serving outer world ). When new service is ready, I would just reconfigure the "virtual" context to point to a new service.

So far, I was not able to find out how to do this with Tomcat and starting to tkink it is not possible. I found suggestions to place Apache Server in front of Tomcat and do the routing there, but I do not want to enroll another piece of software unless necessary.

My questions are:
- is this kind of a "virtual" context and routing possible to do with Tomcat?
- any other options, wisdom and lessons learned how to achieve this kind of service swapping scenario?

Best,
Jozef

© Stack Overflow or respective owner

Related posts about java

Related posts about tomcat