Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2006

Tip: Looking for answers? Try searching our database.

servlet filters

Thread view: 
laredotornado@zipmail.com - 08 Aug 2006 00:26 GMT
Hello,

I was just told about servlet filters.  Is a new servlet filter
instantiated per request?  Also, when is the "doFilter" method called
in relation to the filtered servlet's "service" method?

Thanks for the info, - Dave
Luke Webber - 08 Aug 2006 02:24 GMT
> Hello,
>
> I was just told about servlet filters.  Is a new servlet filter
> instantiated per request?

No. The lifecycle of a filter is similar to that of a servlet. One
instance per VM, multithreaded.

>  Also, when is the "doFilter" method called
> in relation to the filtered servlet's "service" method?

The filter gets called first, then should chain to any other filters via
the FilterChain's doFilter method. If it's the last filter in the chain,
doFilter will pass control to the servlet's service method.

Luke
Dražen Gemić - 08 Aug 2006 13:54 GMT
>>  Also, when is the "doFilter" method called
>> in relation to the filtered servlet's "service" method?

Filters are usefull for processing requests before
they are resolved.

Filter does not create response, it routes request to the component(s)
that will respond to it. That means that one can preprocess the request
and forward it to a servlet for response.

DG


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.