Class HelloMessageHandler

  • All Implemented Interfaces:
    com.foxinmy.weixin4j.handler.WeixinMessageHandler

    @Component
    public class HelloMessageHandler
    extends TextMessageHandler
    输入 hello 回复 world
    Since:
    JDK 1.6
    Author:
    jinyu(foxinmy@gmail.com)
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean canHandle0​(com.foxinmy.weixin4j.request.WeixinRequest request, com.foxinmy.weixin4j.message.TextMessage message)  
      com.foxinmy.weixin4j.response.WeixinResponse doHandle0​(com.foxinmy.weixin4j.message.TextMessage message)  
      int weight()
      因为HelloMessageHandler和TextMessageHandler都会匹配到文本消息 所以这里需要提高下权重(大于TextMessageHandler就行了) > TextMessageHandler
      • Methods inherited from class com.foxinmy.weixin4j.handler.MessageHandlerAdapter

        canHandle, doHandle
    • Constructor Detail

      • HelloMessageHandler

        public HelloMessageHandler()
    • Method Detail

      • canHandle0

        public boolean canHandle0​(com.foxinmy.weixin4j.request.WeixinRequest request,
                                  com.foxinmy.weixin4j.message.TextMessage message)
        Overrides:
        canHandle0 in class com.foxinmy.weixin4j.handler.MessageHandlerAdapter<com.foxinmy.weixin4j.message.TextMessage>
      • doHandle0

        public com.foxinmy.weixin4j.response.WeixinResponse doHandle0​(com.foxinmy.weixin4j.message.TextMessage message)
        Overrides:
        doHandle0 in class TextMessageHandler
      • weight

        public int weight()
        因为HelloMessageHandler和TextMessageHandler都会匹配到文本消息 所以这里需要提高下权重(大于TextMessageHandler就行了) > TextMessageHandler
        Specified by:
        weight in interface com.foxinmy.weixin4j.handler.WeixinMessageHandler
        Overrides:
        weight in class com.foxinmy.weixin4j.handler.MessageHandlerAdapter<com.foxinmy.weixin4j.message.TextMessage>