Java下载https文件上传到阿里云oss服务器
今天做了一个从Https链接中下载音频并且上传到OSS服务器,记录一下希望大家也少走弯路。
一共两个类:
1 、实现自己的证书信任管理器类/** * @author mazhq * @Title: X509TrustUtiil * @ProjectName: zeus * @Description: 证书信任管理器类 * @date 2019/2/18 15:14 */ public class X509TrustUtil implements X509TrustManager { @Override public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { } @Override public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { } @Override public X509Certificate[] getAcceptedIssuers() { return new X509Certificate[0]; } }