Одним из способов достижения этого является редактирование файла web.xml для вашего веб-приложения.
Я предполагаю, что у вас уже есть настроенное веб-приложение для принудительной отправки всех запросов на https с <transport-guarantee> CONFIDENTIAL
, как показано ниже
<security-constraint>
<display-name>Example Security Constraint</display-name>
<web-resource-collection>
<web-resource-name>Protected Area</web-resource-name>
<!-- Define the context-relative URL(s) to be protected -->
<url-pattern>/*</url-pattern>
<!-- If you list http methods, only those methods are protected -->
<http-method>DELETE</http-method>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>PUT</http-method>
</web-resource-collection>
<auth-constraint>
<!-- Anyone with one of the listed roles may access this area -->
<role-name>tomcat</role-name>
<role-name>role1</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
Теперь добавьте еще один блок ниже для сервлета, для которого вы хотите обойти https.
<security-constraint>
<web-resource-collection>
<web-resource-name>Unsecured resources</web-resource-name>
<url-pattern>/jsp/openforall.jsp</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
Теперь этот URL-адрес openforall.jsp будет доступен через http.
Примечание. Этот URL-адрес также будет доступен на https, если кто-то получит к нему доступ таким образом.