Java – does not work in Tomcat 7

I see the answer to this and suggest adding < absolute ordering >

I'm using Tomcat 7.0 29 and some filters are defined like this: (not in web. XML)

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

Because I want to call the session filter before the filter named authenticationfilter, so I am in web. between < web-app>. The following content has been added to XML: tag

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

However, it does not work and the authentication filter is executed before the session filter

Why?

Solution

Read the specification. Absolute sorting is used to load web fragments instead of servlet filters

To fix the sorting of filters, check the accepted answers in your linked questions

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>