web.xml文件中的url-pattern是否可以使用查询字符串来确定匹配,例如:
<security-constraint>
<web-resource-collection>
<web-resource-name>myServletTest</web-resource-name>
<url-pattern>/myServlet?test=one</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
Run Code Online (Sandbox Code Playgroud)
或者这是无效的还是只是匹配myServlet忽略查询字符串?
根据Java Servlet规范版本3.0 Rev a的第12.1节:
用于映射到servlet的路径是来自请求对象的请求URL减去上下文路径和路径参数.
我不知道确切的结果是什么,但它不会是你所追求的结果,因为在选择任何servlet来处理请求之前,参数将被剥离.
什么禁止你简单地使用不同的路径?
| 归档时间: |
|
| 查看次数: |
2251 次 |
| 最近记录: |