Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > servlet filters

Reply
Thread Tools

servlet filters

 
 
laredotornado@zipmail.com
Guest
Posts: n/a
 
      08-07-2006
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

 
Reply With Quote
 
 
 
 
Luke Webber
Guest
Posts: n/a
 
      08-08-2006
wrote:
> 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
 
Reply With Quote
 
 
 
 
=?ISO-8859-2?Q?Dra=BEen_Gemi=E6?=
Guest
Posts: n/a
 
      08-08-2006
Luke Webber wrote:
>> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Stacked polariser filters instead of ND filters? peter Digital Photography 5 12-13-2010 10:25 PM
using the Filters DLL (image filters) Dieter Vanderelst Python 1 02-15-2006 09:56 AM
Servlet question(Tomcat, web.xml, servlet-class, servlet-name) circuit_breaker Java 2 04-04-2004 03:26 AM
Canon: EF filters = EF-S filters? [blu|shark] Digital Photography 17 01-28-2004 10:04 AM
accessing servlet filters eti Java 6 11-24-2003 03:41 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57