Modularizing URLStreamHandlerFactory

Jesse Glick jesse.glick at oracle.com
Fri Jun 15 14:17:32 PDT 2012


Something to consider - in a big application it is not uncommon to have multiple URL handlers implemented in various places. Yet the JRE only lets you set a single 
URLStreamHandlerFactory for the whole JVM. So for the application to be modular, you need to write a proxy factory which accepts modular registrations, but that impedes 
interoperability since you must define a proprietary interface for this.

It would be nicer for a modular JRE to allow URL handler factories to be registered as services. OSGi and the NetBeans module system both do something like this.

Similar arguments could perhaps be made for other pluggable singletons in the current Java platform API (UncaughtExceptionHandler, FileNameMap, ProxySelector, 
HostnameVerifier, SSLSocketFactory, ...) but URLStreamHandlerFactory is the one which I know matters.



More information about the jigsaw-dev mailing list