在web.xml文件中添加:
<security-constraint>
<display-name>Constranint1</display-name>
<web-resource-collection>
<url-pattern>/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>HEAD</http-method>
<http-method>PUT</http-method>
<http-method>OPTIONS</http-method>
<http-method>TRACE</http-method>
<http-method>DELETE</http-method>
</web-resource-collection>
<user-data-collection>
<transport-guarantee>CONFIDENTIAL</ transport-guarantee>
</user-data-collection>
</security-constraint>