Class StylesheetURLHandler

java.lang.Object
java.net.URLStreamHandler
atlantafx.base.theme.StylesheetURLHandler

public final class StylesheetURLHandler extends URLStreamHandler
A custom URLStreamHandler that intercepts URLs using the "stylesheet" scheme to support modular CSS stylesheet loading.

The handler processes URIs formatted as stylesheet:/path/to/theme.css?modules=mod1,mod2. When a request contains a modules query parameter, the handler looks for an accompanying manifest file (e.g., theme.manifest) alongside the base CSS file to load and serve only the specified style modules.

The manifest file MUST be located in the same directory as the target stylesheet, sharing the same file name with a .manifest extension (e.g., foo.css.manifest for foo.css).

If the modules parameter is omitted, the manifest file is missing, or an error occurs during module extraction, the handler falls back to reading and returning the entire CSS file.

Usage Example:

// loads only the 'button' and 'tooltip' modules from foo.css
String url = "stylesheet:/foo.css?modules=button,tooltip";
Application.setUserAgentStylesheet(url);
See Also: