-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Sriram,
On 1/15/13 12:50 PM, e e wrote: > [I a]m trying to understand why WebAppLoader does a > URL.setURLStreamHandlerFactory(). Presumably, it's important to handle URLs in a custom way for web applications. > I see that a protocol handler is being set for "jndi://" protocol. > Our apps' do NOT use JNDI urls. I believe tomcat 6 has NOT used > the jndi url anywhere in its codebase. Tomcat includes a lightweight JNDI that can be used for things like JDBC DataSources. So, if you configure a DataSource, your webapp will be able to fetch it using JNDI. > What [features] in tomcat will get affected if I set my factory > before tomcat sets it[?] ([note:] Factory can be set only once). - > What [features] will I lose if I set my factory[?] Presumably, you won't be able to access Tomcat's JNDI stuff. If you don't use it, you are probably safe to register your own URL stream handler. The code that calls URl.setURLStreamHandlerFactory does tolerate failure, and is documented to be "not critical". > *Note* > > - I cannot change the webapp's code to use the overloaded > java.net.URL() which takes a URLStreamHandler as an argument. > (Will require code changes across 50 applications) - I cannot set > the "*java.protocol.handler.pkgs*" as these classes must be present > in the system classpath. (Classloader hierarchy of our app-server > makes it difficult) (We run tomcat as one of the components in our > server) (Similar to any j2ee server) I believe the WebappLoader only runs the URL.setURLStreamHandlerFactory call a single time when it starts up. At that point, your webapp's code will not be available to any ClassLoader. So, if you need to load your own code for a URLStreamHandlerFactory, you're going to need to move it out of your webapp, anyway. Consider packaging your factory separately and including it in CATALINA_HOME/endorsed directory which should end up being a part of the boot classpath. - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with undefined - http://www.enigmail.net/ iEYEAREIAAYFAlD1qXgACgkQ9CaO5/Lv0PBsrgCcDmBLpydzbk+qmtQ6WvjwysUX yaYAoJONxXebOMe9sg8cyTb1SqUyFkQN =YWmA -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org