5,655
社区成员
发帖
与我相关
我的任务
分享
<init-param>
<param-name>readonly</param-name>
<param-value>true</param-value>
</init-param>
然后在当前项目的web.xml文件中加入如下代码:
<web-resource-collection>
<web-resource-name>Your_Web_Project_Name</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>DELETE</http-method>
<http-method>PUT</http-method>
<http-method>HEAD</http-method>
<http-method>TRACE</http-method>
<http-method>OPTIONS</http-method>
</web-resource-collection>
<auth-constraint>
<role-name></role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
<security-role>
<role-name></role-name> <!--此处角色设置为空 仍可以禁用上面设定的http方法-->
</security-role>
按照上面配置后,就禁用了tomcat6的一些http method。