java - 如何解决错误“错误请求。主机和端口的组合需要 TLS。”
问题描述
我正在尝试使用休息端点,但出现以下错误
错误请求。主机和端口的组合需要 TLS。
这是我写的代码
GET_URL ="https:/path/data"
URL obj = new URL(GET_URL);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
System.out.println("GET Response Code :: " + responseCode)
下面的代码来自其他暴露其余端点的团队。休息端点已启用 SSL。当我检查它说的代码时
@RestController
public class TestController {
@RequestMapping(value = "/data", method = RequestMethod.GET)
public String getData() {
return "Hello World";
}
server:
ssl:
enabled: true
client-auth: need
key-store: {keystore-path}
key-store-password: {keystore-password}
key-alias: alias-name
key-store-type: JKS
我该如何解决这个错误?能否提供步骤
解决方案
推荐阅读
- python-3.x - 使用 FancyArrowPatch 绘制穿过选定点的箭头
- c - 一个应该接受字符数组作为输入的函数如何接受传递给它的数组第一个元素的内存地址?
- symfony - 如何从 $_POST 传递单个参数?
- python - Python 3 在不改变范围的情况下获取布尔变量的变量名?
- reactjs - 如何使用最新的 Xcode 版本在 Visual Studio 应用中心构建一个 React Native 应用
- android - ImageView 覆盖了额外的空白区域
- angularjs - 如何将 Datetime Sharepoint 获取响应转换为文本
- shell - 无法使用 git bash 工具在 Windows 机器上运行 shell 脚本
- salesforce - 如何从 Fedex api 生成退件标签
- java - 将类的变量导入另一个类