net.sf.fikin.net.protocols.classpath
Class Handler

java.lang.Object
  extended by java.net.URLStreamHandler
      extended by net.sf.fikin.net.protocols.classpath.Handler

public class Handler
extends java.net.URLStreamHandler

URL protocol handler supporting predefined list of classloaders to load the given resource.

Built-in logic uses following classloaders (in given order):

One can influence this logic by setting (at any moment of time) ClasspathStreamHandlerFactory.primaryClassLoader to some desired classloader.

created on Apr 28, 2005

Since:
Version:
$Revision: 1.2 $
Author:
fiykov

Constructor Summary
Handler()
           
 
Method Summary
protected  java.net.URL getResource(java.lang.String res)
          Loks up a list of classloaders for the given resource.
protected  java.net.URL getSysResURL(java.net.URL u)
          locate the resource in the context system resources
protected  java.net.URLConnection openConnection(java.net.URL u)
           
 
Methods inherited from class java.net.URLStreamHandler
equals, getDefaultPort, getHostAddress, hashCode, hostsEqual, openConnection, parseURL, sameFile, setURL, setURL, toExternalForm
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Handler

public Handler()
Method Detail

openConnection

protected java.net.URLConnection openConnection(java.net.URL u)
                                         throws java.io.IOException
Specified by:
openConnection in class java.net.URLStreamHandler
Throws:
java.io.IOException

getSysResURL

protected java.net.URL getSysResURL(java.net.URL u)
locate the resource in the context system resources

Returns:
valid resource url
Throws:
java.lang.InternalError - if the resource is missing

getResource

protected java.net.URL getResource(java.lang.String res)
Loks up a list of classloaders for the given resource. Order of classloaders used is:

Parameters:
res - to find
Returns:
found resource by the first classloader or null if found by none of them


Copyright © 2003-2007 Nikolay Fiykov. All Rights Reserved.