httpclient bug fixed
This commit is contained in:
parent
01fab155f8
commit
94be61ed66
1
pom.xml
1
pom.xml
@ -206,6 +206,7 @@
|
||||
<include>**/*.pem</include>
|
||||
<include>**/*.p12</include>
|
||||
<include>**/*.pfx</include>
|
||||
<include>**/*.jks</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-all</artifactId>
|
||||
<version>4.0.30.Final</version>
|
||||
<optional>false</optional>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
|
||||
@ -43,7 +43,6 @@ public class SimpleHttpClient extends AbstractHttpClient {
|
||||
URLConnection urlConnection = proxy != null ? uri.toURL()
|
||||
.openConnection(proxy) : uri.toURL().openConnection();
|
||||
if (uri.getScheme().equals("https")) {
|
||||
try {
|
||||
SSLContext sslContext = null;
|
||||
HostnameVerifier hostnameVerifier = null;
|
||||
if (params != null) {
|
||||
@ -60,9 +59,6 @@ public class SimpleHttpClient extends AbstractHttpClient {
|
||||
connection.setSSLSocketFactory(sslContext.getSocketFactory());
|
||||
connection.setHostnameVerifier(hostnameVerifier);
|
||||
return connection;
|
||||
} catch (HttpClientException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
} else {
|
||||
return (HttpURLConnection) urlConnection;
|
||||
}
|
||||
|
||||
@ -11,7 +11,6 @@ import javax.net.ssl.SSLSession;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
|
||||
import com.foxinmy.weixin4j.http.HttpClient;
|
||||
import com.foxinmy.weixin4j.http.HttpClientException;
|
||||
import com.foxinmy.weixin4j.http.HttpParams;
|
||||
import com.foxinmy.weixin4j.http.support.apache3.HttpComponent3Factory;
|
||||
import com.foxinmy.weixin4j.http.support.apache4.HttpComponent4Factory;
|
||||
@ -160,7 +159,7 @@ public abstract class HttpClientFactory {
|
||||
*/
|
||||
public abstract HttpClient newInstance();
|
||||
|
||||
public static SSLContext allowSSLContext() throws HttpClientException {
|
||||
public static SSLContext allowSSLContext() {
|
||||
try {
|
||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||
sslContext.init(null,
|
||||
@ -168,10 +167,10 @@ public abstract class HttpClientFactory {
|
||||
new java.security.SecureRandom());
|
||||
return sslContext;
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new HttpClientException(
|
||||
throw new RuntimeException(
|
||||
"Create SSLContext NoSuchAlgorithmException:", e);
|
||||
} catch (KeyManagementException e) {
|
||||
throw new HttpClientException(
|
||||
throw new RuntimeException(
|
||||
"Create SSLContext KeyManagementException:", e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,16 +25,19 @@ public class HttpComponent3Factory extends HttpClientFactory {
|
||||
private final HttpClient httpClient;
|
||||
|
||||
public HttpComponent3Factory() {
|
||||
this(new HttpClient());
|
||||
httpClient = new HttpClient();
|
||||
httpClient.getParams().setHttpElementCharset(Consts.UTF_8.name());
|
||||
httpClient.getParams().setParameter("http.protocol.uri-charset",
|
||||
Consts.UTF_8.name());
|
||||
// httpMethod.getParams().setUriCharset(Consts.UTF_8.name());
|
||||
httpClient.getParams().setContentCharset(Consts.UTF_8.name());
|
||||
Protocol.registerProtocol("https",
|
||||
new Protocol("https", new SSLProtocolSocketFactory(
|
||||
HttpClientFactory.allowSSLContext()), 443));
|
||||
}
|
||||
|
||||
public HttpComponent3Factory(HttpClient httpClient) {
|
||||
this.httpClient = httpClient;
|
||||
this.httpClient.getParams().setHttpElementCharset(Consts.UTF_8.name());
|
||||
this.httpClient.getParams().setParameter("http.protocol.uri-charset",
|
||||
Consts.UTF_8.name());
|
||||
// httpMethod.getParams().setUriCharset(Consts.UTF_8.name());
|
||||
this.httpClient.getParams().setContentCharset(Consts.UTF_8.name());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -4,7 +4,6 @@ import java.io.IOException;
|
||||
|
||||
import org.apache.commons.httpclient.Header;
|
||||
import org.apache.commons.httpclient.HttpMethod;
|
||||
import org.apache.commons.httpclient.protocol.Protocol;
|
||||
|
||||
import com.foxinmy.weixin4j.http.AbstractHttpResponse;
|
||||
import com.foxinmy.weixin4j.http.HttpHeaders;
|
||||
@ -74,6 +73,6 @@ public class HttpComponent3Response extends AbstractHttpResponse {
|
||||
@Override
|
||||
public void close() {
|
||||
httpMethod.releaseConnection();
|
||||
Protocol.unregisterProtocol("https");
|
||||
//Protocol.unregisterProtocol("https");
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,8 @@ package com.foxinmy.weixin4j.http.support.apache4;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
|
||||
import org.apache.http.HttpHost;
|
||||
import org.apache.http.conn.ClientConnectionManager;
|
||||
import org.apache.http.conn.params.ConnRoutePNames;
|
||||
@ -14,6 +16,7 @@ import org.apache.http.params.CoreConnectionPNames;
|
||||
import org.apache.http.params.CoreProtocolPNames;
|
||||
|
||||
import com.foxinmy.weixin4j.http.HttpClient;
|
||||
import com.foxinmy.weixin4j.http.HttpClientException;
|
||||
import com.foxinmy.weixin4j.http.HttpHeaders;
|
||||
import com.foxinmy.weixin4j.http.HttpParams;
|
||||
import com.foxinmy.weixin4j.http.factory.HttpClientFactory;
|
||||
@ -34,14 +37,33 @@ public class HttpComponent4_1Factory extends HttpClientFactory {
|
||||
|
||||
/**
|
||||
* 默认httpclient
|
||||
* @see <a href="https://issues.apache.org/jira/browse/HTTPCLIENT-1193">HTTPCLIENT-1193</a>
|
||||
*
|
||||
* @see <a
|
||||
* href="https://issues.apache.org/jira/browse/HTTPCLIENT-1193">HTTPCLIENT-1193</a>
|
||||
* @param clientConnectionManager
|
||||
*/
|
||||
public HttpComponent4_1Factory() {
|
||||
PoolingClientConnectionManager clientConnectionManager = new PoolingClientConnectionManager();
|
||||
clientConnectionManager.setMaxTotal(30);
|
||||
clientConnectionManager.setDefaultMaxPerRoute(clientConnectionManager.getMaxTotal());
|
||||
this.httpClient = new DefaultHttpClient(clientConnectionManager);
|
||||
clientConnectionManager.setDefaultMaxPerRoute(clientConnectionManager
|
||||
.getMaxTotal());
|
||||
httpClient = new DefaultHttpClient(clientConnectionManager);
|
||||
httpClient.getParams().setParameter(
|
||||
CoreProtocolPNames.HTTP_CONTENT_CHARSET, Consts.UTF_8);
|
||||
httpClient.getParams().setParameter(
|
||||
CoreProtocolPNames.HTTP_ELEMENT_CHARSET, Consts.UTF_8.name());
|
||||
httpClient.getParams().setParameter(
|
||||
CoreProtocolPNames.STRICT_TRANSFER_ENCODING, Consts.UTF_8);
|
||||
httpClient.getParams().setParameter(HttpHeaders.CONTENT_ENCODING,
|
||||
Consts.UTF_8);
|
||||
httpClient.getParams().setParameter(HttpHeaders.ACCEPT_CHARSET,
|
||||
Consts.UTF_8);
|
||||
SSLSocketFactory socketFactory = new SSLSocketFactory(
|
||||
HttpClientFactory.allowSSLContext());
|
||||
socketFactory
|
||||
.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
|
||||
Scheme scheme = new Scheme("https", socketFactory, 443);
|
||||
httpClient.getConnectionManager().getSchemeRegistry().register(scheme);
|
||||
}
|
||||
|
||||
public HttpComponent4_1Factory(org.apache.http.client.HttpClient httpClient) {
|
||||
@ -61,31 +83,15 @@ public class HttpComponent4_1Factory extends HttpClientFactory {
|
||||
httpClient.getParams().setIntParameter(
|
||||
CoreConnectionPNames.CONNECTION_TIMEOUT,
|
||||
params.getConnectTimeout());
|
||||
httpClient.getParams().setIntParameter(
|
||||
CoreConnectionPNames.SO_TIMEOUT,
|
||||
httpClient.getParams().setIntParameter(CoreConnectionPNames.SO_TIMEOUT,
|
||||
params.getReadTimeout());
|
||||
httpClient.getParams().setParameter(
|
||||
CoreProtocolPNames.HTTP_CONTENT_CHARSET, Consts.UTF_8);
|
||||
httpClient.getParams().setParameter(
|
||||
CoreProtocolPNames.HTTP_ELEMENT_CHARSET, Consts.UTF_8.name());
|
||||
httpClient.getParams().setParameter(
|
||||
CoreProtocolPNames.STRICT_TRANSFER_ENCODING, Consts.UTF_8);
|
||||
httpClient.getParams().setParameter(HttpHeaders.CONTENT_ENCODING,
|
||||
Consts.UTF_8);
|
||||
httpClient.getParams().setParameter(HttpHeaders.ACCEPT_CHARSET,
|
||||
Consts.UTF_8);
|
||||
if (params.getSSLContext() != null) {
|
||||
X509HostnameVerifier hostnameVerifier = null;
|
||||
if (params.getHostnameVerifier() != null) {
|
||||
hostnameVerifier = new CustomHostnameVerifier(
|
||||
params.getHostnameVerifier());
|
||||
}
|
||||
if (hostnameVerifier == null) {
|
||||
hostnameVerifier = SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER;
|
||||
}
|
||||
SSLSocketFactory socketFactory = new SSLSocketFactory(
|
||||
params.getSSLContext());
|
||||
socketFactory.setHostnameVerifier(hostnameVerifier);
|
||||
if (params.getHostnameVerifier() != null) {
|
||||
socketFactory.setHostnameVerifier(new CustomHostnameVerifier(
|
||||
params.getHostnameVerifier()));
|
||||
}
|
||||
Scheme scheme = new Scheme("https", socketFactory, 443);
|
||||
httpClient.getConnectionManager().getSchemeRegistry()
|
||||
.register(scheme);
|
||||
|
||||
@ -9,7 +9,6 @@ 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.HttpClientBuilder;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.protocol.HttpProcessor;
|
||||
@ -33,8 +32,13 @@ public class HttpComponent4_2Factory extends HttpClientFactory {
|
||||
private final HttpClientBuilder clientBuilder;
|
||||
|
||||
public HttpComponent4_2Factory() {
|
||||
this(HttpClients.custom().setDefaultConnectionConfig(
|
||||
ConnectionConfig.custom().setCharset(Consts.UTF_8).build()));
|
||||
clientBuilder = HttpClients.custom().setDefaultConnectionConfig(
|
||||
ConnectionConfig.custom().setCharset(Consts.UTF_8).build());
|
||||
clientBuilder
|
||||
.setHostnameVerifier(SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
|
||||
clientBuilder.setSSLSocketFactory(new SSLConnectionSocketFactory(
|
||||
HttpClientFactory.allowSSLContext(),
|
||||
SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER));
|
||||
}
|
||||
|
||||
public HttpComponent4_2Factory(HttpClientBuilder clientBuilder) {
|
||||
@ -54,16 +58,16 @@ public class HttpComponent4_2Factory extends HttpClientFactory {
|
||||
clientBuilder.setProxy(proxy);
|
||||
}
|
||||
if (params.getSSLContext() != null) {
|
||||
X509HostnameVerifier hostnameVerifier;
|
||||
if (params.getHostnameVerifier() != null) {
|
||||
hostnameVerifier = new CustomHostnameVerifier(
|
||||
params.getHostnameVerifier());
|
||||
} else {
|
||||
hostnameVerifier = SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER;
|
||||
clientBuilder
|
||||
.setSSLSocketFactory(new SSLConnectionSocketFactory(
|
||||
params.getSSLContext(),
|
||||
params.getHostnameVerifier() != null ? new CustomHostnameVerifier(
|
||||
params.getHostnameVerifier())
|
||||
: SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER));
|
||||
}
|
||||
clientBuilder.setHostnameVerifier(hostnameVerifier);
|
||||
clientBuilder.setSSLSocketFactory(new SSLConnectionSocketFactory(
|
||||
params.getSSLContext(), hostnameVerifier));
|
||||
if (params.getHostnameVerifier() != null) {
|
||||
clientBuilder.setHostnameVerifier(new CustomHostnameVerifier(params
|
||||
.getHostnameVerifier()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -24,7 +24,11 @@ public class OkHttpClient2Factory extends HttpClientFactory {
|
||||
private final OkHttpClient okClient;
|
||||
|
||||
public OkHttpClient2Factory() {
|
||||
this(new OkHttpClient());
|
||||
okClient = new OkHttpClient();
|
||||
okClient.setHostnameVerifier(HttpClientFactory.AllowHostnameVerifier.GLOBAL);
|
||||
okClient.setSslSocketFactory(HttpClientFactory.allowSSLContext()
|
||||
.getSocketFactory());
|
||||
|
||||
}
|
||||
|
||||
public OkHttpClient2Factory(OkHttpClient okClient) {
|
||||
@ -39,13 +43,13 @@ public class OkHttpClient2Factory extends HttpClientFactory {
|
||||
if (params.getProxy() != null) {
|
||||
okClient.setProxy(params.getProxy());
|
||||
}
|
||||
if (params.getHostnameVerifier() != null) {
|
||||
okClient.setHostnameVerifier(params.getHostnameVerifier());
|
||||
}
|
||||
if (params.getSSLContext() != null) {
|
||||
okClient.setSslSocketFactory(params.getSSLContext()
|
||||
.getSocketFactory());
|
||||
}
|
||||
if (params.getHostnameVerifier() != null) {
|
||||
okClient.setHostnameVerifier(params.getHostnameVerifier());
|
||||
}
|
||||
}
|
||||
|
||||
public OkHttpClient2Factory setWriteTimeout(int writeTimeout) {
|
||||
|
||||
@ -27,7 +27,12 @@ public class OkHttpClient3Factory extends HttpClientFactory {
|
||||
private final OkHttpClient.Builder clientBuilder;
|
||||
|
||||
public OkHttpClient3Factory() {
|
||||
this(new OkHttpClient.Builder());
|
||||
clientBuilder = new OkHttpClient.Builder();
|
||||
clientBuilder
|
||||
.hostnameVerifier(HttpClientFactory.AllowHostnameVerifier.GLOBAL);
|
||||
clientBuilder.sslSocketFactory(HttpClientFactory.allowSSLContext()
|
||||
.getSocketFactory(),
|
||||
HttpClientFactory.AllowX509TrustManager.GLOBAL);
|
||||
}
|
||||
|
||||
public OkHttpClient3Factory(OkHttpClient.Builder clientBuilder) {
|
||||
@ -47,14 +52,14 @@ public class OkHttpClient3Factory extends HttpClientFactory {
|
||||
if (params.getProxy() != null) {
|
||||
clientBuilder.proxy(params.getProxy());
|
||||
}
|
||||
if (params.getHostnameVerifier() != null) {
|
||||
clientBuilder.hostnameVerifier(params.getHostnameVerifier());
|
||||
}
|
||||
if (params.getSSLContext() != null) {
|
||||
clientBuilder.sslSocketFactory(params.getSSLContext()
|
||||
.getSocketFactory(),
|
||||
HttpClientFactory.AllowX509TrustManager.GLOBAL);
|
||||
}
|
||||
if (params.getHostnameVerifier() != null) {
|
||||
clientBuilder.hostnameVerifier(params.getHostnameVerifier());
|
||||
}
|
||||
}
|
||||
|
||||
public OkHttpClient3Factory setWriteTimeout(int writeTimeout) {
|
||||
@ -101,7 +106,7 @@ public class OkHttpClient3Factory extends HttpClientFactory {
|
||||
@Override
|
||||
public HttpClient newInstance() {
|
||||
if (okClient == null) {
|
||||
this.okClient = clientBuilder.build();
|
||||
okClient = clientBuilder.build();
|
||||
}
|
||||
return new OkHttpClient3(okClient);
|
||||
}
|
||||
|
||||
@ -16,10 +16,10 @@ public class OkHttpClientFactory extends HttpClientFactory {
|
||||
private static HttpClientFactory okHttpClientFactory;
|
||||
static {
|
||||
try {
|
||||
okHttpClientFactory = new OkHttpClient2Factory();
|
||||
okHttpClientFactory = new OkHttpClient3Factory();
|
||||
} catch (Throwable e1) {
|
||||
try {
|
||||
okHttpClientFactory = new OkHttpClient3Factory();
|
||||
okHttpClientFactory = new OkHttpClient2Factory();
|
||||
} catch (Throwable e2) {
|
||||
throw new RuntimeException(e2);
|
||||
}
|
||||
|
||||
@ -43,15 +43,14 @@ public abstract class HttpClientTest {
|
||||
return createHttpClient(params);
|
||||
}
|
||||
|
||||
protected HttpClient createSSLHttpClient() throws HttpClientException {
|
||||
protected HttpClient createSSLHttpClient() {
|
||||
HttpParams params = new HttpParams();
|
||||
params.setHostnameVerifier(HttpClientFactory.AllowHostnameVerifier.GLOBAL);
|
||||
params.setSSLContext(HttpClientFactory.allowSSLContext());
|
||||
return createHttpClient(params);
|
||||
}
|
||||
|
||||
protected HttpClient createProxyAndSSLHttpClient()
|
||||
throws HttpClientException {
|
||||
protected HttpClient createProxyAndSSLHttpClient() {
|
||||
HttpParams params = new HttpParams();
|
||||
params.setHostnameVerifier(HttpClientFactory.AllowHostnameVerifier.GLOBAL);
|
||||
params.setSSLContext(HttpClientFactory.allowSSLContext());
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-all</artifactId>
|
||||
<version>4.0.23.Final</version>
|
||||
<version>4.1.8.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
|
||||
@ -181,15 +181,25 @@ public class WeixinRequest implements HttpMessage {
|
||||
return headers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DecoderResult decoderResult() {
|
||||
return decoderResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpVersion protocolVersion() {
|
||||
return protocolVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WeixinRequest [headers=" + headers.entries() + ", method=" + method
|
||||
+ ", uri=" + uri + ", echoStr=" + echoStr + ", timeStamp="
|
||||
+ timeStamp + ", nonce=" + nonce + ", signature=" + signature
|
||||
+ ", msgSignature=" + msgSignature + ", encryptType="
|
||||
+ encryptType + ", originalContent=" + originalContent
|
||||
+ ", encryptContent=" + encryptContent + ", aesToken="
|
||||
+ aesToken + ", decoderResult=" + decoderResult
|
||||
return "WeixinRequest [headers=" + headers.entries() + ", method="
|
||||
+ method + ", uri=" + uri + ", echoStr=" + echoStr
|
||||
+ ", timeStamp=" + timeStamp + ", nonce=" + nonce
|
||||
+ ", signature=" + signature + ", msgSignature=" + msgSignature
|
||||
+ ", encryptType=" + encryptType + ", originalContent="
|
||||
+ originalContent + ", encryptContent=" + encryptContent
|
||||
+ ", aesToken=" + aesToken + ", decoderResult=" + decoderResult
|
||||
+ ", protocolVersion=" + protocolVersion + "]";
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,10 +60,10 @@ public class WeixinMessageDecoder extends
|
||||
protected void decode(ChannelHandlerContext ctx, FullHttpRequest req,
|
||||
List<Object> out) throws WeixinException {
|
||||
String messageContent = req.content().toString(ServerToolkits.UTF_8);
|
||||
QueryStringDecoder queryDecoder = new QueryStringDecoder(req.getUri(),
|
||||
QueryStringDecoder queryDecoder = new QueryStringDecoder(req.uri(),
|
||||
true);
|
||||
HttpMethod method = req.getMethod();
|
||||
logger.info("decode request:{} use {} method invoking", req.getUri(),
|
||||
HttpMethod method = req.method();
|
||||
logger.info("decode request:{} use {} method invoking", req.uri(),
|
||||
method);
|
||||
Map<String, List<String>> parameters = queryDecoder.parameters();
|
||||
EncryptType encryptType = parameters.containsKey("encrypt_type") ? EncryptType
|
||||
@ -104,11 +104,11 @@ public class WeixinMessageDecoder extends
|
||||
}
|
||||
logger.info("read original message {}", messageContent);
|
||||
WeixinRequest request = new WeixinRequest(req.headers(), method,
|
||||
req.getUri(), encryptType, echoStr, timeStamp, nonce,
|
||||
req.uri(), encryptType, echoStr, timeStamp, nonce,
|
||||
signature, msgSignature, messageContent, encryptContent,
|
||||
aesToken);
|
||||
request.setDecoderResult(req.getDecoderResult());
|
||||
request.setProtocolVersion(req.getProtocolVersion());
|
||||
request.setDecoderResult(req.decoderResult());
|
||||
request.setProtocolVersion(req.protocolVersion());
|
||||
out.add(request);
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ public class WeixinRequestHandler extends
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
||||
ctx.close();
|
||||
logger.error("catch the exception:", cause);
|
||||
logger.error(cause);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -23,8 +23,7 @@ import com.foxinmy.weixin4j.util.AesToken;
|
||||
public class WeixinServerInitializer extends ChannelInitializer<SocketChannel> {
|
||||
|
||||
private final WeixinMessageDispatcher messageDispatcher;
|
||||
|
||||
private WeixinMessageDecoder messageDecoder;
|
||||
private final WeixinMessageDecoder messageDecoder;
|
||||
|
||||
public WeixinServerInitializer(Map<String, AesToken> aesTokenMap,
|
||||
WeixinMessageDispatcher messageDispatcher) {
|
||||
|
||||
@ -79,7 +79,7 @@ public final class WeixinServerBootstrap {
|
||||
*/
|
||||
private final Map<String, AesToken> aesTokenMap;
|
||||
|
||||
WeixinServerInitializer wechatInitializer;
|
||||
private WeixinServerInitializer wechatInitializer;
|
||||
|
||||
static {
|
||||
DEFAULT_BOSSTHREADS = Runtime.getRuntime().availableProcessors();
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
package com.foxinmy.weixin4j.util;
|
||||
|
||||
import static io.netty.handler.codec.http.HttpHeaders.Names.CONTENT_LENGTH;
|
||||
import static io.netty.handler.codec.http.HttpHeaders.Names.CONTENT_TYPE;
|
||||
import static io.netty.handler.codec.http.HttpHeaders.Names.DATE;
|
||||
import static io.netty.handler.codec.http.HttpHeaders.Names.USER_AGENT;
|
||||
import static io.netty.handler.codec.http.HttpHeaderNames.CONTENT_LENGTH;
|
||||
import static io.netty.handler.codec.http.HttpHeaderNames.CONTENT_TYPE;
|
||||
import static io.netty.handler.codec.http.HttpHeaderNames.DATE;
|
||||
import static io.netty.handler.codec.http.HttpHeaderNames.USER_AGENT;
|
||||
import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.netty.handler.codec.http.DefaultFullHttpResponse;
|
||||
|
||||
@ -27,7 +27,7 @@ import com.foxinmy.weixin4j.util.ServerToolkits;
|
||||
*/
|
||||
public class MessagePush {
|
||||
|
||||
private final String server = "http://localhost:30000";
|
||||
private final String server = "https://localhost:30000";
|
||||
private final HttpClient httpClient;
|
||||
private final HttpPost httpPost;
|
||||
private final HttpGet httpGet;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user