⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 syslistener.java

📁 交易撮合系统是一套买卖信息沟通的平台
💻 JAVA
字号:
/**
 *
 */
package com.laoer.bbscs.web.servlet;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.http.HttpServlet;

import org.apache.commons.lang.math.NumberUtils;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.Log;
import com.laoer.bbscs.comm.*;

/**
 * @author laoer
 *
 */
public class SysListener extends HttpServlet implements ServletContextListener {

	private static final Log logger = LogFactory.getLog(SysListener.class);

	/**
	 *
	 */
	private static final long serialVersionUID = -7106672475983633319L;

	/*
	 *
	 *
	 * @see javax.servlet.ServletContextListener#contextDestroyed(javax.servlet.ServletContextEvent)
	 */
	public void contextDestroyed(ServletContextEvent sce) {
	}

	/*
	 *
	 *
	 * @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)
	 */
	public void contextInitialized(ServletContextEvent sce) {
		String rootpath = sce.getServletContext().getRealPath("/");
		if (rootpath != null) {
			rootpath = rootpath.replaceAll("\\\\", "/");
		} else {
			rootpath = "/";
		}
		if (!rootpath.endsWith("/")) {
			rootpath = rootpath + "/";
		}
		Constant.ROOTPATH = rootpath;
		logger.info("Application Run Path:" + rootpath);
		String urlrewrtie = sce.getServletContext().getInitParameter("urlrewrite");
		boolean burlrewrtie = false;
		if (urlrewrtie != null) {
			burlrewrtie = Boolean.parseBoolean(urlrewrtie);
		}
		Constant.USE_URL_REWRITE = burlrewrtie;
		logger.info("Use Urlrewrite:" + burlrewrtie);
		String cluster = sce.getServletContext().getInitParameter("cluster");
		boolean bcluster = false;
		if (cluster != null) {
			bcluster = Boolean.parseBoolean(cluster);
		}
		Constant.USE_CLUSTER = bcluster;
		logger.info("Use Cluster:" + bcluster);
		String servletmapping = sce.getServletContext().getInitParameter("servletmapping");
		if (servletmapping == null) {
			servletmapping = "*.bbscs";
		}
		Constant.SERVLET_MAPPING = servletmapping;
		logger.info("SERVLET MAPPING:" + servletmapping);

		String poststoragemodes = sce.getServletContext().getInitParameter("poststoragemode");
		if (poststoragemodes == null) {
			poststoragemodes = "0";
		}
		Constant.POST_STORAGE_MODE = NumberUtils.toInt(poststoragemodes, 0);
		logger.info("Post Storage Mode:" + poststoragemodes);
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -