This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Servlets and the fly likes can any body tell about  the filter in servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "can any body tell about  the filter in servlet" Watch "can any body tell about  the filter in servlet" New topic

can any body tell about the filter in servlet

vijayakumar durai
Ranch Hand

Joined: Aug 18, 2008
Posts: 153
hi all i want the concept of filter what is filter? why we are using filter what is the advantages in filter?

thanks in advance
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Here is a good summary of what they are and why you might use them.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Goutham Pallipati

Joined: Aug 13, 2008
Posts: 20

filters are again Servlets which are used to do some filtering and preprocessing before the actual servlet or resource is invoked.

A filter can be configured for single resource or multiple resource.

One best example for filters is Authentication.

If you want to authenticate a set of resource under http://<server>/myres/
earlier without filters you need to check session validity in each and every resource say servlet or JSP.

Now with filters you can configure a filter and check the session validity in the filter and then the request is automatically redirected to the corresponding resource. The user would not even know that filter exists .
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: can any body tell about the filter in servlet
It's not a secret anymore!