OSGi™ Core
Release 6

org.osgi.service.url
Class AbstractURLStreamHandlerService

java.lang.Object
  extended by java.net.URLStreamHandler
      extended by org.osgi.service.url.AbstractURLStreamHandlerService
All Implemented Interfaces:
URLStreamHandlerService

@ConsumerType
public abstract class AbstractURLStreamHandlerService
extends URLStreamHandler
implements URLStreamHandlerService

Abstract implementation of the URLStreamHandlerService interface. All the methods simply invoke the corresponding methods on java.net.URLStreamHandler except for parseURL and setURL, which use the URLStreamHandlerSetter parameter. Subclasses of this abstract class should not need to override the setURL and parseURL(URLStreamHandlerSetter,...) methods.

"ThreadSafe"

Field Summary
protected  URLStreamHandlerSetter realHandler
          The URLStreamHandlerSetter object passed to the parseURL method.
 
Constructor Summary
AbstractURLStreamHandlerService()
           
 
Method Summary
 boolean equals(URL u1, URL u2)
          This method calls super.equals(URL,URL).
 int getDefaultPort()
          This method calls super.getDefaultPort.
 InetAddress getHostAddress(URL u)
          This method calls super.getHostAddress.
 int hashCode(URL u)
          This method calls super.hashCode(URL).
 boolean hostsEqual(URL u1, URL u2)
          This method calls super.hostsEqual.
abstract  URLConnection openConnection(URL u)
           
 void parseURL(URLStreamHandlerSetter realHandler, URL u, String spec, int start, int limit)
          Parse a URL using the URLStreamHandlerSetter object.
 boolean sameFile(URL u1, URL u2)
          This method calls super.sameFile.
protected  void setURL(URL u, String proto, String host, int port, String file, String ref)
          Deprecated. This method is only for compatibility with handlers written for JDK 1.1.
protected  void setURL(URL u, String proto, String host, int port, String auth, String user, String path, String query, String ref)
          This method calls realHandler.setURL(URL,String,String,int,String,String,String,String) .
 String toExternalForm(URL u)
          This method calls super.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
 

Field Detail

realHandler

protected volatile URLStreamHandlerSetter realHandler
The URLStreamHandlerSetter object passed to the parseURL method.

Constructor Detail

AbstractURLStreamHandlerService

public AbstractURLStreamHandlerService()
Method Detail

openConnection

public abstract URLConnection openConnection(URL u)
                                      throws IOException
Specified by:
openConnection in interface URLStreamHandlerService
Specified by:
openConnection in class URLStreamHandler
Throws:
IOException
See Also:
"java.net.URLStreamHandler.openConnection"

parseURL

public void parseURL(URLStreamHandlerSetter realHandler,
                     URL u,
                     String spec,
                     int start,
                     int limit)
Parse a URL using the URLStreamHandlerSetter object. This method sets the realHandler field with the specified URLStreamHandlerSetter object and then calls parseURL(URL,String,int,int).

Specified by:
parseURL in interface URLStreamHandlerService
Parameters:
realHandler - The object on which the setURL method must be invoked for the specified URL.
See Also:
"java.net.URLStreamHandler.parseURL"

toExternalForm

public String toExternalForm(URL u)
This method calls super.toExternalForm.

Specified by:
toExternalForm in interface URLStreamHandlerService
Overrides:
toExternalForm in class URLStreamHandler
See Also:
"java.net.URLStreamHandler.toExternalForm"

equals

public boolean equals(URL u1,
                      URL u2)
This method calls super.equals(URL,URL).

Specified by:
equals in interface URLStreamHandlerService
Overrides:
equals in class URLStreamHandler
See Also:
"java.net.URLStreamHandler.equals(URL,URL)"

getDefaultPort

public int getDefaultPort()
This method calls super.getDefaultPort.

Specified by:
getDefaultPort in interface URLStreamHandlerService
Overrides:
getDefaultPort in class URLStreamHandler
See Also:
"java.net.URLStreamHandler.getDefaultPort"

getHostAddress

public InetAddress getHostAddress(URL u)
This method calls super.getHostAddress.

Specified by:
getHostAddress in interface URLStreamHandlerService
Overrides:
getHostAddress in class URLStreamHandler
See Also:
"java.net.URLStreamHandler.getHostAddress"

hashCode

public int hashCode(URL u)
This method calls super.hashCode(URL).

Specified by:
hashCode in interface URLStreamHandlerService
Overrides:
hashCode in class URLStreamHandler
See Also:
"java.net.URLStreamHandler.hashCode(URL)"

hostsEqual

public boolean hostsEqual(URL u1,
                          URL u2)
This method calls super.hostsEqual.

Specified by:
hostsEqual in interface URLStreamHandlerService
Overrides:
hostsEqual in class URLStreamHandler
See Also:
"java.net.URLStreamHandler.hostsEqual"

sameFile

public boolean sameFile(URL u1,
                        URL u2)
This method calls super.sameFile.

Specified by:
sameFile in interface URLStreamHandlerService
Overrides:
sameFile in class URLStreamHandler
See Also:
"java.net.URLStreamHandler.sameFile"

setURL

protected void setURL(URL u,
                      String proto,
                      String host,
                      int port,
                      String file,
                      String ref)
Deprecated. This method is only for compatibility with handlers written for JDK 1.1.

This method calls realHandler.setURL(URL,String,String,int,String,String).

Overrides:
setURL in class URLStreamHandler
See Also:
"java.net.URLStreamHandler.setURL(URL,String,String,int,String,String)"

setURL

protected void setURL(URL u,
                      String proto,
                      String host,
                      int port,
                      String auth,
                      String user,
                      String path,
                      String query,
                      String ref)
This method calls realHandler.setURL(URL,String,String,int,String,String,String,String) .

Overrides:
setURL in class URLStreamHandler
See Also:
"java.net.URLStreamHandler.setURL(URL,String,String,int,String,String,String,String)"

OSGi™ Core
Release 6

Copyright © OSGi Alliance (2000, 2015). All Rights Reserved. Licensed under the OSGi Specification License, Version 2.0