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