简体   繁体   中英

Tomcat 8, publish 2 .war under same root directory

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:

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM