Package org.infinispan.commons.util
Class ClasspathURLStreamHandler
java.lang.Object
org.infinispan.commons.util.ClasspathURLStreamHandler
- All Implemented Interfaces:
URLStreamHandlerFactory
A
URLStreamHandlerFactory
which can handle classpath: URI schemes. It will attempt to load resources
from the thread's context classloader (if it exists) and then fallback to the system classloader. The factory must be
registered as the URL stream handler factory using the register()
method.
On Java 9+, this class is available as a URLStreamHandlerProvider service loader implementation which, if present in
the boot classpath, will be automatically registered and used by the URL
class.
- Since:
- 12.1
- Author:
- Tristan Tarrant <tristan@infinispan.org>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateURLStreamHandler
(String protocol) static void
register()
Registers this URL handler as the JVM-wide URL stream handler.
-
Constructor Details
-
ClasspathURLStreamHandler
public ClasspathURLStreamHandler()
-
-
Method Details
-
register
public static void register()Registers this URL handler as the JVM-wide URL stream handler. It can only be invoked once in the lifecycle of an application. Refer to theURL
documentation for restrictions and alternative methods of registration. -
createURLStreamHandler
- Specified by:
createURLStreamHandler
in interfaceURLStreamHandlerFactory
-