Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I saw this answer that suggests to add <absolute-ordering>.

I am using tomcat 7.0.29 and have a few filters which are all defined like this: (not in web.xml)

@WebFilter(filterName = "SessionFilter",  servletNames = { "Jersey Web Application" })
public class HibernateSessionRequestFilter implements Filter {

Since I want the session filter to invoked before a filter called authenticationfilter, I added the following to web.xml between <web-app> tags.

<absolute-ordering>
      <name>SessionFilter</name>
      <name>AuthenticationFilter</name>
</absolute-ordering>

However, it doesn't work and authentication filter is executed BEFORE session filter.

Why?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
352 views
Welcome To Ask or Share your Answers For Others

1 Answer

Reading the specification, absolute-ordering is used to order the loading of web fragments, not of servlet filters.

To fix the ordering of your filters, see the accepted answer in the question you linked to.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...