?? appinitcontextlistener.java
字號:
package org.ellab.elchat;
import java.io.File;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* This <code>ContextListener</code> is to perform application initialization.
*/
public class AppInitContextListener implements ServletContextListener {
private static Log log = LogFactory.getLog(ChatConfig.class);
public void contextInitialized(ServletContextEvent event) {
try {
ServletContext context = event.getServletContext();
ChatConfig.init(context.getRealPath("WEB-INF/elchat.properties"));
ChatConfig config = ChatConfig.getInstance();
EmotIcon.init(context.getRealPath("WEB-INF/emoticon.properties"));
Command.init(context.getRealPath("WEB-INF/command.properties"));
String persistFile = config.getMessagePath() + config.getId().replaceAll("[\\s|\\.\\/]", "_")
+ "_messages.xml";
if (!new File(config.getMessagePath()).exists()) {
persistFile = context.getRealPath("WEB-INF/messages.xml");
}
Chat.init(persistFile);
}
catch (Exception ex) {
ex.printStackTrace();
log.fatal("Exception in AppInitContextListener", ex);
}
}
public void contextDestroyed(ServletContextEvent event) {
;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -