Class HelloMessageHandler
- java.lang.Object
-
- com.foxinmy.weixin4j.handler.MessageHandlerAdapter<TextMessage>
-
- com.foxinmy.weixin4j.example.server.handler.TextMessageHandler
-
- com.foxinmy.weixin4j.example.server.handler.HelloMessageHandler
-
- All Implemented Interfaces:
WeixinMessageHandler
@Component public class HelloMessageHandler extends TextMessageHandler
输入 hello 回复 world- Since:
- JDK 1.6
- Author:
- jinyu(foxinmy@gmail.com)
-
-
Constructor Summary
Constructors Constructor Description HelloMessageHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canHandle0(WeixinRequest request, TextMessage message)
能否处理请求WeixinResponse
doHandle0(TextMessage message)
处理请求int
weight()
因为HelloMessageHandler和TextMessageHandler都会匹配到文本消息 所以这里需要提高下权重(大于TextMessageHandler就行了) > TextMessageHandler-
Methods inherited from class com.foxinmy.weixin4j.handler.MessageHandlerAdapter
canHandle, doHandle
-
-
-
-
Method Detail
-
canHandle0
public boolean canHandle0(WeixinRequest request, TextMessage message)
Description copied from class:MessageHandlerAdapter
能否处理请求- Overrides:
canHandle0
in classMessageHandlerAdapter<TextMessage>
- Parameters:
request
- 微信请求message
- 微信消息- Returns:
- true则执行doHandler0 @
-
doHandle0
public WeixinResponse doHandle0(TextMessage message)
Description copied from class:MessageHandlerAdapter
处理请求- Overrides:
doHandle0
in classTextMessageHandler
- Parameters:
message
- 微信消息- Returns:
-
weight
public int weight()
因为HelloMessageHandler和TextMessageHandler都会匹配到文本消息 所以这里需要提高下权重(大于TextMessageHandler就行了) > TextMessageHandler- Specified by:
weight
in interfaceWeixinMessageHandler
- Overrides:
weight
in classMessageHandlerAdapter<TextMessage>
- Returns:
- 权重
-
-