0
votes

I have a Tomcat 8 instance which is used to publish multiple web applications. As today, I have a Spring architecture which produces 2 .war:

  • Front-end
  • Back-end

And the result is the following:

What I would like to achieve is to have a common root path for both these wars. Is this something I can do in Tomcat? In JBOSS or IIS I can use the concept of "Virtual Directory" to achieve that.

My intended result is the following:

2

2 Answers

2
votes

The Tomcat documentation says to use # in the name.

Context Name     Base File Name     Example File Names
/foo             foo                foo.xml, foo.war, foo
/foo/bar         foo#bar            foo#bar.xml, foo#bar.war, foo#bar

So use these names for your war files:

my-app#my-front-end.war
my-app#my-back-end.war

1
votes

Set the context paths: /my-app/my-front-end and /my-app/my-back-end respectively.

For example, if you are using Spring Boot, then put:

server.contextPath=/my-app/my-front-end

and

server.contextPath=/my-app/my-back-end 

in application.properties file.

If you cannot modify the application's source code, here you can find out how to configure Tomcat to get the same result.