public class WxMpMessageRouterRule extends Object
构造器和说明 |
---|
WxMpMessageRouterRule(WxMpMessageRouter routerBuilder)
Instantiates a new Wx mp message router rule.
|
限定符和类型 | 方法和说明 |
---|---|
WxMpMessageRouterRule |
async(boolean async)
设置是否异步执行,默认是true
|
WxMpMessageRouterRule |
content(String content)
如果content等于某值
|
WxMpMessageRouter |
end()
规则结束,代表如果一个消息匹配该规则,那么它将不再会进入其他规则
|
WxMpMessageRouterRule |
event(String event)
如果event等于某值
|
WxMpMessageRouterRule |
eventKey(String eventKey)
如果eventKey等于某值
|
WxMpMessageRouterRule |
eventKeyRegex(String regex)
如果eventKey匹配该正则表达式
|
WxMpMessageRouterRule |
eventRegex(String regex)
event匹配该正则表达式
比如"^weapp_audit_.
|
WxMpMessageRouterRule |
fromUser(String fromUser)
如果fromUser等于某值
|
String |
getContent()
Gets content.
|
String |
getEvent()
Gets event.
|
String |
getEventKey()
Gets event key.
|
String |
getFromUser()
Gets from user.
|
List<WxMpMessageHandler> |
getHandlers()
Gets handlers.
|
List<WxMpMessageInterceptor> |
getInterceptors()
Gets interceptors.
|
WxMpMessageMatcher |
getMatcher()
Gets matcher.
|
String |
getMsgType()
Gets msg type.
|
String |
getrContent()
Gets content.
|
WxMpMessageRouter |
getRouterBuilder()
Gets router builder.
|
WxMpMessageRouterRule |
handler(WxMpMessageHandler handler)
设置微信消息处理器
|
WxMpMessageRouterRule |
handler(WxMpMessageHandler handler,
WxMpMessageHandler... otherHandlers)
设置微信消息处理器
|
WxMpMessageRouterRule |
interceptor(WxMpMessageInterceptor interceptor)
设置微信消息拦截器
|
WxMpMessageRouterRule |
interceptor(WxMpMessageInterceptor interceptor,
WxMpMessageInterceptor... otherInterceptors)
设置微信消息拦截器
|
boolean |
isAsync()
Is async boolean.
|
boolean |
isReEnter()
Is re enter boolean.
|
WxMpMessageRouterRule |
matcher(WxMpMessageMatcher matcher)
如果消息匹配某个matcher,用在用户需要自定义更复杂的匹配规则的时候
|
WxMpMessageRouterRule |
msgType(String msgType)
如果msgType等于某值
|
WxMpMessageRouter |
next()
规则结束,但是消息还会进入其他规则
|
WxMpMessageRouterRule |
rContent(String regex)
如果content匹配该正则表达式
|
protected WxMpXmlOutMessage |
service(WxMpXmlMessage wxMessage,
Map<String,Object> context,
WxMpService wxMpService,
WxSessionManager sessionManager,
WxErrorExceptionHandler exceptionHandler)
处理微信推送过来的消息
|
void |
setAsync(boolean async)
Sets async.
|
void |
setContent(String content)
Sets content.
|
void |
setEvent(String event)
Sets event.
|
void |
setEventKey(String eventKey)
Sets event key.
|
void |
setFromUser(String fromUser)
Sets from user.
|
void |
setHandlers(List<WxMpMessageHandler> handlers)
Sets handlers.
|
void |
setInterceptors(List<WxMpMessageInterceptor> interceptors)
Sets interceptors.
|
void |
setMatcher(WxMpMessageMatcher matcher)
Sets matcher.
|
void |
setMsgType(String msgType)
Sets msg type.
|
void |
setrContent(String rContent)
Sets content.
|
void |
setReEnter(boolean reEnter)
Sets re enter.
|
protected boolean |
test(WxMpXmlMessage wxMessage)
将微信自定义的事件修正为不区分大小写,
比如框架定义的事件常量为click,但微信传递过来的却是CLICK
|
public WxMpMessageRouterRule(WxMpMessageRouter routerBuilder)
routerBuilder
- the router builderpublic WxMpMessageRouterRule async(boolean async)
async
- the asyncpublic WxMpMessageRouterRule msgType(String msgType)
msgType
- the msg typepublic WxMpMessageRouterRule event(String event)
event
- the eventpublic WxMpMessageRouterRule eventKey(String eventKey)
eventKey
- the event keypublic WxMpMessageRouterRule eventKeyRegex(String regex)
regex
- the regexpublic WxMpMessageRouterRule eventRegex(String regex)
regex
- the regexpublic WxMpMessageRouterRule content(String content)
content
- the contentpublic WxMpMessageRouterRule rContent(String regex)
regex
- the regexpublic WxMpMessageRouterRule fromUser(String fromUser)
fromUser
- the from userpublic WxMpMessageRouterRule matcher(WxMpMessageMatcher matcher)
matcher
- the matcherpublic WxMpMessageRouterRule interceptor(WxMpMessageInterceptor interceptor)
interceptor
- the interceptorpublic WxMpMessageRouterRule interceptor(WxMpMessageInterceptor interceptor, WxMpMessageInterceptor... otherInterceptors)
interceptor
- the interceptorotherInterceptors
- the other interceptorspublic WxMpMessageRouterRule handler(WxMpMessageHandler handler)
handler
- the handlerpublic WxMpMessageRouterRule handler(WxMpMessageHandler handler, WxMpMessageHandler... otherHandlers)
handler
- the handlerotherHandlers
- the other handlerspublic WxMpMessageRouter end()
public WxMpMessageRouter next()
protected boolean test(WxMpXmlMessage wxMessage)
wxMessage
- the wx messageprotected WxMpXmlOutMessage service(WxMpXmlMessage wxMessage, Map<String,Object> context, WxMpService wxMpService, WxSessionManager sessionManager, WxErrorExceptionHandler exceptionHandler)
wxMessage
- the wx messagecontext
- the contextwxMpService
- the wx mp servicesessionManager
- the session managerexceptionHandler
- the exception handlerpublic WxMpMessageRouter getRouterBuilder()
public boolean isAsync()
public void setAsync(boolean async)
async
- the asyncpublic String getFromUser()
public void setFromUser(String fromUser)
fromUser
- the from userpublic String getMsgType()
public void setMsgType(String msgType)
msgType
- the msg typepublic String getEvent()
public void setEvent(String event)
event
- the eventpublic String getEventKey()
public void setEventKey(String eventKey)
eventKey
- the event keypublic String getContent()
public void setContent(String content)
content
- the contentpublic String getrContent()
public void setrContent(String rContent)
rContent
- the r contentpublic WxMpMessageMatcher getMatcher()
public void setMatcher(WxMpMessageMatcher matcher)
matcher
- the matcherpublic boolean isReEnter()
public void setReEnter(boolean reEnter)
reEnter
- the re enterpublic List<WxMpMessageHandler> getHandlers()
public void setHandlers(List<WxMpMessageHandler> handlers)
handlers
- the handlerspublic List<WxMpMessageInterceptor> getInterceptors()
public void setInterceptors(List<WxMpMessageInterceptor> interceptors)
interceptors
- the interceptorsCopyright © 2024. All rights reserved.