aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes @WebFilter issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "@WebFilter issue" Watch "@WebFilter issue" New topic
Author

@WebFilter issue

Yasir Karim
Greenhorn

Joined: Jul 21, 2011
Posts: 17

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:
@Override
public void doFilter(ServletRequest arg0, ServletResponse arg1,
FilterChain arg2) throws IOException, ServletException {
...


I see the truth in the code.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 4922
    
  10

The Filter interface declares a doFilter-method with 3 parameters, so it's likely the code example is not a valid override.


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Dieter Quickfend
Ranch Hand

Joined: Aug 06, 2010
Posts: 359
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.


Oracle Certified Professional: Java SE 6 Programmer
Oracle Certified Expert: Java EE 6 Web Component Developer
Oracle Certified Expert: Java EE 6 Enterprise JavaBeans Developer
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: @WebFilter issue
 
Similar Threads
Why no HttpServletReq on doFilter?
Why is ServletFilter.doFilter() not getting invoked?
Java Filter and uncaughtExceptions
WebFilter Annotation and servletNames attribute
How specify filter chain with @WebFilter