Both setting the system property and installing a factory are both standard methods for introducing custom protocol handlers.
I am not sure exactly why Class.forName() did not pick up the loaded classes. If you can see why, please let me know, cause I don't get it. As for the handler, it looks like it works well... there was just a problem getting it to be used with out having to have MainDeployer explicity install a factory. The changes to ServerImpl will allow more custom protocols to be used without having to explictly install the factory (which could mess up other protocol usage... perhaps). I am concerned why Class.forName() didn't pull this up, so please have a look and drop some knowledge =) --jason marc fleury wrote: >So where we had a simple "System.setProperty(bla bla)" we now have a >factory, a stream handler that doesn't work reliably, a couple of >Class.forName() in the code (that OF COURSE don't work with the "custom >classloading") a lot of crazyness **we don't need**? > >man, it makes me nervous I tell you, I will try to look at this tomorrow, it >better be good, simple and NECESSARY jason, I pray it is good. > >marcf > >|-----Original Message----- >|From: [EMAIL PROTECTED] >|[mailto:[EMAIL PROTECTED]]On Behalf Of Jason >|Dillon >|Sent: Monday, February 25, 2002 5:29 PM >|To: [EMAIL PROTECTED] >|Subject: [JBoss-dev] CVS update: >|jboss-common/src/main/org/jboss/net/protocol >|URLStreamHandlerFactory.java package.html >| >| >| User: user57 >| Date: 02/02/25 17:28:37 >| >| Added: src/main/org/jboss/net/protocol URLStreamHandlerFactory.java >| package.html >| Log: >| o Adding factory that will load handlers from org.jboss.net.protocol >| as it appears that the URL version won't work with our custom >|class loading >| >| Revision Changes Path >| 1.1 >|jboss-common/src/main/org/jboss/net/protocol/URLStreamHandlerFactory.java >| >| Index: URLStreamHandlerFactory.java >| =================================================================== >| /*************************************** >| * * >| * JBoss: The OpenSource J2EE WebOS * >| * * >| * Distributable under LGPL license. * >| * See terms of license at gnu.org. * >| * * >| ***************************************/ >| >| package org.jboss.net.protocol; >| >| import java.net.URLStreamHandler; >| >| /** >| * A factory for loading JBoss specific protocols. This is based >| * on Sun's URL mechanism, in that <tt>Handler</tt> classes will be >| * looked for in the <tt>org.jboss.net.protocol</tt>. >| * >| * <p>This factory is installed by the default server implementaion >| * as it appears that our custom class loading disallows the >| * default URL logic to function when setting the >| * <tt>java.protocol.handler.pkgs</tt> system property. >| * >| * @version <tt>$Revision: 1.1 $</tt> >| * @author <a href="mailto:[EMAIL PROTECTED]">Jason Dillon</a> >| */ >| public class URLStreamHandlerFactory >| implements java.net.URLStreamHandlerFactory >| { >| /** The package prefix where JBoss protocol handlers live. */ >| public static final String PACKAGE_PREFIX = "org.jboss.net.protocol"; >| >| /** >| * Returns the Stream Handler. >| * >| * @param protocol The protocol to use >| * @return The protocol handler or null if not found >| */ >| public URLStreamHandler createURLStreamHandler(final String protocol) >| { >| URLStreamHandler handler = null; >| >| try { >| String classname = PACKAGE_PREFIX + "." + protocol + ".Handler"; >| Class type = null; >| >| try { >| type = Class.forName(classname); >| } >| catch (ClassNotFoundException e) { >| ClassLoader cl = ClassLoader.getSystemClassLoader(); >| if (cl != null) { >| type = cl.loadClass(classname); >| } >| } >| >| if (type != null) { >| handler = (URLStreamHandler)type.newInstance(); >| } >| } >| catch (Exception ignore) {} >| >| return handler; >| } >| } >| >| >| >| 1.1 >|jboss-common/src/main/org/jboss/net/protocol/package.html >| >| Index: package.html >| =================================================================== >| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> >| <html> >| <head> >| <!-- $Id: package.html,v 1.1 2002/02/26 01:28:37 user57 Exp $ --> >| <!-- >| >| JBoss: The OpenSource J2EE WebOS >| >| Distributable under LGPL license. >| See terms of license at gnu.org. >| >| --> >| </head> >| >| <body bgcolor="white"> >| <p>URL protocol stream helpers. >| >| <h2>Package Specification</h2> >| <ul> >| <li><a href="javascript: alert('not available')">Not Available</a> >| </ul> >| >| <h2>Related Documentation</h2> >| <ul> >| <li><a href="javascript: alert('not available')">Not Available</a> >| </ul> >| >| <h2>Package Status</h2> >| <ul> >| <li><font color="green"><b>STABLE</b></font> >| </ul> >| >| <h2>Todo</h2> >| <ul> >| <li>??? >| </ul> >| >| <!-- Put @see and @since tags down here. --> >| >| </body> >| </html> >| >| >| >| >|_______________________________________________ >|Jboss-development mailing list >|[EMAIL PROTECTED] >|https://lists.sourceforge.net/lists/listinfo/jboss-development > _______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development