-
Sub-task
-
Resolution: Unresolved
-
Major
-
2.12.3.Final
It should be possible to create classes implementing ServletContextListener or any other listener defined in the Servlet spec.
A Servlet Listener can implement several interfaces :
javax.servlet.ServletContextListener javax.servlet.ServletContextAttributeListener javax.servlet.ServletRequestListener javax.servlet.ServletRequestAttributeListener javax.servlet.http.HttpSessionListener javax.servlet.http.HttpSessionActivationListener javax.servlet.http.HttpSessionAttributeListener
So the command should look like :
servlet-new-listener --named MyListener --listener ServletContextListener ServletRequestListener HttpSessionListener
This should generate
@WebListener public class MyListener implements ServletContextListener, ServletRequestListener, HttpSessionListener { @Override public void contextInitialized(ServletContextEvent sce) { } @Override public void contextDestroyed(ServletContextEvent sce) { } @Override public void sessionCreated(HttpSessionEvent se) { } @Override public void sessionDestroyed(HttpSessionEvent se) { } @Override public void requestDestroyed(ServletRequestEvent sre) { } @Override public void requestInitialized(ServletRequestEvent sre) { } }
This should be easier to do with [ROASTER-51]