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

118 Views Asked by At

I want any user trying to access http://localhost:8080/test/ to be redirected to 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.

1

There are 1 best solutions below

5
Joakim Erdfelt On BEST ANSWER

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.

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).