Uploaded image for project: 'Forge'
  1. Forge
  2. FORGE-1926 Adding more commands to Forge and improve existing ones
  3. FORGE-2164

Being able to create listeners defined in the Servlet spec

    XMLWordPrintable

Details

    • Sub-task
    • Resolution: Unresolved
    • Major
    • 3.x Future
    • 2.12.3.Final
    • Java EE

    Description

      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]

      Attachments

        Activity

          People

            Unassigned Unassigned
            rhn-support-ggastald George Gastaldi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: