Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
375 views
in Technique[技术] by (71.8m points)

java - <absolute-ordering> is not working in tomcat 7

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

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

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...