简体   繁体   English

如何在 Jetty 的 http://localhost:8080/test/ 中去掉多余的 /?

[英]How to I get rid of extra / in http://localhost:8080/test/ in Jetty?

I want any user trying to access http://localhost:8080/test/ to be redirected to http://localhost:8080/test .我希望任何试图访问http://localhost:8080/test/的用户都被重定向到http://localhost:8080/test I want to remove the extra '/' after test.我想在测试后删除多余'/'

I tried writing this in rewrite rules but it doesn't work for me.我试着在重写规则中写这个,但它对我不起作用。

If your contextPath is /test then the extra slash is required to satisfy the context path rules of both the servlet spec and the URI / http resource declarations of the various RFCs.如果您的contextPath/test ,则需要额外的斜线来满足 servlet 规范和各种 RFC 的 URI / http 资源声明的上下文路径规则。

If you set your web application, handler, context, etc with the "context path" of /test then you'll want to switch to using / (the root context) and having a servlet url-pattern of /test (exactly named /test ).如果您将 web 应用程序、处理程序、上下文等设置为/test的“上下文路径”,那么您需要切换到使用/ (根上下文)并使用/test的 servlet url-pattern(准确命名为/test )。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我在哪里定义http:// localhost:8080 /“ homepage” - Where I define http://localhost:8080/“homepage” 当我通过tomcat启动我的应用程序时,为什么仍然得到“ http:// localhost:8080”? - Why I still get “http://localhost:8080” when I start my app by tomcat? 如何摆脱这些额外的空间? - How to Get Rid of These Extra Spaces? 错误:XHR 加载失败:GET “http://localhost:8080/home” in agular - Error: XHR failed loading: GET “http://localhost:8080/home” in agular 如何在Java Swing中摆脱JPanel中的额外填充 - How can I get rid of the extra padding in a JPanel in java swing 我的 tomcat 正在运行,但无法连接到 http://localhost:8080 - My tomcat is running but I can't connect to http://localhost:8080 如何在该本地主机中打开资源:8080 / test / index.html? - How to open my resource in that localhost:8080/test/index.html? org.springframework.web.client.ResourceAccessException:“http://localhost:8080/”的 GET 请求上的 I/O 错误:连接被拒绝:连接 - org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://localhost:8080/": Connection refused: connect 无法在Netbeans 7.3中测试RESTful Web服务,如何在路径上消除多余的“ /” - can't test RESTful webservices in Netbeans 7.3, how to get rid of extra “/” on path 如何摆脱生成的 wadl 中的多余斜线? - How to get rid of extra slash in the generated wadl?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM