🎨 优化代码,恢复误删除代码

This commit is contained in:
Binary Wang 2021-07-20 10:32:10 +08:00
parent 1b48399501
commit e53733b842
2 changed files with 22 additions and 13 deletions

View File

@ -36,19 +36,16 @@ public class WxCryptUtil {
private static final Base64 BASE64 = new Base64(); private static final Base64 BASE64 = new Base64();
private static final Charset CHARSET = StandardCharsets.UTF_8; private static final Charset CHARSET = StandardCharsets.UTF_8;
private static final ThreadLocal<DocumentBuilder> BUILDER_LOCAL = new ThreadLocal<DocumentBuilder>() { private static final ThreadLocal<DocumentBuilder> BUILDER_LOCAL = ThreadLocal.withInitial(() -> {
@Override try {
protected DocumentBuilder initialValue() { final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try { factory.setExpandEntityReferences(false);
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
factory.setExpandEntityReferences(false); return factory.newDocumentBuilder();
factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); } catch (ParserConfigurationException exc) {
return factory.newDocumentBuilder(); throw new IllegalArgumentException(exc);
} catch (ParserConfigurationException exc) {
throw new IllegalArgumentException(exc);
}
} }
}; });
protected byte[] aesKey; protected byte[] aesKey;
protected String token; protected String token;
@ -67,7 +64,7 @@ public class WxCryptUtil {
public WxCryptUtil(String token, String encodingAesKey, String appidOrCorpid) { public WxCryptUtil(String token, String encodingAesKey, String appidOrCorpid) {
this.token = token; this.token = token;
this.appidOrCorpid = appidOrCorpid; this.appidOrCorpid = appidOrCorpid;
this.aesKey = BaseEncoding.base64().decode(CharMatcher.whitespace().removeFrom(encodingAesKey)); this.aesKey = Base64.decodeBase64(CharMatcher.whitespace().removeFrom(encodingAesKey));
} }
private static String extractEncryptPart(String xml) { private static String extractEncryptPart(String xml) {

View File

@ -0,0 +1,12 @@
package me.chanjar.weixin.cp.tp.service.impl;
/**
* <pre>
* 默认接口实现类使用apache httpclient实现
* Created by zhenjun cai.
* </pre>
*
* @author zhenjun cai
*/
public class WxCpTpServiceImpl extends WxCpTpServiceApacheHttpClientImpl {
}