gpt4 book ai didi

tomcat - tomcat如何处理web.xml中提到的welcome-file-list

转载 作者:行者123 更新时间:2023-11-28 22:49:41 24 4
gpt4 key购买 nike

我有一个应用程序,其中提到了这样的欢迎文件列表

<welcome-file-list>
<welcome-file>flows/login.htm</welcome-file></welcome-file-list>

所以当我点击我的应用程序的 URL 时,即 http://localhost:8080/demoApplication

然后加载欢迎页面,即登录页面。但在 URL 中它只显示 http://localhost:8080/demoApplication不喜欢http://localhost:8080/demoApplication/flows/login.htm

我想这样显示http://localhost:8080/demoApplication/flows/login.htm.基本上通过这个 URL“http://localhost:8080/demoApplication”通过我的过滤器之一。

那么 tomcat 如何处理欢迎文件列表,意味着它如何将用户重定向到它。或者我如何获得这样的 URL http://localhost:8080/demoApplication/flows/login.htm

最佳答案

如果您希望更改 URL,则需要向客户端发送重定向。否则,客户端认为服务器响应了对 http://localhost:8080/demoApplication 的请求,而不是执行到 flows/login.htm 的内部转发。

Tomcat 8及以上版本支持configurable rewriting .如果您有较早版本的 Tomcat,或者不喜欢内置的重写功能,Tuckey's urlrewrite很受欢迎。

关于tomcat - tomcat如何处理web.xml中提到的welcome-file-list,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44129468/

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