servlet filters problem - only the one filter will execute on arequest - Websphere

This is a discussion on servlet filters problem - only the one filter will execute on arequest - Websphere ; I have an issue in RAD 7.5 with the WS 7.0.0 test server using servlet spec 2.5 not executing filters as expected. If I create 2 filters, both mapped to /* and make a request to any resource, only one ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: servlet filters problem - only the one filter will execute on arequest

  1. servlet filters problem - only the one filter will execute on arequest

    I have an issue in RAD 7.5 with the WS 7.0.0 test server using servlet spec 2.5 not executing filters as expected. If I create 2 filters, both mapped to /* and make a request to any resource, only one filter will execute.

    I ran the attached ear, and got this in the log:
    {code}
    7/17/09 15:04:12:753 CDT 0000001b FilterTwo E Initializing com.test.FilterTwo
    7/17/09 15:04:12:753 CDT 0000001b FilterOne E Initializing com.test.FilterOne
    7/17/09 15:04:12:753 CDT 0000001b FilterTwo E Entering com.test.FilterTwo
    7/17/09 15:04:12:753 CDT 0000001b FilterTwo E URI [/TestFilters7/somepage]
    7/17/09 15:04:12:753 CDT 0000001b FilterTwo E context [/TestFilters7]
    7/17/09 15:04:12:753 CDT 0000001b FilterTwo E Name [/somepage]
    7/17/09 15:04:12:784 CDT 0000001b servlet I com.ibm.ws.webcontainer.servlet.ServletWrapper init SRVE0242I: FiltersEAR [/TestFilters7] [/somepage.jsp]: Initialization successful.
    7/17/09 15:04:12:816 CDT 0000001b FilterTwo E Exiting com.test.FilterTwo
    7/17/09 15:04:16:799 CDT 0000001b FilterOne E Initializing com.test.FilterOne
    7/17/09 15:04:16:799 CDT 0000001b FilterTwo E Initializing com.test.FilterTwo
    7/17/09 15:04:16:799 CDT 0000001b FilterOne E Entering com.test.FilterOne
    7/17/09 15:04:16:799 CDT 0000001b FilterTwo E Entering com.test.FilterTwo
    7/17/09 15:04:16:799 CDT 0000001b FilterTwo E URI [/TestFilters6/somepage]
    7/17/09 15:04:16:799 CDT 0000001b FilterTwo E context [/TestFilters6]
    7/17/09 15:04:16:799 CDT 0000001b FilterTwo E Name [/somepage]
    7/17/09 15:04:16:815 CDT 0000001b servlet I com.ibm.ws.webcontainer.servlet.ServletWrapper init SRVE0242I: FiltersEAR [/TestFilters6] [/somepage.jsp]: Initialization successful.
    7/17/09 15:04:16:815 CDT 0000001b FilterTwo E Exiting com.test.FilterTwo
    7/17/09 15:04:16:815 CDT 0000001b FilterOne E Exiting com.test.FilterOne
    {code}
    Nevermind I named the wars TestFilters6 and TestFilters7. I ran both WARs in the same ear on the WAS 7.0.0 test server.

    I found in a different example that if I created the first filter several times, and mapped it to /* several times, and then created and mapped the second filter, everything worked as expected. In real life, I can't run the same filter several times on each request, so it is not a very good work around.

    Has anyone else encountered this? Am I doing something wrong? Should I have different expectations? (I expect both filters to run on a relevant resource, the first filter mapped to run first and the second filter mapped to run second)

    Thanks in advance for any help. I hope the attached EAR is enough information. If not, please let me know.

  2. Re: servlet filters problem - only the one filter will execute on arequest

    Anyone?

  3. Re: servlet filters problem - only the one filter will execute on arequest

    You seemed to suggest you put them in different wars, don't they each
    have different context roots?

    I have to confess, I've only ever implemented one intercepting filter
    in a web module, but I do remember you pass control to the next one in
    a chain and are meant to be able to implement multiples.

    Any chance you could forward on the filter and filter-mapping stanzas
    from your web.xml file(s) please?

    Pete


    On Sep 1, 2:43*pm, dphunct wrote:
    > Anyone?



+ Reply to Thread