File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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: 5266
    
  13

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
Bartender

Joined: Aug 06, 2010
Posts: 543
    
    4

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: (JEE 6 Web Component Developer && JEE 6 EJB Developer)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: @WebFilter issue