http - 如何为 java servlet 应用程序设置 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>
我该如何解决这个问题?
解决方案
推荐阅读
- json - 解析复杂的 JSON 文件以在 Flutter 中制作调查屏幕
- azure - 子网之间的 Azure postgres 数据库专用连接
- java - Android Studio ArrayList Error: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $
- awk - 为什么在 Awk 中未定义用于连接的表达式的求值顺序?
- c++ - C++ 程序不返回值(函数)
- java - 是什么导致此代码无法正确编译
- javascript - 赛普拉斯中“watchPosition”的存根
- c# - C# ASP.NET Core [Inject] 依赖注入的属性用法
- javascript - React useState 2D 数组的问题
- react-native - 包含在屏幕反应原生中的模态