Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-3028

It should be possible to initialize Filters on deployment rather than on first use

    XMLWordPrintable

Details

    Description

      As I see it Wildfly “Lazy-Inits” Filters, and that's causing some problems in my project, here is my case:

      It happens that I have a filter chain declared in web.xml
      FilterA -> FilterB
      so that when a new request arrives FilterA is executed first and FilterB second.

      My problem is that FilterA needs FilterB to be initialized before it's filter method is executed.

      When using other web containers (tomcat/jetty) I had no problem with this scenario because filters' init method is called on server startup.

      With wildfly the init method of a Filter is not called until it receives the first request so the methods would be called in this order:
      FilterA.init, FilterA.filter, FilterB.init, FilterB.filter
      and FilterA.filter will fail because FilterB.init wasn't called earlier.

      Maybe it's ok to have certain mode where Filters are initialized lazily but I 'd like to have some configuration option that let me initialize filters on startup.

      I 've asked on stackoverflow about this problem and after a while only one person showed up and recommended me to raise a JIRA, so I assumed this was not possible in Wildfly 8.

      Attachments

        Activity

          People

            tomazcerar Tomaž Cerar (Inactive)
            nbarrera_jira Nicolas Barrera (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: