Class AbstractWeixinServerStartupListener

  • All Implemented Interfaces:
    EventListener, javax.servlet.ServletContextListener

    public abstract class AbstractWeixinServerStartupListener
    extends Object
    implements javax.servlet.ServletContextListener
    监听器方式新线程启动微信服务(适用于与web集成
    Since:
    JDK 1.6
    Author:
    jinyu
    • Constructor Detail

      • AbstractWeixinServerStartupListener

        public AbstractWeixinServerStartupListener()
    • Method Detail

      • getPort

        protected int getPort()
        服务监听端口,目前微信只支持80端口,可以考虑用nginx做转发到此端口
        Returns:
      • getToken

        protected AesToken getToken()
        明文模式:String aesToken = ""; 密文模式:AesToken aesToken = new AesToken("公众号appid", "公众号token","公众号加密/解密消息的密钥");
      • getInterceptorToScan

        public String[] getInterceptorToScan()
        拦截微信消息的全限包名(也可通过addInterceptor方式一个一个添加)
        Returns:
      • getOpenAlwaysResponse

        protected boolean getOpenAlwaysResponse()
        当没有匹配到消息处理时输出空白回复(公众号不会出现「该公众号无法提供服务的提示」)
        Returns:
      • getOpenDebugResponse

        protected boolean getOpenDebugResponse()
        打开调试回复
        Returns:
      • contextInitialized

        public void contextInitialized​(javax.servlet.ServletContextEvent sce)
        Specified by:
        contextInitialized in interface javax.servlet.ServletContextListener
      • contextDestroyed

        public void contextDestroyed​(javax.servlet.ServletContextEvent sce)
        Specified by:
        contextDestroyed in interface javax.servlet.ServletContextListener