RFR: 8267551: Support loading images from inline data-URIs
Michael Strauß
michaelstrau2 at gmail.com
Sat Jun 5 14:36:46 UTC 2021
That's a good question, and probably a valid approach.
However, while app developers are certainly used to depending on
third-party libraries for things like additional controls, I think
it's questionable whether it's a good developer experience to needing
to rely on the third-party ecosystem for core behavior.
We could ship a custom `URLStreamHandler` with the javafx-graphics
library, but that presents its own set of problems if app developers
use fat jars and have their own implementations for
`URLStreamHandlerProvider`. In this case, our implementation might
silently fail because it is replaced by an application-provided
`META-INF/services/java.net.spi.URLStreamHandlerProvider` file. While
this can of course be worked around by using a resource transformer
that merges all files of this kind, it is one more non-obvious thing
that app developers need to know about.
Am Sa., 5. Juni 2021 um 10:17 Uhr schrieb John Hendrikx <hjohn at xs4all.nl>:
>
> I have a question about this.
>
> Why would you make this part of JavaFX directly instead of offering it
> as a dependency that people can include in their project?
>
> As far as I know, it is possible to register custom URL handlers in
> Java, which should be used automatically by JavaFX assuming it
> constructs its URL's in the standard way when extracting them from the CSS.
>
> This can be done since Java 9+ via URLStreamHandlerProvider. You need to
> store the name of your provider in `META-INF/services`.
>
> Any reason why this route isn't being taken?
>
> --John
More information about the openjfx-dev
mailing list