Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Filter

 
S Majumder
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 952
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
agnu sargar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 349
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks every body .
Is there any good url avialable for Filter ?

regards,
S
 
avi sinha
Ranch Hand
Posts: 453
Google Web Toolkit Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
s begri wrote:
Is there any good url avialable for Filter ?
S


Filter tutorial from sun

avi sinha
 
Charles 'King
Ranch Hand
Posts: 56
Eclipse IDE Postgres Database Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 238
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is one other good URL
http://javaboutique.internet.com/tutorials/Servlet_Filters/
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic