Package io.microsphere.net
Class StandardURLStreamHandlerFactory
- java.lang.Object
-
- io.microsphere.net.StandardURLStreamHandlerFactory
-
- All Implemented Interfaces:
java.net.URLStreamHandlerFactory
public class StandardURLStreamHandlerFactory extends java.lang.Object implements java.net.URLStreamHandlerFactory
Standard implementation ofURLStreamHandlerFactory
that creates a new instance of URLStreamHandler for a given protocol.This class uses reflection to access the internal JDK mechanism for retrieving the default factory since JDK 9+, and falls back to loading the handler class via its fully qualified name for JDK 8 and below.
Example Usage
URLStreamHandlerFactory factory = new StandardURLStreamHandlerFactory(); URL.setURLStreamHandlerFactory(factory);
This will allow the application to handle custom protocols by locating the appropriate URLStreamHandler implementation, typically in the package defined by
URLUtils.DEFAULT_HANDLER_PACKAGE_PREFIX
.- Since:
- 1.0.0
- Author:
- Mercy
- See Also:
java.net.URL#getURLStreamHandler(String)
-
-
Constructor Summary
Constructors Constructor Description StandardURLStreamHandlerFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.net.URLStreamHandler
createURLStreamHandler(java.lang.String protocol)
-