Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.protocol.msn
Class ReferenceURLStreamHandlerService

java.lang.Object
  extended by java.net.URLStreamHandler
      extended by org.osgi.service.url.AbstractURLStreamHandlerService
          extended by net.java.sip.communicator.impl.protocol.msn.ReferenceURLStreamHandlerService
All Implemented Interfaces:
org.osgi.service.url.URLStreamHandlerService

public class ReferenceURLStreamHandlerService
extends org.osgi.service.url.AbstractURLStreamHandlerService

Implements URLStreamHandlerService for the "reference" protocol used inside felix.client.run.properties in order to fix issue #647 (MalformedURLException in java-jml) by translating the URL to the "jar" protocol which is natively supported by Java.

Author:
Lubomir Marinov

Field Summary
 
Fields inherited from class org.osgi.service.url.AbstractURLStreamHandlerService
realHandler
 
Constructor Summary
ReferenceURLStreamHandlerService()
           
 
Method Summary
 URLConnection openConnection(URL url)
          Implements AbstractURLStreamHandlerService#openConnection(URL).
static void registerService(org.osgi.framework.BundleContext bundleContext)
          Registers a new ReferenceURLStreamHandlerService instance as an implementation of URLStreamHandlerService in a specific BundleContext for the "reference" protocol if there is no such registered implementation already.
 
Methods inherited from class org.osgi.service.url.AbstractURLStreamHandlerService
equals, getDefaultPort, getHostAddress, hashCode, hostsEqual, parseURL, sameFile, setURL, setURL, toExternalForm
 
Methods inherited from class java.net.URLStreamHandler
openConnection, parseURL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReferenceURLStreamHandlerService

public ReferenceURLStreamHandlerService()
Method Detail

registerService

public static void registerService(org.osgi.framework.BundleContext bundleContext)
Registers a new ReferenceURLStreamHandlerService instance as an implementation of URLStreamHandlerService in a specific BundleContext for the "reference" protocol if there is no such registered implementation already. Otherwise, the existing registered implementation is considered to be more complete in terms of features than ReferenceURLStreamHandlerService and this method does nothing.

Parameters:
bundleContext - the BundleContext in which a new ReferenceURLStreamHandlerService instance is to be registered

openConnection

public URLConnection openConnection(URL url)
                             throws IOException
Implements AbstractURLStreamHandlerService#openConnection(URL). Opens a connection to the object referenced by the URL argument by rewriting the "reference" protocol in it with the "jar" protocol and then handing it for opening to JarURLConnection.

Specified by:
openConnection in interface org.osgi.service.url.URLStreamHandlerService
Specified by:
openConnection in class org.osgi.service.url.AbstractURLStreamHandlerService
Parameters:
url - the URL that this connects to
Returns:
an URLConnection instance for the specified URL
Throws:
IOException - if an I/O error occurs while opening the connection

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.