Class FakeURLStreamHandler


  • class FakeURLStreamHandler
    extends java.net.URLStreamHandler
    This class implements a fake stream handler. This class is necessary in some cases when assigning CodeSources to classes in BundleClassLoader. In general, the bundle location is an URL and this URL is used as the code source for the bundle's associated classes. The OSGi specification does not require that the bundle location be an URL, though, so in that case we try to generate a fake URL for the code source of the bundle, which is just the location string prepended with the "location:" protocol, by default. We need this fake handler to avoid an unknown protocol exception.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.net.URLConnection openConnection​(java.net.URL url)  
      • 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

      • FakeURLStreamHandler

        FakeURLStreamHandler()
    • Method Detail

      • openConnection

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