修复apache的HttpClinet证书无效问题
This commit is contained in:
parent
3f5412bd83
commit
7dd0cfe009
@ -5,6 +5,7 @@ import java.util.Set;
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.JedisPool;
|
||||
import redis.clients.jedis.JedisPoolConfig;
|
||||
import redis.clients.util.Pool;
|
||||
|
||||
import com.foxinmy.weixin4j.util.Consts;
|
||||
import com.foxinmy.weixin4j.util.SerializationUtils;
|
||||
@ -20,7 +21,7 @@ import com.foxinmy.weixin4j.util.SerializationUtils;
|
||||
public class RedisCacheStorager<T extends Cacheable> implements
|
||||
CacheStorager<T> {
|
||||
|
||||
private JedisPool jedisPool;
|
||||
private Pool<Jedis> jedisPool;
|
||||
|
||||
private final static String HOST = "127.0.0.1";
|
||||
private final static int PORT = 6379;
|
||||
@ -54,7 +55,7 @@ public class RedisCacheStorager<T extends Cacheable> implements
|
||||
this(new JedisPool(jedisPoolConfig, host, port, timeout));
|
||||
}
|
||||
|
||||
public RedisCacheStorager(JedisPool jedisPool) {
|
||||
public RedisCacheStorager(Pool<Jedis> jedisPool) {
|
||||
this.jedisPool = jedisPool;
|
||||
}
|
||||
|
||||
|
||||
@ -15,7 +15,6 @@ import com.foxinmy.weixin4j.http.SimpleHttpClient;
|
||||
*/
|
||||
public class SimpleHttpClientFactory extends HttpClientFactory {
|
||||
|
||||
private volatile SimpleHttpClient httpClient;
|
||||
private HttpParams params;
|
||||
|
||||
@Override
|
||||
@ -25,9 +24,6 @@ public class SimpleHttpClientFactory extends HttpClientFactory {
|
||||
|
||||
@Override
|
||||
public HttpClient newInstance() {
|
||||
if (this.httpClient == null) {
|
||||
this.httpClient = new SimpleHttpClient(params);
|
||||
}
|
||||
return this.httpClient;
|
||||
return new SimpleHttpClient(params);
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,6 +8,8 @@ import org.apache.http.client.config.RequestConfig;
|
||||
import org.apache.http.config.ConnectionConfig;
|
||||
import org.apache.http.config.SocketConfig;
|
||||
import org.apache.http.conn.HttpClientConnectionManager;
|
||||
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
|
||||
import org.apache.http.conn.ssl.X509HostnameVerifier;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
@ -53,12 +55,17 @@ public class HttpComponent4_2Factory extends HttpClientFactory {
|
||||
socketAddress.getPort());
|
||||
clientBuilder.setProxy(proxy);
|
||||
}
|
||||
if (params.getHostnameVerifier() != null) {
|
||||
clientBuilder.setHostnameVerifier(new CustomHostnameVerifier(params
|
||||
.getHostnameVerifier()));
|
||||
}
|
||||
if (params.getSSLContext() != null) {
|
||||
clientBuilder.setSslcontext(params.getSSLContext());
|
||||
X509HostnameVerifier hostnameVerifier;
|
||||
if (params.getHostnameVerifier() != null) {
|
||||
hostnameVerifier = new CustomHostnameVerifier(
|
||||
params.getHostnameVerifier());
|
||||
} else {
|
||||
hostnameVerifier = SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER;
|
||||
}
|
||||
clientBuilder.setHostnameVerifier(hostnameVerifier);
|
||||
clientBuilder.setSSLSocketFactory(new SSLConnectionSocketFactory(
|
||||
params.getSSLContext(), hostnameVerifier));
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,9 +100,6 @@ public class HttpComponent4_2Factory extends HttpClientFactory {
|
||||
|
||||
@Override
|
||||
public HttpClient newInstance() {
|
||||
if (httpClient == null) {
|
||||
this.httpClient = clientBuilder.build();
|
||||
}
|
||||
return new HttpComponent4_2(httpClient);
|
||||
return new HttpComponent4_2(clientBuilder.build());
|
||||
}
|
||||
}
|
||||
|
||||
@ -879,6 +879,10 @@
|
||||
<code>60025</code>
|
||||
<text>主页型应用不支持的消息类型</text>
|
||||
</error>
|
||||
<error>
|
||||
<code>60026</code>
|
||||
<text>已授权的应用不允许企业管理组调用接口修改菜单</text>
|
||||
</error>
|
||||
<error>
|
||||
<code>60027</code>
|
||||
<text>不支持第三方修改主页型应用字段</text>
|
||||
@ -891,6 +895,10 @@
|
||||
<code>60029</code>
|
||||
<text>应用已授权予第三方,不允许通过接口修改可信域名</text>
|
||||
</error>
|
||||
<error>
|
||||
<code>60031</code>
|
||||
<text>未设置管理组的登录授权域名</text>
|
||||
</error>
|
||||
<error>
|
||||
<code>60102</code>
|
||||
<text>UserID已存在</text>
|
||||
@ -999,6 +1007,10 @@
|
||||
<code>60129</code>
|
||||
<text>用户设置了拒绝邀请</text>
|
||||
</error>
|
||||
<error>
|
||||
<code>60131</code>
|
||||
<text>不合法的职位长度</text>
|
||||
</error>
|
||||
<error>
|
||||
<code>61017</code>
|
||||
<text>子商户未发起授权,不能进行授权确认</text>
|
||||
|
||||
@ -145,6 +145,7 @@ public class MchPayPackage extends PayPackage {
|
||||
String goodsTag, String limitPay, String subOpenId) {
|
||||
super(body, detial, outTradeNo, totalFee, notifyUrl, createIp, attach,
|
||||
timeStart, timeExpire, goodsTag);
|
||||
this.tradeType = tradeType.name();
|
||||
this.openId = openId;
|
||||
this.authCode = authCode;
|
||||
this.productId = productId;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user