如何为Java Servlet应用程序设置https

时间:2018-12-25 12:31:05

标签: http tomcat servlets https

我已经创建了一个Java servlet Web应用程序。它可以与“ http”一起正常工作。现在,我要设置到服务器的“ https”安全连接。为此,我已在tomcatserver / conf / server.xml中正确配置了以下内容。

Connector port="8443" protocol="HTTP/1.1"
           maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
           keystoreFile="conf\localhost.jks" keystorePass="xxxx"
           clientAuth="false" sslProtocol="TLS" />

然后,我还在web.xml文件中配置了以下内容。

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

当我通过邮递员发送请求时,出现以下错误。 enter image description here

在这里,我还附加了请求标头。 enter image description here

我该如何解决?

0 个答案:

没有答案
相关问题