Reverted web.xml with listeners

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/vre-management/smart-executor@119666 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2015-10-13 10:50:27 +00:00
parent 5c8a24724c
commit 7c35ad49b4
3 changed files with 60 additions and 7 deletions

View File

@ -25,7 +25,6 @@
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">

View File

@ -0,0 +1,44 @@
/**
*
*/
package org.gcube.vremanagement.executor;
import java.util.List;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import org.gcube.smartgears.ContextProvider;
import org.gcube.smartgears.context.application.ApplicationContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
*/
public class SmartContextServletListener implements ServletContextListener {
/**
* Logger
*/
private static Logger logger = LoggerFactory.getLogger(SmartContextServletListener.class);
/**{@inheritDoc}*/
@Override
public void contextDestroyed(ServletContextEvent servletContextEvent) {
logger.debug("Bye Bye SmartExecutor");
}
/**{@inheritDoc}*/
@Override
public void contextInitialized(ServletContextEvent servletContextEvent) {
logger.debug("Hello SmartExecutor");
ApplicationContext ctx = ContextProvider.get();
logger.debug(String.format("ApplicationContext %s", ctx));
if(ctx!=null){
List<String> scopes = SmartExecutorInitializator.getScopes(ctx);
logger.debug(String.format("Scopes %s", scopes));
}
}
}

View File

@ -1,9 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<listener>
<listener-class>org.gcube.smartgears.ContextListener</listener-class>
</listener>
<listener>
<listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>
</listener>
<listener>
<listener-class>org.gcube.vremanagement.executor.SmartContextServletListener</listener-class>
</listener>
<servlet>
<servlet-name>smart-executor</servlet-name>
<servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
@ -13,4 +23,4 @@
<url-pattern>/gcube/vremanagement/smart-executor</url-pattern>
</servlet-mapping>
</web-app>
</web-app>