You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					26 lines
				
				771 B
			
		
		
			
		
	
	
					26 lines
				
				771 B
			| 
								 
											3 years ago
										 
									 | 
							
								package com.ynxbd.common.config.manager;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								import weixin.popular.support.TicketManager;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								import javax.servlet.ServletContextEvent;
							 | 
						||
| 
								 | 
							
								import javax.servlet.ServletContextListener;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								public class TicketManagerListener implements ServletContextListener {
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    @Override
							 | 
						||
| 
								 | 
							
								    public void contextInitialized(ServletContextEvent sce) {
							 | 
						||
| 
								 | 
							
								        //WEB容器 初始化时调用
							 | 
						||
| 
								 | 
							
								        //TicketManager 依赖 TokenManager,确保TokenManager.init 先被调用
							 | 
						||
| 
								 | 
							
								        TicketManager.init("appid");
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        //2.6.1 版本新增,延迟5秒执行。
							 | 
						||
| 
								 | 
							
								        TicketManager.init("appid", 5, 60 * 119);
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    @Override
							 | 
						||
| 
								 | 
							
								    public void contextDestroyed(ServletContextEvent sce) {
							 | 
						||
| 
								 | 
							
								        //WEB容器  关闭时调用
							 | 
						||
| 
								 | 
							
								        TicketManager.destroyed();
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								}
							 |