Uploaded image for project: 'Application Server 7'
  1. Application Server 7
  2. AS7-5536

servlet lifecycle interceptor methods ignored when declared in web.xml

    XMLWordPrintable

Details

    Description

      web.xml declares post-construct and pre-destroy methods, but are not invoked during the servlet lifecycle.

        <post-construct>
          <lifecycle-callback-class>test.TestServlet</lifecycle-callback-class>
          <lifecycle-callback-method>ps</lifecycle-callback-method>
        </post-construct>
        <pre-destroy>
          <lifecycle-callback-class>test.TestServlet</lifecycle-callback-class>
          <lifecycle-callback-method>pd</lifecycle-callback-method>
        </pre-destroy>
      

      The servlet class itself does not contain any @PostConstruct or @PreDestroy methods.

          private void ps() {
              System.out.println("in post-construct declared in web.xml of " + this);
          }
      
          private void pd() {
              System.out.println("in pre-destroy declared in web.xml of " + this);
          }
      

      Attachments

        Activity

          People

            sdouglas1@redhat.com Stuart Douglas
            cfang@redhat.com Cheng Fang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: