my dog learned polymorphism
The moose likes Servlets and the fly likes Unsure about this filter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Unsure about this filter" Watch "Unsure about this filter" New topic

Unsure about this filter

Hussein Baghdadi
clojure forum advocate

Joined: Nov 08, 2003
Posts: 3479

I have been reading LinkTrackerFilter class from "Servlets and JavaServer Pages� The J2EE� Technology Web Tier" book's source and some questions arised.
This class extracts a url from the query string then redirects the request to that url and then return statement appears.
At the end of the class, the code increases a static counter then there is a chain.doFilter( ).
The book emphases that the calling to the previous doFilter is important in order to allow other filters, servlets and JSP to handle the request.
Since the code the freely avaible, I will post some snipets here :

How the hell the last two lines would be getting called ? there is a return statement !
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63865

Did you look closely at the code? Is the return statement unconditionally always reached?

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Unsure about this filter
jQuery in Action, 3rd edition