public final class HostServices
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private HostServicesDelegate |
delegate |
Constructor and Description |
---|
HostServices(Application app)
Package scope constructor to create the HostServices object.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getCodeBase()
Gets the code base URI for this application.
|
java.lang.String |
getDocumentBase()
Gets the document base URI for this application.
|
java.lang.String |
resolveURI(java.lang.String base,
java.lang.String rel)
Resolves the specified relative URI against the base URI and returns
the resolved URI.
|
void |
showDocument(java.lang.String uri)
Opens the specified URI in a new browser window or tab.
|
HostServices(Application app)
app
- the application classpublic final java.lang.String getCodeBase()
public final java.lang.String getDocumentBase()
public final java.lang.String resolveURI(java.lang.String base, java.lang.String rel)
Example:
HostServices services = getHostServices(); String myImage = services.resolveURI(services.getDocumentBase(), "image.jpg"); Image image = new Image(myImage);
base
- the base URI against which to resolve the relative URIrel
- the relative URI to be resolvedjava.lang.NullPointerException
- if either the base
or the
rel
strings are null.java.lang.IllegalArgumentException
- if there is an error parsing either
the base
or rel
URI strings, or if there is
any other error in resolving the URI.public final void showDocument(java.lang.String uri)
uri
- the URI of the web page that will be opened in a browser.