Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Are all the filters in DD initialized when server restarts ?

 
Joshua Antony
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Select the correct sequence of actions that a servlet container performs before servicing any request.
A.Instantiate listeners defined in the deployment descriptor
B.Initialize filters defined in the deployment descriptor
C.Initialize servlets that are set to load on startup
D.Call the contextInitialized method on the listeners implementing ServletContextListener interface

Answer :A,B,C,D

I have doubt about option B, I guess only the object is created. Is the init method of the filter also called during restart ?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SRV.6.2.1 Filter Lifecycle
After deployment of the Web application, and before a request causes the container to access a Web resource, the container must locate the list of filters that must be applied to the Web resource as described below. The container must ensure that it has instantiated a filter of the appropriate class for each filter in the list, and called its init(FilterConfig config) method.
 
Mihai Radulescu
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys

That means that the filters are living for only one request and foe each new request the filters are new initialized (by calling the init(FilterConfig config)) ?

Regards,
M
 
Tomaszz Lewandowski
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From SRV.9.12:

When a web application is deployed into a container, the following steps must be
performed, in this order, before the web application begins processing client
requests.
� Instantiate an instance of each event listener identified by a <listener> element
in the deployment descriptor.
� For instantiated listener instances that implement ServletContextListener,
call the contextInitialized() method.
� Instantiate an instance of each filter identified by a <filter> element in the deployment
descriptor and call each filter instance�s init() method.
� Instantiate an instance of each servlet identified by a <servlet> element that
includes a <load-on-startup> element in the order defined by the load-onstartup
element values, and call each servlet instance�s init() method.
 
Mihai Radulescu
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, you are all right. Now I got it.

Regards,
M
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic