Added ServletContextListener to intercept start and stop of the service
This commit is contained in:
parent
507c65cfa9
commit
35e9883a38
|
@ -0,0 +1,23 @@
|
||||||
|
package org.gcube.informationsystem.resourceregistry;
|
||||||
|
|
||||||
|
import javax.servlet.ServletContextEvent;
|
||||||
|
import javax.servlet.ServletContextListener;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
public class ResourceRegistryContextListener implements ServletContextListener {
|
||||||
|
|
||||||
|
private static Logger logger = LoggerFactory.getLogger(ResourceRegistryContextListener.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void contextDestroyed(ServletContextEvent servletContextEvent) {
|
||||||
|
logger.info("Resource Registry is going to be stopped");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void contextInitialized(ServletContextEvent servletContextEvent) {
|
||||||
|
logger.info("Resource Registry is going to be started");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -2,10 +2,13 @@
|
||||||
<!DOCTYPE xml>
|
<!DOCTYPE xml>
|
||||||
<web-app>
|
<web-app>
|
||||||
<servlet>
|
<servlet>
|
||||||
<servlet-name>org.gcube.informationsystem.resourceregistry.ResourceInitializer</servlet-name>
|
<servlet-name>org.gcube.informationsystem.resourceregistry.ResourceInitializer</servlet-name>
|
||||||
</servlet>
|
</servlet>
|
||||||
<servlet-mapping>
|
<servlet-mapping>
|
||||||
<servlet-name>org.gcube.informationsystem.resourceregistry.ResourceInitializer</servlet-name>
|
<servlet-name>org.gcube.informationsystem.resourceregistry.ResourceInitializer</servlet-name>
|
||||||
<url-pattern>/*</url-pattern>
|
<url-pattern>/*</url-pattern>
|
||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
|
<listener>
|
||||||
|
<listener-class>org.gcube.informationsystem.resourceregistry.ResourceRegistryContextListener</listener-class>
|
||||||
|
</listener>
|
||||||
</web-app>
|
</web-app>
|
Loading…
Reference in New Issue