aspose file tools*
The moose likes Websphere and the fly likes Filter invocation order Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "Filter invocation order" Watch "Filter invocation order" New topic
Author

Filter invocation order

Piotr Komisarski
Greenhorn

Joined: Jun 14, 2009
Posts: 4
Hi

This is listing from my web.xml:

<filter>
<display-name>FilterOne</display-name>
<filter-name>FilterOne</filter-name>
<filter-class>com.FilterOne</filter-class>
</filter>
<filter>
<display-name>FilterTwo</display-name>
<filter-name>FilterTwo</filter-name>
<filter-class>com.FilterTwo</filter-class>
</filter>
<filter>
<display-name>Third</display-name>
<filter-name>Third</filter-name>
<filter-class>com.Third</filter-class>
</filter>

<filter-mapping>
<filter-name>FilterOne</filter-name>
<url-pattern>/red/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>FilterTwo</filter-name>
<url-pattern>/red/red/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>Third</filter-name>
<url-pattern>/red/red/red/*</url-pattern>
</filter-mapping>

In each filter i have System.out.println("Filter xxx") before chain.doFilter()
In java ee documentation is written: "order of the filters is the order in which they appear in the deployment descriptor."


So when i'm invoking http://localhost:9080/webTest/red/red/red/* on console should be
Filter ONE
Filter TWO
Filter THREE

But on my console is :

filter THREE - /red/red/red/*
filter ONE - /red/*
filter TWO - /red/red/*

Why ??

I am using WebSphere Application Server v7.0
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Please UseCodeTags.
Piotr Komisarski
Greenhorn

Joined: Jun 14, 2009
Posts: 4
OK.

I found cause of my problem.
In administrative web page of websphere i checked my web.xml and there order of my filters is changed to THREE, ONE, TWO.
But i don't understand this.
Why websphere is changing my web.xml during deployment?
I tried few times and each time order of my filters is shuffled...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61653
    
  67

"piterboss piterboss", please check your private messages for an important administrative matter.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61653
    
  67

As this appears to be Websphere-specific it has been moved to the Webshpere forum.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Filter invocation order