更新注释

This commit is contained in:
jinyu 2015-06-05 10:49:34 +08:00
parent 79d3a6bec7
commit b273c59186
4 changed files with 10 additions and 9 deletions

View File

@ -117,11 +117,11 @@ public class WeixinMessageDispatcher {
* @throws WeixinException * @throws WeixinException
*/ */
public void doDispatch(final ChannelHandlerContext context, public void doDispatch(final ChannelHandlerContext context,
final WeixinRequest request, final CruxMessageHandler messageHandler) final WeixinRequest request, final CruxMessageHandler cruxMessage)
throws WeixinException { throws WeixinException {
String messageKey = messageKeyDefiner.defineMessageKey( String messageKey = messageKeyDefiner.defineMessageKey(
messageHandler.getMsgType(), messageHandler.getEventType(), cruxMessage.getMsgType(), cruxMessage.getEventType(),
messageHandler.getAccountType()); cruxMessage.getAccountType());
Class<?> targetClass = messageMatcher.find(messageKey); Class<?> targetClass = messageMatcher.find(messageKey);
Object message = request.getOriginalContent(); Object message = request.getOriginalContent();
if (targetClass != null) { if (targetClass != null) {

View File

@ -26,7 +26,7 @@ import com.foxinmy.weixin4j.type.EventType;
import com.foxinmy.weixin4j.type.MessageType; import com.foxinmy.weixin4j.type.MessageType;
/** /**
* 微信消息匹配 * 微信消息匹配(不够优雅,待改进)
* *
* @className WeixinMessageMatcher * @className WeixinMessageMatcher
* @author jy * @author jy

View File

@ -96,16 +96,16 @@ public class WeixinRequestHandler extends
.addListener(ChannelFutureListener.CLOSE); .addListener(ChannelFutureListener.CLOSE);
return; return;
} }
CruxMessageHandler messageHandler = CruxMessageHandler.parser(request CruxMessageHandler cruxMessage = CruxMessageHandler.parser(request
.getOriginalContent()); .getOriginalContent());
ctx.channel().attr(Consts.ENCRYPTTYPE_KEY) ctx.channel().attr(Consts.ENCRYPTTYPE_KEY)
.set(request.getEncryptType()); .set(request.getEncryptType());
ctx.channel().attr(Consts.USEROPENID_KEY) ctx.channel().attr(Consts.USEROPENID_KEY)
.set(messageHandler.getFromUserName()); .set(cruxMessage.getFromUserName());
if (StringUtil.isBlank(aesToken.getAppid())) { if (StringUtil.isBlank(aesToken.getAppid())) {
ctx.channel().attr(Consts.ACCOUNTOPENID_KEY) ctx.channel().attr(Consts.ACCOUNTOPENID_KEY)
.set(messageHandler.getToUserName()); .set(cruxMessage.getToUserName());
} }
messageDispatcher.doDispatch(ctx, request, messageHandler); messageDispatcher.doDispatch(ctx, request, cruxMessage);
} }
} }

View File

@ -32,6 +32,7 @@ import com.foxinmy.weixin4j.util.AesToken;
* @author jy * @author jy
* @date 2014年10月12日 * @date 2014年10月12日
* @since JDK 1.7 * @since JDK 1.7
* @see com.foxinmy.weixin4j.messagekey.WeixinMessageKeyDefiner
* @see com.foxinmy.weixin4j.handler.WeixinMessageHandler * @see com.foxinmy.weixin4j.handler.WeixinMessageHandler
* @see com.foxinmy.weixin4j.interceptor.WeixinMessageInterceptor * @see com.foxinmy.weixin4j.interceptor.WeixinMessageInterceptor
* @see com.foxinmy.weixin4j.dispatcher.WeixinMessageDispatcher * @see com.foxinmy.weixin4j.dispatcher.WeixinMessageDispatcher
@ -51,7 +52,7 @@ public final class WeixinServerBootstrap {
*/ */
public final static int DEFAULT_WORKERTHREADS = 20; public final static int DEFAULT_WORKERTHREADS = 20;
/** /**
* 默认服务启动端口 * 服务启动的默认端口
*/ */
public final static int DEFAULT_SERVERPORT = 30000; public final static int DEFAULT_SERVERPORT = 30000;
/** /**