1. 开启https默认端口443
2. 开启http默认端口80, 这里的redirectPort设置为443
3. 配置8009端口重定向为443
4. 在项目文件web.xml中的</web-app>加入以下配置,强制SSL访问
<security-constraint>
<web-resource-collection>
<web-resource-name>SSL</web-resource-name>
<url-pattern>/*</url-pattern> 全站使用SSL
</web-resource-collection>
<user-data-constraint>
<description>SSL required</description>
CONFIDENTIAL: 要保证服务器和客户端之间传输的数据不能够被修改,且不能被第三方查看到
INTEGRAL: 要保证服务器和client之间传输的数据不能够被修改
NONE: 指示容器必须能够在任一的连接上提供数据。(即用HTTP或HTTPS,由客户端来决定)
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
<!-- <security-constraint>
<web-resource-collection>
<web-resource-name>OPENSSL</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint> -->