在web.xml中添加一下配置,以限制http的请求方式
<security-constraint>
<web-resource-collection>
<web-resource-name>resource</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>PUT</http-method>
<http-method>DELETE</http-method>
<http-method>HEAD</http-method>
<http-method>OPTIONS</http-method>
<http-method>TRACE</http-method>
<!-- <http-method>GET</http-method> -->
<!-- <http-method>POST</http-method> -->
</web-resource-collection>
<auth-constraint>
</auth-constraint>
</security-constraint>