wood burning stoves 2.0*
The moose likes Servlets and the fly likes Filter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Filter" Watch "Filter" New topic
Author

Filter

S Majumder
Ranch Hand

Joined: Jun 03, 2009
Posts: 244
Hi every body ,
I have few questions :
What actually Filter do in a web application and how could we impliment it in our App ?


thanks and regards,
S
Punit Singh
Ranch Hand

Joined: Oct 16, 2008
Posts: 952
s begri wrote:Hi every body ,
I have few questions :
What actually Filter do in a web application and how could we impliment it in our App ?


thanks and regards,
S


Filter is works like filter in real world, like water filter, it acts like interceptors.
If will seat between browser/client and your servlet. And it has access to ServletRequest and ServletResponse.
If you write filter, then you can modify this request , response using filter.
You can check all the request object and decide whether control should reach to destined servlet or not.
You can log time for a particular servlet has taken for responding.

Writing filter is similar to writing servlet. You have to configure it in web.xml.


SCJP 6
agnu sargar
Greenhorn

Joined: Feb 01, 2008
Posts: 9
filters are used to filter your request before it allows to your access your web resources.
you can custom your response too for filter.
filters are declared same like servlet in web.xml. filters are much like servelt.
S Majumder
Ranch Hand

Joined: Jun 03, 2009
Posts: 244
Thanks every body .
Is there any good url avialable for Filter ?

regards,
S
avi sinha
Ranch Hand

Joined: Mar 15, 2009
Posts: 452

s begri wrote:
Is there any good url avialable for Filter ?
S


Filter tutorial from sun

avi sinha


SCJP 5.0 SCWCD 5.0
Charles 'King
Ranch Hand

Joined: Jul 05, 2009
Posts: 56

s begri wrote:Thanks every body .
Is there any good url avialable for Filter ?

regards,
S


Additonally, filters can transform a request or response - Wrapper or Decorator pattern...Take a look at ServletRequestWrapper and HttpServletRequestWrapper:
Filter - Wrappers
Mathew Lee
Ranch Hand

Joined: Jun 08, 2009
Posts: 238
Here is one other good URL
http://javaboutique.internet.com/tutorials/Servlet_Filters/
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Filter