org.foray.common.url
Class PropertyProtocolRegistration

java.lang.Object
  extended by org.foray.common.url.AbstractProtocolRegistration
      extended by org.foray.common.url.PropertyProtocolRegistration
All Implemented Interfaces:
ProtocolRegistrationStrategy

public class PropertyProtocolRegistration
extends AbstractProtocolRegistration

An implementation of {#link ProtocolHandlerRegistry} which does not attempt to use a URLStreamHandlerFactory, but instead modifies the "java.protocol.handler.pkgs" property to register new URLStreamHandlers.


Method Summary
 URLStreamHandler getURLStreamHandler(String protocol)
          Finds the registered URLStreamHandler for a given protocol.
static void propertyRegistration(String protocol, URLStreamHandler handler)
          Registers a specific protocol handler by making it available to the Java property "java.protocol.handler.pkgs".
 
Methods inherited from class org.foray.common.url.AbstractProtocolRegistration
registerProtocolHandler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

propertyRegistration

public static void propertyRegistration(String protocol,
                                        URLStreamHandler handler)
Registers a specific protocol handler by making it available to the Java property "java.protocol.handler.pkgs".

Parameters:
protocol - The name of the protocol to register.
handler - An instance of the class that should be registered to handle URLs of type protocol.

getURLStreamHandler

public URLStreamHandler getURLStreamHandler(String protocol)
Description copied from interface: ProtocolRegistrationStrategy
Finds the registered URLStreamHandler for a given protocol.

Parameters:
protocol - The protocol for which a URLStreamHandler is desired.
Returns:
The URLStreamHandler registered with this registration scheme, or null if the protocol has not been registered.


Copyright © 2017. All rights reserved.