在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協議