File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Filter concept Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Filter concept" Watch "Filter concept" New topic
Author

Filter concept

deepa raj
Ranch Hand

Joined: Jul 25, 2008
Posts: 124
For being a filter , doFilter body must call the chain.doFilter aleast

is it so?

or doFilter body can do nothing.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Originally posted by deepa raj:
For being a filter , doFilter body must call the chain.doFilter aleast

is it so?



if your not calling the chain.doFilter then,your servlt code whould not execute.. but it will not give any error.

Hope This Helps
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9304
    
  17

Filters are used for pre-request processing and post-request processing logic.. So after pre-request processing logic has been completed a filter must ideally call chain.doFilter() this call will call the next filter or servlet in the chain. When the next element in the chain finishes it's processing, then the call to doFilter() returns. Then you can apply any post-request processing logic

filer structure

/*pre-request processing logic*/
chain.doFilter()
/*post-request processing logic*/

But as seetharaman said calling doFilter is not neccessary.


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Originally posted by AnkitJi Garg:

But as seetharaman said calling doFilter is not neccessary.


i did not say my friend.i clearly mentioned that it will not give error thats it
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9304
    
  17

Originally posted by seetharaman venkatasamy:


i did not say my friend.i clearly mentioned that it will not give error thats it


And that's what I meant...I thought about giving you credit that you posted the correct explanation before me that's why I took you name...
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

sorry! because of my poor English knowledge
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Filter concept