• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

@WebFilter issue

Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Final Servlet 3.0 specs

Section 8.1.2

CODE EXAMPLE 8-3 @WebFilter annotation example @WebFilter(“/foo”)
public class MyFilter implements Filter {
public void doFilter(HttpServletRequest req, HttpServletResponse res)
} }

Comment: Don't you think the method signature is wrong?
It should be:
public void doFilter(ServletRequest arg0, ServletResponse arg1,
FilterChain arg2) throws IOException, ServletException {
Posts: 11604
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Filter interface declares a doFilter-method with 3 parameters, so it's likely the code example is not a valid override.
Posts: 543
Netbeans IDE Redhat Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
also, Filter interface declares three methods, not one.

- public void init(FilterConfig) throws ServletException
- public void doFilter(ServletRequest, ServletResponse, FilterChain) throws IOException, ServletException
- public void destroy()

You must implement these three methods to have a valid implementation of Filter.
It's a tiny ad only because the water is so cold.
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic