Filters and load-on-startup

2004-03-16 Thread Blanchard, Raphael
Do filters get loaded before servlets regardless of load-on-startup value?

Raphael


RE: Filters and load-on-startup

2004-03-16 Thread Shapira, Yoav

Hi,

Do filters get loaded before servlets regardless of load-on-startup
value?

I don't think so: as filters can be mapped to servlet-name, servlets
must be loaded first.  (Although I suppose you could read web.xml, so
you have the servlet info, then instantiance filters, then instantiate
servlets, but tomcat doesn't do this).

I wouldn't rely on this order unless you had to, however, as it's not
mandated either way by the Servlet Specification.

Yoav Shapira



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Filters and load-on-startup

2004-03-16 Thread Ronald Wildenberg
 Hi,
 
 Do filters get loaded before servlets regardless of load-on-startup
 value?
 
 I don't think so: as filters can be mapped to servlet-name, servlets
 must be loaded first.  (Although I suppose you could read web.xml, so
 you have the servlet info, then instantiance filters, then instantiate
 servlets, but tomcat doesn't do this).
 
 I wouldn't rely on this order unless you had to, however, as it's not
 mandated either way by the Servlet Specification.
 


Actually, it is. SRV9.12 mandates the following load order: listeners,
filters, servlets (Servlet Specification 2.4). So any filters should be
loaded before any servlets, regardless of load-on-startup value.


Regards, Ronald.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Filters and load-on-startup

2004-03-16 Thread Shapira, Yoav

Hi,

Actually, it is. SRV9.12 mandates the following load order: listeners,
filters, servlets (Servlet Specification 2.4). So any filters should be
loaded before any servlets, regardless of load-on-startup value.

Yup, clear as day, thanks.  I figured you'd have looked at the spec
before posting and then answering your own question?! ;)

Yoav Shapira



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Filters and load-on-startup

2004-03-16 Thread Blanchard, Raphael
Actually I asked the question.  Problem is I don't want the filter to be
loaded first.  I'm trying to implement a webapp-wide connection pool to
mysql as documented in Java Servlet's Developper's guide.  I have a class
'ConnectionServlet' that is creates and initializes the connection pool.
The webapp has a login filter that needs a connection from the connection
pool.  The webapp loads the login filter first.  I don't really want to
remove the filter because its integral to the application's design.   Is
there another solution, to getting the connection pool instantiated before
the filter?

Raphaƫl

-Original Message-
From: Shapira, Yoav [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 16, 2004 10:49 AM
To: Tomcat Users List
Subject: RE: Filters and load-on-startup



Hi,

Actually, it is. SRV9.12 mandates the following load order: listeners,
filters, servlets (Servlet Specification 2.4). So any filters should be
loaded before any servlets, regardless of load-on-startup value.

Yup, clear as day, thanks.  I figured you'd have looked at the spec
before posting and then answering your own question?! ;)

Yoav Shapira



This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential, proprietary
and/or privileged.  This e-mail is intended only for the individual(s) to
whom it is addressed, and may not be saved, copied, printed, disclosed or
used by anyone else.  If you are not the(an) intended recipient, please
immediately delete this e-mail from your computer system and notify the
sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Filters and load-on-startup

2004-03-16 Thread Shapira, Yoav

Hi,

Actually I asked the question.  Problem is I don't want the filter to
be
loaded first.  I'm trying to implement a webapp-wide connection pool to
mysql as documented in Java Servlet's Developper's guide.  I have a
class
'ConnectionServlet' that is creates and initializes the connection
pool.
The webapp has a login filter that needs a connection from the
connection
pool.  The webapp loads the login filter first.  I don't really want to
remove the filter because its integral to the application's design.
Is
there another solution, to getting the connection pool instantiated
before
the filter?

Double oops for me ;)

Yes there's another, better solution: use a ServletContextListener to
initialize your connection pool.  As specified in the SRV location from
Senor Wildenberg, this will get called before any filters and servlets.

Yoav Shapira




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Filters and load-on-startup

2004-03-16 Thread Christopher Schultz
Raphael,

The webapp has a login filter that needs a connection from the connection
pool.  The webapp loads the login filter first.  I don't really want to
remove the filter because its integral to the application's design.   Is
there another solution, to getting the connection pool instantiated before
the filter?
Is this really a problem? Even though the filter needs a DB connection 
to do it's work, it doesn't need that connection until it's time to 
actually /do/ work, right?

You're certainly not going to get a request processed before the 
servlets are loaded, so it's probably alright that the DBCP is 
initialized *after* the filter itself.

Oh, and Yoav is right: you really want a ServletContextListener, rather 
than an 'init' servlet.

-chris


signature.asc
Description: OpenPGP digital signature