tomcat 6 中部署的应用程序的短 url 或别名

发布于 2024-10-01 09:09:36 字数 386 浏览 1 评论 0原文

我有一个部署在 tomcat 6 中的 Web 应用程序项目。 我可以使用以下网址访问我的应用程序:

http://localhost:8082/MyApplication

我也不想成为能够通过另一个 url 访问此应用程序,例如: http://localhost:8082/myapp

这可能吗?如果是的话我还有什么选择?

当然,我不想更改应用程序的原始名称(“MyApplication”)。

谢谢, 阿布舍克。

I have a web application project which is deployed in tomcat 6.
I can access my application using the url:

http://localhost:8082/MyApplication

I also wan't to be able to access this application by another url like:
http://localhost:8082/myapp

Is this possible ? if yes what alternatives do i have ?

Off course, I don't want to change the original name of the application('MyApplication').

Thanks,
Abhishek.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谜兔 2024-10-08 09:09:37

如果您在 server.xml 中添加 Context,它将按照您的意愿工作。提供您想要的 path 属性。

<Context docBase="MyApplication" path="/myapp" /> 

虽然它有效,但 Tomcat 文档不推荐这种方法,因为对 server.xml 的任何更改都意味着重新启动服务器,从而干扰所有 Web 应用程序。

但是,另一方面,将其保留在 Catalina_Home/conf/Catalina/localhost/context.xml 中的做法(文档推荐的)存在一些不可靠性,正如其他人报告的那样 - 当您重新部署时您也可能会失去 context.xml

请参阅为什么-tomcat-replace-context-xml-on-redeploy
为什么 tomcat 喜欢删除我的 context.xml 文件?

If you add the Context within server.xml it will work as you want. Give the path attribute you wish.

<Context docBase="MyApplication" path="/myapp" /> 

Though it works, this approach is not recommended by the Tomcat docs, since any changes to server.xml means restarting the server disturbing all the web apps.

But, on the flip side, the practice of keeping this in Catalina_Home/conf/Catalina/localhost/context.xml (which is recommended by the docs) has some unreliabilities as others have reported - when you redeploy the war you can lose the context.xml too

See Why-does-tomcat-replace-context-xml-on-redeploy and
Why does tomcat like deleting my context.xml file?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文