在web.xml中配置需要https访问的路径即可

<security-constraint>
<web-resource-collection>
<web-resource-name>license</web-resource-name>
<url-pattern>/public/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>


<security-constraint> 安全控制标签

<web-resource-collection>  被保护的资源集合

配置transport-guarantee=CONFIDENTIAL,表示被保护的资源自动由http协议转换为https协议