Package io.github.jbastgen.stemma.app.io
Class WebBrowser
java.lang.Object
io.github.jbastgen.stemma.app.io.WebBrowser
Opens a web address in the user's default browser. Only the address is handed over: nothing is sent by Stemma itself.
Like FileManager, it starts the platform's own command without a shell (open, xdg-open,
rundll32 url.dll,FileProtocolHandler) and falls back to java.awt.Desktop. Only http and
https addresses are accepted, so a setting or a file can never make Stemma start another kind of program.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceThe second way: ask the desktop. -
Method Summary
Modifier and TypeMethodDescriptioncommand(FileManager.Os os, String url) The command that opens the address in the default browser.static booleanisWebAddress(String url) Whether this is an absolutehttporhttpsaddress with a host and nothing a command line could misread.static FileManager.Resultopen(FileManager.Os os, String url, FileManager.Runner runner, WebBrowser.Browse fallback) Opens the address; blocks for at most a few seconds, so call it off the UI thread.static FileManager.ResultOpens the address with the real system.
-
Method Details
-
isWebAddress
Whether this is an absolutehttporhttpsaddress with a host and nothing a command line could misread. -
command
The command that opens the address in the default browser. -
open
public static FileManager.Result open(FileManager.Os os, String url, FileManager.Runner runner, WebBrowser.Browse fallback) Opens the address; blocks for at most a few seconds, so call it off the UI thread. -
open
Opens the address with the real system.
-