如何针对两种不同的上下文进行单一部署?

时间:2014-04-29 12:30:57

标签: tomcat

在我们的环境中,我有多个上下文(ROOT, myapp, backup)

网址localhost:8080/myapp& localhost:8080需要访问相同的应用myapp

为了实现这一点,我正在myapp目录和tomcat/webapps/ROOT目录中部署tomcat/webapps/myapp应用程序。

有没有办法避免这种多重部署?我正在使用apache tomcat 7

1 个答案:

答案 0 :(得分:1)

您可以将index.html放在根路径中,将浏览器重定向到您的应用网址:

<!DOCTYPE HTML>
<html lang="en-US">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="refresh" content="1;url=./myapp/">
        <script type="text/javascript">
            window.location.href = "./myapp/"
        </script>
        <title>Page Redirection</title>
    </head>
    <body>
        <!-- Note: don't tell people to `click` the link, just tell them that it is a link. -->
        If you are not redirected automatically, follow the <a href='./myapp/'>link to example</a>
    </body>
</html>