use*_*539 3 java ssl tomcat servlets
我试图在日食中运行tomcat上的一个servlet.当我在服务器上运行时,servlet运行并为我提供如下链接:
"HTTP://本地主机:8443/AuthServer /服务器"
我已经为SSL配置了我的Tomcat服务器,如下所示:
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" keystoreFile="C:\Users\owner\.keystore" keystorePass="sheetalkshirsagar">
Run Code Online (Sandbox Code Playgroud)
当我在服务器上运行servlet时,它仍然使用http.我希望我的servlet链接为"https:// ..."而不是"http:// ..".你是怎样做的?
如果要在向该servlet发送请求时确保使用https协议,则需要更改WEB-INF/web.xml
Web应用程序中的文件.在您的情况下添加此配置参数:
<security-constraint>
<web-resource-collection>
<web-resource-name>AuthServer</web-resource-name>
<url-pattern>/Server</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
19803 次 |
最近记录: |