• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

FilterChain usage

 
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Srinivasa Kadiyala
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 237
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...
 
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
500 Error means an exception was thrown. What is the exception and it's stack trace?

-Yuriy
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic