虽然在带有 jax-rs( Jersey )的 java6 上使用 tomcat 6,但我希望我的客户能够 http GET/order 而不是 GET/order/42
如果我输入类似/order/* 的内容,它也会匹配/order
即:
<web-resource-collection>
<web-resource-name>show a specific order</web-resource-name>
<url-pattern>/order/*</url-pattern>
<http-method>GET</http-method>
</web-resource-collection>
如果我http://localhost/order -> 401 同样的故事 http://localhost/order/42
我认为这无法通过 web.xml 实现,但以防万一......
最佳答案
作为解决方法,
您可以在 /order/*
配置过滤器并检查 URL。如果它的 /order/something
将它重定向到安全的 URL
关于java - web.xml <url-pattern> 和 <security-constraint> 使用 RESTfull url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6064277/