cn.binarywang.wx.miniapp.message.WxMaMessageRouter Java Examples

The following examples show how to use cn.binarywang.wx.miniapp.message.WxMaMessageRouter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WxMaDemoServer.java    From weixin-java-tools with Apache License 2.0 6 votes vote down vote up
private static void init() {
  try (InputStream is1 = ClassLoader.getSystemResourceAsStream("test-config.xml")) {
    TestConfig config = TestConfig.fromXml(is1);
    config.setAccessTokenLock(new ReentrantLock());
    templateId = config.getTemplateId();

    WxMaDemoServer.config = config;
    service = new WxMaServiceImpl();
    service.setWxMaConfig(config);

    router = new WxMaMessageRouter(service);

    router.rule().handler(logHandler).next()
      .rule().async(false).content("模板").handler(templateMsgHandler).end()
      .rule().async(false).content("文本").handler(textHandler).end()
      .rule().async(false).content("图片").handler(picHandler).end()
      .rule().async(false).content("二维码").handler(qrcodeHandler).end();
  } catch (IOException e) {
    e.printStackTrace();
  }
}
 
Example #2
Source File: WeixinAppManager.java    From oneplatform with Apache License 2.0 5 votes vote down vote up
private WxMaMessageRouter newRouter(WxMaService service) {
    final WxMaMessageRouter router = new WxMaMessageRouter(service);
    router
        .rule().handler(logHandler).next()
        .rule().async(false).content("模板").handler(templateMsgHandler).end()
        .rule().async(false).content("文本").handler(textHandler).end()
        .rule().async(false).content("图片").handler(picHandler).end()
        .rule().async(false).content("二维码").handler(qrcodeHandler).end();
    return router;
}
 
Example #3
Source File: WxMaPortalServlet.java    From weixin-java-tools with Apache License 2.0 4 votes vote down vote up
WxMaPortalServlet(WxMaConfig wxMaConfig, WxMaService wxMaService,
                  WxMaMessageRouter wxMaMessageRouter) {
  this.wxMaConfig = wxMaConfig;
  this.wxMaService = wxMaService;
  this.wxMaMessageRouter = wxMaMessageRouter;
}
 
Example #4
Source File: WeixinAppManager.java    From oneplatform with Apache License 2.0 4 votes vote down vote up
public Map<String, WxMaMessageRouter> getRouters() {
    return routers;
}