This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes FilterChain usage Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "FilterChain usage" Watch "FilterChain usage" New topic
Author

FilterChain usage

Srinivasa Kadiyala
Ranch Hand

Joined: Jun 10, 2004
Posts: 237
I am usign a class that extends and implements doFilter() method.

I am getting an error some times. Is it necessary to add the following code ?

httpResponse.setHeader("Cache-Control", "no-cache");
httpResponse.setDateHeader("Expires", 0);
httpResponse.setHeader("Pragma", "No-cache");

Thanks in advance


Srini
Srinivasa Kadiyala
Ranch Hand

Joined: Jun 10, 2004
Posts: 237
adding to my above subject...

I could not exactly get the idea and advantage of using Filter/ FilterChain.

Appreciate if any one can explain me also.

Thanks again in advance
Jack Wiesenthaler
Ranch Hand

Joined: Jul 26, 2001
Posts: 75
perhaps you should be clear in explaining what it is you're trying to achieve and what kind of error you're getting ;-)

The purpose of a Servlet Filter is to intercept a Servlet request and possibly apply certain pre-processing logic modifying or blocking the response if you choose. One use can be auditing of requests (hit counters etc.), another use is in security to check if access to a resource can be granted for example checking to see if the user is logged in etc.
Srinivasa Kadiyala
Ranch Hand

Joined: Jun 10, 2004
Posts: 237
Hi Kevin

The purpose is to use the filter for checking whether the user is logged-on to the website already or not.

Id already, he will navigate else log-on page is presented.

I am getting 500 error when doFilter(req,res) method of FilterChain is called.

Do not understand, why. Some times it works well. Some times gives 500 error.

Appreciate your feed back.

Thanks again...
Yuriy Zilbergleyt
Ranch Hand

Joined: Dec 13, 2004
Posts: 429
500 Error means an exception was thrown. What is the exception and it's stack trace?

-Yuriy
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: FilterChain usage
 
Similar Threads
Form data should not be displayed on clicking back button
Filter Configuration in Websphere Application Server 6.1
404 Error when trying to use a filter for a servlet
Export to Excel in JSF 1.2
Using a hidden field to store the url in jstl