Ugly things done to support multiple ContentHandlerFactory and URLStreamHandlerFactory
Alan Bateman
Alan.Bateman at oracle.com
Thu Oct 13 16:48:56 UTC 2016
On 13/10/2016 17:23, Thomas Watson wrote:
> :
>
> Thanks for the pointer Alan. I'll have a look. Is there any
> additional documentation on this besides the javadoc? At first glance
> it is unclear to me what discovers the providers? Is the the URL
> class itself based on the thread context class loader? How do
> providers interact with the statically set factory. I also don't see
> a provider SPI type for java.net.ContentHandlerFactory.
The javadoc for the 4-arg URL constructor has all the details on how it
interacts with the system-wide stream handler factory, also how the
system class loader is used to locate protocol handlers that are
intended to used system-wide (this includes the ability to override
non-core protocol handlers). I've no doubt that this won't be exactly
what you want but I hope you can see how URLStreamHandlerProvider is
used as the service type.
There are also updates to allow ContentHandlerFactory implementations be
deployed as modules. The details on that are in the javadoc for
URLConnection::getContent. This one did not need introducing a new
service type.
-Alan.
More information about the jigsaw-dev
mailing list