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

Categories

0 votes
370 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 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...