tomcat 6:访问Web应用程序时URL中没有战争名称并且不覆盖ROOT?

发布于 2024-09-24 09:57:14 字数 560 浏览 1 评论 0原文

在我的战争的 META-INF/context.xml 中,我有:

<?xml version="1.0" encoding="UTF-8"?>
<Context path="/foobar" docBase="my-long-war-name"/>

我将战争部署到 webapps/ 目录,并确认我的 contex.xml 位于 %CATALINA_HOME%\conf\Catalina\ localhost 名称为 my-long-war-name.xml

现在,不再通过 http://localhost:8080/my-long-war- 访问我的 REST 服务name/contacts/data tomcat 应该允许 http://localhost:8080/foobar/contacts/data 但我只能通过以前的 URL 访问我的服务。就好像它完全忽略了上面为我的网络应用程序给出的路径。我什至尝试省略 docBase ,但这也不起作用。

为什么这不起作用?它应该是这么基本!

in my war's META-INF/context.xml I have:

<?xml version="1.0" encoding="UTF-8"?>
<Context path="/foobar" docBase="my-long-war-name"/>

I deploy my war to the webapps/ directory and I confirm that my contex.xml is in %CATALINA_HOME%\conf\Catalina\localhost with the name my-long-war-name.xml

Now, instead of accessing my REST service through http:/ /localhost:8080/my-long-war-name/contacts/data tomcat should allow http:/ /localhost:8080/foobar/contacts/data
but I can only access my service through the former URL. It's as if it completely ignores the path given above for my web app. I even tried omitting docBase and that didn't work either.

why doesn't this work?! it's supposed to be so basic!

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

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

发布评论

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

评论(1

你的呼吸 2024-10-01 09:57:14

我不明白为什么你需要。部署到 Tomcat 时我从来没有碰过这一点,一切都工作正常。

为什么不将 WAR 命名为 foobar,部署它,然后就完成它呢?你似乎执着于这个想法,尽管有相反的证据表明它是多么基本。

I don't see why you need the <Context>. I never touch that when deploying to Tomcat, and everything works fine.

Why don't you just make the WAR name foobar, deploy it, and be done with it? You seem to be wedded to this idea in spite of the evidence to the contrary about how basic it is.

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