禁用不須要的http方法,通常禁用delete,put,默認狀況tomcat禁止了delete,put,訪問返回403-forbiden,此處在web.xml的<web-app>中添加以下禁用配置,
要讓web.xml配置生效須要重啓tomcat
<security-constraint>
<web-resource-collection>
<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>
</web-resource-collection>
<auth-constraint>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>web