gpt4 book ai didi

eclipse - Pivotal TC 默认网站覆盖

转载 作者:行者123 更新时间:2023-11-28 22:48:27 26 4
gpt4 key购买 nike

我有 Spring Tool Suite (3.9.2.RELEASE),默认情况下它与 Pivotal TC Web 服务器一起提供,它是 Apache Tomcat 的一个变体。据我了解,为了为 Tomcat 设置“默认网站”,您修改了指向您的应用程序的“上下文”。最佳实践可能会说在不同的文件中定义它,但我知道它仍然可以在“server.xml”中完成。

我在 STS 中有一个应用程序(“myApp”)。它通常通过 http://localhost:8080/myApp 访问。我想通过 http://localhost:8080 访问它。

以下是来自 Pivotal TC“server.xml”的片段

<Context docBase="myApp" path="/myApp" ... />

我已按如下方式对其进行了修改,但我仍然会到达默认的 Pivotal tc Server Runtime 主页,而不是我自己的主页:

<Context docBase="" path="/myApp"  ... />

我应该在另一个位置应用这些更改以使其生效吗?显然有一点我不明白。

非常感谢您的投入。

最佳答案

正在查找 tomcat's documentation对于您在 Context 元素中提到的两个属性,您会发现:

文档库:

The Document Base (also known as the Context Root) directory for this web application, or the pathname to the web application archive file (if this web application is being executed directly from the WAR file). You may specify an absolute pathname for this directory or WAR file, or a pathname that is relative to the appBase directory of the owning Host.

The value of this field must not be set unless the Context element is defined in server.xml or the docBase is not located under the Host's appBase...

路径

The context path of this web application, which is matched against the beginning of each request URI to select the appropriate web application for processing. All of the context paths within a particular Host must be unique. If you specify a context path of an empty string (""), you are defining the default web application for this Host, which will process all requests not assigned to other Contexts.

This attribute must only be used when statically defining a Context in server.xml. In all other circumstances, the path will be inferred from the filenames used for either the .xml context file or the docBase.

Even when statically defining a Context in server.xml, this attribute must not be set unless either the docBase is not located under the Host's appBase or both deployOnStartup and autoDeploy are false. If this rule is not followed, double deployment is likely to result.

换句话说:您应该修改path 属性。当您执行此操作时,请确保同时取消部署默认内容,否则这些内容将与您自己的定义发生冲突。

您还会发现 "" 不是有效的 docBase,因为它指定了 WAR 文件或目录。

关于eclipse - Pivotal TC 默认网站覆盖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48872290/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com