mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-02-14 20:16:23 +08:00
#1059 微信支付证书地址参数keyPath支持使用网络地址
This commit is contained in:
@@ -1,19 +1,15 @@
|
||||
package com.github.binarywang.wxpay.config;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.security.KeyStore;
|
||||
import javax.net.ssl.SSLContext;
|
||||
|
||||
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.ssl.SSLContexts;
|
||||
|
||||
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||
import lombok.Data;
|
||||
import javax.net.ssl.SSLContext;
|
||||
import java.io.*;
|
||||
import java.net.URL;
|
||||
import java.security.KeyStore;
|
||||
|
||||
/**
|
||||
* 微信支付配置
|
||||
@@ -131,6 +127,15 @@ public class WxPayConfig {
|
||||
if (inputStream == null) {
|
||||
throw new WxPayException(fileNotFoundMsg);
|
||||
}
|
||||
} else if (this.getKeyPath().startsWith("http://") || this.getKeyPath().startsWith("https://")) {
|
||||
try {
|
||||
inputStream = new URL(this.keyPath).openStream();
|
||||
if (inputStream == null) {
|
||||
throw new WxPayException(fileNotFoundMsg);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new WxPayException(fileNotFoundMsg, e);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
File file = new File(this.getKeyPath());
|
||||
|
||||
Reference in New Issue
Block a user