web.xml里加入
<security-constraint>
<web-resource-collection>
<web-resource-name>Protected Context</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>TRACE</http-method>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
server.xml里加入
<Connector
port="443"
maxHttpHeaderSize="8192"
maxThreads="1000"
minSpareThreads="50"
maxSpareThreads="70"
enableLookups="true"
disableUploadTimeout="true"
acceptCount="100"
scheme="https"
secure="true"
clientAuth="false"
sslProtocol="TLS"
keystoreFile="*.keystore"
keystorePass="***"/>
由https到http,正好相反。