Spring,Tomcat 尝试在 server.xml 中设置上下文 URL 路径,但它不起作用
我一直在试图弄清楚如何做到这一点,据我所知,我正在做我发现的各种资源所说的事情。我有一个名为 spring-hibernate-mysql 的 Spring 应用程序,我希望能够通过以下路径访问该应用程序: http://example.com/l/
而不是我当前必须访问的方式: http://example.com/spring-hibernate-mysql/l/
。
我的应用程序名称在 Eclipse 中显示为 spring-hibernate-mysql
,当我构建它时,战争称为 spring-hibernate-mysql.war
我已将此代码放入我的 Tomcat 的 server.xml 但它不起作用:
如有任何建议,我们将不胜感激。
I've been trying to figure out how to do this and as far as I can tell I am doing what the various resources I have found say to do. I have a Spring application called spring-hibernate-mysql that I want to be able to access at the path: http://example.com/l/
rather than the way I currently have to at: http://example.com/spring-hibernate-mysql/l/
.
My app name as it appears in eclipse is spring-hibernate-mysql
and when I build it the war is called spring-hibernate-mysql.war
I have placed this code in my Tomcat's server.xml but it is not working: <Context docBase="spring-hibernate-mysql" path="" reloadable="true" />
Any advice is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须在过滤器映射的 web.xml 中进行设置。
例如:
You have to setup this in your web.xml in filter mappings.
e.g.:
如果您将 war 重命名为 l.war,然后将 l.war 放入 Tomcat 的 webapp 目录中,那么您将能够使用
http://mydomain.com/l/
访问您的应用程序。If you rename your war as l.war and then place l.war inside Tomcat's webapp directory then you will be able to use
http://mydomain.com/l/
to access your application.