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