简体   繁体   English

将 Curl 请求转换为 java Rest 模板调用

[英]Convert Curl Request in to java Rest Template Call

I have to make a OCSP cert verification call with the cert issued by some system.我必须使用某个系统颁发的证书进行 OCSP 证书验证调用。 The OCSP team shared the below curl url as sample OCSP 团队分享了以下 curl url 作为示例

curl --cert.pem.txt --key.key.pem --cacert ABCASDStaging.cer.txt https://osd.staging.sd.sd.sg --data-binary @request.der --header "Content-Type:application/ocsp-requests" --header "Host:ocsp.staging.xvc.sdf.sg" --output asdasd-ocsp-resp.der --insecure -v >> STG CDNS.txt2>&1 curl --cert.pem.txt --key.key.pem --cacert ABCASDStaging.cer.txt https://osd.staging.sd.sd.sg --data-binary @request.der --header "内容-Type:application/ocsp-requests" --header "Host:ocsp.staging.xvc.sdf.sg" --output asdasd-ocsp-resp.der --insecure -v >> STG CDNS.txt2>&1

Im trying to code the above curl request in to java rest template request but unable to proceed.我试图将上述 curl 请求编码到 java rest 模板请求中,但无法继续。 Can help to convert this request in to java rest template可以帮助将此请求转换为 java rest 模板

Created the header创建了 header

 HttpHeaders headers = new HttpHeaders();
    headers.add(HttpHeaders.CONTENT_TYPE, "ocsp-requests");
    headers.add("Host", "ocsp.staging.xvc.sdf.sg");

This url has how to make ssl request in Java spring boot using Rest Template: Spring Boot SSL Client This url has how to make ssl request in Java spring boot using Rest Template: Spring Boot SSL Client

Using the below url we can convert curl request to java code directly: https://reqbin.com/curl Using the below url we can convert curl request to java code directly: https://reqbin.com/curl

Hope this references might be useful希望这些参考资料可能有用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM