java - web.xml <url-pattern> 和 <security-constraint> 使用 RESTfull url

标签 java http jax-rs basic-authentication

虽然在带有 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/

相关文章:

java - 帮助 Google Code Issue Tracker API

junit - CXF 单元测试

heroku - Google Books API 服务器不接受来自 Heroku 服务器的调用

java - JAX-RS/Jersey : java. lang.ClassCastException - 无法转换为 javax.xml.bind.JAXBElement

java - 通过 JSP 使用 Web 服务 JAX

java - map 如何检查 key ?

php - 功能性重定向的 HTTP 状态

java - Apache 与 Tomcat 配置问题

java - 得到此异常 : java. lang.IllegalArgumentException : No Retrofit annotation found. (参数 #2)

Python多线程和HTTP请求