weixin4j-server:去掉SLF4J-API依赖 & released 1.0.0!
This commit is contained in:
parent
8557633b23
commit
bd66465510
@ -288,3 +288,7 @@
|
||||
* 2015-05-16
|
||||
|
||||
+ **weixin4j-server**: 实现消息处理器的泛型自动匹配
|
||||
|
||||
+ **weixin4j-server**: 去掉SLF4J-API依赖
|
||||
|
||||
+ **weixin4j-server**: released 1.0.0!
|
||||
@ -41,7 +41,7 @@ weixin4j
|
||||
<artifactId>weixin4j-qy</artifactId>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
微信被动消息服务器(本周内部署到中央库)
|
||||
微信被动消息服务器
|
||||
|
||||
<dependency>
|
||||
<groupId>com.foxinmy</groupId>
|
||||
|
||||
@ -36,4 +36,8 @@
|
||||
|
||||
* 2015-05-16
|
||||
|
||||
+ 实现消息处理器的泛型自动匹配
|
||||
+ 实现消息处理器的泛型自动匹配
|
||||
|
||||
+ 去掉SLF4J-API依赖
|
||||
|
||||
+ released 1.0.0!
|
||||
@ -185,11 +185,6 @@
|
||||
<artifactId>netty-all</artifactId>
|
||||
<version>4.0.23.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
package com.foxinmy.weixin4j.dispatcher;
|
||||
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import io.netty.util.internal.logging.InternalLogger;
|
||||
import io.netty.util.internal.logging.InternalLoggerFactory;
|
||||
|
||||
import com.foxinmy.weixin4j.exception.WeixinException;
|
||||
import com.foxinmy.weixin4j.handler.WeixinMessageHandler;
|
||||
@ -22,7 +21,7 @@ import com.foxinmy.weixin4j.response.WeixinResponse;
|
||||
*/
|
||||
public class MessageHandlerExecutor {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(getClass());
|
||||
private final InternalLogger logger = InternalLoggerFactory.getInstance(getClass());
|
||||
/**
|
||||
* 消息处理器
|
||||
*/
|
||||
|
||||
@ -3,6 +3,8 @@ package com.foxinmy.weixin4j.dispatcher;
|
||||
import static io.netty.handler.codec.http.HttpResponseStatus.NOT_FOUND;
|
||||
import io.netty.channel.ChannelFutureListener;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.util.internal.logging.InternalLogger;
|
||||
import io.netty.util.internal.logging.InternalLoggerFactory;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.lang.reflect.Constructor;
|
||||
@ -21,9 +23,6 @@ import javax.xml.bind.Unmarshaller;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.foxinmy.weixin4j.bean.BeanFactory;
|
||||
import com.foxinmy.weixin4j.exception.WeixinException;
|
||||
import com.foxinmy.weixin4j.handler.MessageHandlerAdapter;
|
||||
@ -47,7 +46,8 @@ import com.foxinmy.weixin4j.util.ReflectionUtil;
|
||||
*/
|
||||
public class WeixinMessageDispatcher {
|
||||
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
private final InternalLogger logger = InternalLoggerFactory
|
||||
.getInstance(getClass());
|
||||
|
||||
/**
|
||||
* 消息处理器
|
||||
@ -110,7 +110,7 @@ public class WeixinMessageDispatcher {
|
||||
try {
|
||||
WeixinResponse response = handlerExecutor.getMessageHandler()
|
||||
.doHandle(request, message);
|
||||
log.info(
|
||||
logger.info(
|
||||
"\n=================message response=================\n{}",
|
||||
response);
|
||||
handlerExecutor.applyPostHandle(request, response, message);
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
package com.foxinmy.weixin4j.dispatcher;
|
||||
|
||||
import io.netty.util.internal.logging.InternalLogger;
|
||||
import io.netty.util.internal.logging.InternalLoggerFactory;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.foxinmy.weixin4j.message.ImageMessage;
|
||||
import com.foxinmy.weixin4j.message.LocationMessage;
|
||||
import com.foxinmy.weixin4j.message.TextMessage;
|
||||
@ -25,7 +25,7 @@ import com.foxinmy.weixin4j.type.MessageType;
|
||||
|
||||
public class WeixinMessageMatcher {
|
||||
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
private final InternalLogger logger = InternalLoggerFactory.getInstance(getClass());
|
||||
|
||||
public static final String MESSAGEKEY_MP_TAG = "mp";
|
||||
public static final String MESSAGEKEY_SEPARATOR = ":";
|
||||
@ -45,7 +45,7 @@ public class WeixinMessageMatcher {
|
||||
init1();
|
||||
init2();
|
||||
init3();
|
||||
log.info("detected message for events: {}", key2ClassMap.keySet());
|
||||
logger.info("detected message for events: {}", key2ClassMap.keySet());
|
||||
}
|
||||
|
||||
private void init0() {
|
||||
|
||||
@ -4,13 +4,12 @@ import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.handler.codec.MessageToMessageDecoder;
|
||||
import io.netty.handler.codec.http.FullHttpRequest;
|
||||
import io.netty.handler.codec.http.QueryStringDecoder;
|
||||
import io.netty.util.internal.logging.InternalLogger;
|
||||
import io.netty.util.internal.logging.InternalLoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.foxinmy.weixin4j.bean.AesToken;
|
||||
import com.foxinmy.weixin4j.exception.WeixinException;
|
||||
import com.foxinmy.weixin4j.request.WeixinRequest;
|
||||
@ -32,7 +31,8 @@ import com.foxinmy.weixin4j.xml.EncryptMessageHandler;
|
||||
*/
|
||||
public class WeixinMessageDecoder extends
|
||||
MessageToMessageDecoder<FullHttpRequest> {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
private final InternalLogger logger = InternalLoggerFactory
|
||||
.getInstance(getClass());
|
||||
|
||||
private AesToken aesToken;
|
||||
|
||||
@ -46,10 +46,10 @@ public class WeixinMessageDecoder extends
|
||||
String content = req.content().toString(Consts.UTF_8);
|
||||
QueryStringDecoder queryDecoder = new QueryStringDecoder(req.getUri(),
|
||||
true);
|
||||
log.info("\n=================receive request=================");
|
||||
log.info("{}", req.getMethod());
|
||||
log.info("{}", req.getUri());
|
||||
log.info("{}", content);
|
||||
logger.info("\n=================receive request=================");
|
||||
logger.info("{}", req.getMethod());
|
||||
logger.info("{}", req.getUri());
|
||||
logger.info("{}", content);
|
||||
Map<String, List<String>> parameters = queryDecoder.parameters();
|
||||
EncryptType encryptType = parameters.containsKey("encrypt_type") ? EncryptType
|
||||
.valueOf(parameters.get("encrypt_type").get(0).toUpperCase())
|
||||
|
||||
@ -7,9 +7,8 @@ import io.netty.channel.ChannelFutureListener;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.SimpleChannelInboundHandler;
|
||||
import io.netty.handler.codec.http.HttpMethod;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import io.netty.util.internal.logging.InternalLogger;
|
||||
import io.netty.util.internal.logging.InternalLoggerFactory;
|
||||
|
||||
import com.foxinmy.weixin4j.bean.AesToken;
|
||||
import com.foxinmy.weixin4j.dispatcher.WeixinMessageDispatcher;
|
||||
@ -33,8 +32,8 @@ import com.foxinmy.weixin4j.xml.CruxMessageHandler;
|
||||
*/
|
||||
public class WeixinRequestHandler extends
|
||||
SimpleChannelInboundHandler<WeixinRequest> {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
|
||||
private final InternalLogger logger = InternalLoggerFactory
|
||||
.getInstance(getClass());
|
||||
private final AesToken aesToken;
|
||||
private final WeixinMessageDispatcher messageDispatcher;
|
||||
|
||||
@ -51,13 +50,13 @@ public class WeixinRequestHandler extends
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
||||
ctx.close();
|
||||
log.error("catch the exception:{}", cause.getMessage());
|
||||
logger.error("catch the exception:{}", cause.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void channelRead0(ChannelHandlerContext ctx, WeixinRequest request)
|
||||
throws WeixinException {
|
||||
log.info("\n=================message request=================\n{}",
|
||||
logger.info("\n=================message request=================\n{}",
|
||||
request);
|
||||
if (request.getMethod().equals(HttpMethod.GET.name())) {
|
||||
if (MessageUtil.signature(aesToken.getToken(),
|
||||
|
||||
@ -3,12 +3,11 @@ package com.foxinmy.weixin4j.socket;
|
||||
import static io.netty.handler.codec.http.HttpResponseStatus.OK;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.handler.codec.MessageToMessageEncoder;
|
||||
import io.netty.util.internal.logging.InternalLogger;
|
||||
import io.netty.util.internal.logging.InternalLoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.foxinmy.weixin4j.bean.AesToken;
|
||||
import com.foxinmy.weixin4j.exception.WeixinException;
|
||||
import com.foxinmy.weixin4j.response.BlankResponse;
|
||||
@ -33,7 +32,8 @@ import com.foxinmy.weixin4j.util.StringUtil;
|
||||
public class WeixinResponseEncoder extends
|
||||
MessageToMessageEncoder<WeixinResponse> {
|
||||
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
private final InternalLogger logger = InternalLoggerFactory
|
||||
.getInstance(getClass());
|
||||
|
||||
private final AesToken aesToken;
|
||||
|
||||
@ -93,7 +93,7 @@ public class WeixinResponseEncoder extends
|
||||
}
|
||||
ctx.writeAndFlush(HttpUtil.createHttpResponse(content.toString(), OK,
|
||||
Consts.CONTENTTYPE$APPLICATION_XML));
|
||||
log.info("\n=================response message=================");
|
||||
log.info("{}", content);
|
||||
logger.info("\n=================response message=================");
|
||||
logger.info("{}", content);
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user