This commit is contained in:
jinyu 2016-04-12 00:37:05 +08:00
parent ed0c7161cf
commit 5b7ed61713
3 changed files with 6 additions and 5 deletions

View File

@ -36,7 +36,8 @@ public class HelloMessageHandler extends MessageHandlerAdapter<TextMessage> {
} }
/** /**
* 提高权重 > TextMessageHandler * 因为HelloMessageHandler和TextMessageHandler都会匹配到文本消息
* 所以这里需要提高下权重(大于TextMessageHandler就行了) > TextMessageHandler
*/ */
@Override @Override
public int weight() { public int weight() {

View File

@ -179,7 +179,7 @@ public class WeixinMessageDispatcher {
*/ */
protected void noHandlerFound(ChannelHandlerContext context, protected void noHandlerFound(ChannelHandlerContext context,
WeixinRequest request, Object message) { WeixinRequest request, Object message) {
logger.warn("no handler found {}", request); logger.warn("no handler found for {}", request);
if (alwaysResponse) { if (alwaysResponse) {
context.write(BlankResponse.global); context.write(BlankResponse.global);
} else { } else {

View File

@ -9,13 +9,13 @@ import com.foxinmy.weixin4j.response.WeixinResponse;
import com.foxinmy.weixin4j.util.ClassUtil; import com.foxinmy.weixin4j.util.ClassUtil;
/** /**
* 消息适配器 * 消息适配器:对于特定的消息类型进行适配,如text文本voice语音消息
* *
* @className MessageHandlerAdapter * @className MessageHandlerAdapter
* @author jy * @author jy
* @date 2015年5月17日 * @date 2015年5月17日
* @since JDK 1.6 * @since JDK 1.6
* @see * @see com.foxinmy.weixin4j.request.WeixinMessage
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public abstract class MessageHandlerAdapter<M extends WeixinMessage> implements public abstract class MessageHandlerAdapter<M extends WeixinMessage> implements
@ -64,7 +64,7 @@ public abstract class MessageHandlerAdapter<M extends WeixinMessage> implements
throws WeixinException; throws WeixinException;
/** /**
* 存在多个匹配到的MessageHandler则比较 * 缺省值为1,存在多个匹配到的MessageHandler则比较weight大小
*/ */
@Override @Override
public int weight() { public int weight() {