sitelink1 | |
---|---|
sitelink2 | |
sitelink3 | |
sitelink4 | |
sitelink5 | |
sitelink6 |
웹서버의 최초 구동시와 정지시에 수행하게 되는 클래스가 있다
ServletContextListener.java
이를 이용하여 서버 시작시나 정지시에 수행해야 할 작업을 정의할 수 있다
package com.tobesoft.xplatform.console.services;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
/**
* <p>
* 프로젝트 관리메뉴.
*
* @author Lee KiEun
*/
public class CompileListener implements ServletContextListener {
private ServletContext context = null;
/*
* This method is invoked when the Web Application has been removed and is
* no longer able to accept requests
*/
public void contextDestroyed(ServletContextEvent event) {
// Output a simple message to the server's console
System.out.println("The Simple Web App. Has Been Removed");
this.context = null;
}
// This method is invoked when the Web Application
// is ready to service requests
public void contextInitialized(ServletContextEvent event) {
this.context = event.getServletContext();
// Output a simple message to the server's console
System.out.println("The Simple Web App. Is Ready");
}
}
<listener>
<listener-class>
com.tobesoft.xplatform.console.services.CompileListener
</listener-class>
</listener>