my dog learned polymorphism
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes What are filters?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "What are filters??" Watch "What are filters??" New topic

What are filters??

Andy Smith
Ranch Hand

Joined: Sep 28, 2003
Posts: 239
Do any body of u have idea about the filters??
and what are the conditions when they can be used??
Thanx in advance

Share Knowledge to gain it.
SCJP 2, SCWCD 2, SCDJWS, IBM 141 (In Progress), IBM 486 (Next)
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
Among the types of functionality available to the developer needing to use filters are the following:
� The accessing of a resource before a request to it is invoked.
� The processing of the request for a resource before it is invoked.
� The modification of request headers and data by wrapping the request in customized versions of the request object.
� The modification of response headers and response data by providing customized versions of the response object.
� The interception of an invocation of a resource after its call.
� Actions on a servlet, on groups of servlets, or static content by zero, one, or more filters in a specifiable order.

Here is sthing that I extract from the Servlet 2.4 Specification... Hope it helps you...

Co-author of SCMAD Exam Guide, Author of JMADPlus
Andy Smith
Ranch Hand

Joined: Sep 28, 2003
Posts: 239
I will try to out the filters..
can u please quote a real life example..may be that will make my idea a bit clear about filters...
Thanx Once again,,,
Thomas De Vos
stable boy
Ranch Hand

Joined: Apr 12, 2003
Posts: 425
Maybe you want to log every request before it arrives in your main servlet. This gives you the ability to remove the filter later without touching your base code.
Filtering can be used to manipulate also the headers of your request/response.
You can also use it for decompressing of your response before it is sent to the client.
Recording of sessions that are active on the server.

Try your free <a href="" target="_blank" rel="nofollow">SCJP 1.4</a> certification centre.<br />Try your free <a href="" target="_blank" rel="nofollow">SCWCD</a> certification centre.<br />Try your free <a href="" target="_blank" rel="nofollow">SCBCD</a> certification centre.<br />Try your <a href="" target="_blank" rel="nofollow">Websphere (Test 285) </a> certification centre.<br />Try your <a href="" target="_blank" rel="nofollow">SCMAD</a> certification centre. (New)<br /> <br /><a href="" target="_blank" rel="nofollow">Java/J2EE Certification Blogging</a>
Andy Smith
Ranch Hand

Joined: Sep 28, 2003
Posts: 239
Loggins is a good example ...
Basically i was not able to find the implication between the servlets and the filters... Yes now i think that filters basically can be added any time or removed to provide the common funcionality to all the servlets..
Moreover without touching the base servlet tcode....
m i rite???
Any other examples are Welcome..
Thanx a lot Thomas
I agree. Here's the link:
subject: What are filters??
jQuery in Action, 3rd edition