[英]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.