【问题标题】:How tomcat handles welcome-file-list mentioned in web.xmltomcat 如何处理 web.xml 中提到的欢迎文件列表
【发布时间】:2017-05-23 08:21:19
【问题描述】:

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

<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如何处理welcome-file-list,意味着它如何将用户重定向到它。 或者我如何获得这样的 URL http://localhost:8080/demoApplication/flows/login.htm

【问题讨论】:

    标签: tomcat


    【解决方案1】:

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

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

    【讨论】:

    • 感谢您的回复,将对此进行调查。
    猜你喜欢
    • 2013-01-16
    • 2012-04-26
    • 1970-01-01
    • 2011-08-03
    • 2013-04-17
    • 2015-03-21
    • 2019-03-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多