Package com.qq.weixin.sdk.message.handler

Source Code of com.qq.weixin.sdk.message.handler.MessageHandlerEvent

package com.qq.weixin.sdk.message.handler;

import org.w3c.dom.Element;

import com.qq.weixin.sdk.message.Message;
import com.qq.weixin.sdk.message.MessageEvent;
import com.qq.weixin.sdk.message.filter.FilterChain;
import com.qq.weixin.sdk.message.filter.FilterDefaultResult;
import com.qq.weixin.sdk.message.filter.FilterGreeting;

/**
* handle event message
*
* @author hujiawei
*
*/
public class MessageHandlerEvent extends MessageHandlerHelper {

  @Override
  public Message handleSpecialMessage(Message message) {
    FilterChain filterChain = new FilterChain();
    filterChain.addFilter(new FilterGreeting());// I do not check if it is "subscribe"
    filterChain.addFilter(new FilterDefaultResult());// add this,so the next line does not have to verify whether result is null or not
    return filterChain.doFilterChain(message);
  }

  @Override
  protected void parseSpecialMessage(Message message, Element root) {
    MessageEvent messageEvent = (MessageEvent) message;
    messageEvent.setEvent(root.getElementsByTagName(TAG_EVENT).item(0).getTextContent());
    messageEvent.setEventKey(root.getElementsByTagName(TAG_EVENTKEY).item(0).getTextContent());
  }

}
TOP

Related Classes of com.qq.weixin.sdk.message.handler.MessageHandlerEvent

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.