java.lang.Object
com.jpro.webapi.WebAPI
Used to interface with the browser.
JPro Documentation: JPro
JPro Link: JPro
HelloWorld: HelloWorld
The WebAPI is typically used for the following use-cases:
- Checking, whether this session is currently running in a browser, with the method
isBrowser() - Executing javascript with the method
executeScript(String)orexecuteScriptWithListener(String, ScriptResultListener) - Register values in the browser with the method
registerValue(String, Node) - Registering a java function which can be called from the browser with javascript. This can be done with the method
registerJavaFunction(String, WebCallback)()} - Handle FileEvents with the method
makeFileUploadNode(Node) - Get information about the browser with
getBrowserSize(),isMobile(),getCookies(),getLanguage()orgetLanguages() - Open a new Stage with
openStageAsTab(Stage)oropenStageAsPopup(Stage)
Example:
The webAPI is usually accessed the following way:
if(WebAPI.isBrowser()) {
WebAPI webAPI = WebAPI.getWebAPI(stage);
webAPI.executeScript(*javascript-code*)
}
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceThis is a functional interface, which is used by the FileUploader.static interfacestatic classstatic interfacestatic interfacestatic interfaceThis class is used for uploading a file.static interfaceInternal class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidAdds a listener to this WebAPI, to get triggered as this session is closing.abstract voidCalling this method closes the current instance.abstract WebAPI.JSFilecreateJSFile(String objectURL, String filename, long size) Creates aWebAPI.JSFileobject.abstract StringcreatePublicFile(URL url) Creates a public profile for a givenurl.abstract StringCreates a unique name, which can be used in JavaScript code.abstract StringcreateUniqueJSName(String prefix) Creates a unique name with the given prefix, which can be used in JavaScript code.static javafx.scene.image.ImagecreateVirtualImage(String url, int w, int h) Creates a virtual image that does not allocate any memory in the RAM.static javafx.scene.image.ImagecreateVirtualImage(String url, int w, int h, boolean jproServerAsProxy) Creates a virtual image that does not allocate any memory in the RAM.abstract javafx.beans.property.ReadOnlyBooleanPropertydarkMode()A boolean property that changes value when the dark mode is activated or deactivated.abstract voiddeleteCookie(String key) Deletes a cookie from the current browser session.abstract javafx.beans.property.ReadOnlyDoublePropertyRetrieves the device pixel ratio in the current browser tab.abstract voiddownloadResource(String resource) Downloads content from the given resourceurl.abstract voiddownloadResource(String resource, Runnable cleanup) Downloads content from the given resourceurl.abstract voiddownloadURL(URL url) Downloads content from the givenurl.abstract voiddownloadURL(URL url, Runnable cleanup) Downloads content from the givenurl.abstract CompletableFuture<JSVariable>executeJSAsync(String code) Writes a function which contains asynchronous code and can be accessed with the JSVariable after it's finished.abstract JSVariableexecuteJSAsyncPromise(String code) Writes a function which contains asynchronous code.abstract voidexecuteScript(String code) Deprecated.abstract CompletableFuture<String>Deprecated.abstract voidexecuteScriptWithListener(String code, ScriptResultListener listener) Deprecated.abstract StringExecutes Javascriptcodein the currently hosting browser.abstract JSVariableDeprecated.abstract javafx.geometry.Rectangle2DRetrieves the window size of the currently hosting browser.abstract StringReturns the URL, which was used to call this session.Retrieves the cookies of the current browser window.abstract doubleRetrieves the current value of the device pixel ratio in the current browser tab.abstract JSVariablegetElement(javafx.scene.Node node) This return a JSVariable, which reference the HTMLElement of the given node.Retrieves all the headers provided to this session.abstract JSVariablegetHTMLViewElement(HTMLView node) This return a JSVariable, which reference the HTMLElement of the given HTMLView.abstract StringReturns the ID of the current session.abstract InstanceInfoReturns information about this running instance.abstract StringRetrieves the preferred language of the currently hosting browser.Retrieves the list of preferred languages of the currently hosting browser.abstract LocaleRetrieves the preferred locale of the currently hosting browser.abstract StringRetrieves the String returned by the `navigator.userAgentData.platform` property.abstract StringRetrieves the String returned by the `navigator.platform` property.abstract StringReturns the server address used to instantiate the currently running session.static ServerInfoReturns information about the current running server.Deprecated.abstract TimeZoneRetrieves the preferred time zone of the currently hosting browser.Retrieves all query parameters from the URL that was used to create the current session.static voidgetWebAPI(javafx.scene.Node node, WebAPIConsumer consumer) Returns the WebAPI implementation interface for the platform the application is currently running on.static WebAPIgetWebAPI(javafx.scene.Scene scene) Returns the WebAPI implementation interface for the platform the application is currently running on.static WebAPIgetWebAPI(javafx.stage.Window window) Returns the WebAPI implementation interface for the platform the application is currently running on.Retrieves the cookies associated with the WebSocket connection.static booleanReturnstrueif the implementation is for a browser.abstract booleanRetrieves the current value of the propertydarkMode().abstract booleanisMobile()Determines whether the current session is running on a mobile device (Android or iOS).abstract JSjs()Returns as JS object, with which JavaScript code can be executed.abstract voidlayoutRoot(javafx.scene.Scene scene) Updates the width and height of the provided Scene.abstract voidloadCSSFile(URL url) Loads a CSS file into the browser.abstract voidloadJSFile(URL url) Loads and executes the js file in the currently hosting browser.abstract voidloadNode(javafx.scene.Node node) This loads the node into the browser.abstract WebAPI.FileUploadermakeFileUploadNode(javafx.scene.Node node) Returns aFileUploaderfor a specificnode.static WebAPI.FileUploadermakeFileUploadNodeStatic(javafx.scene.Node node) Returns aFileUploaderfor a specificnodeabstract WebAPI.MultiFileUploadermakeMultiFileUploadNode(javafx.scene.Node node) Returns aWebAPI.MultiFileUploaderfor a specificnode.static WebAPI.MultiFileUploadermakeMultiFileUploadNodeStatic(javafx.scene.Node node) Returns aMultiFileUploaderfor a specificnodeabstract voidopenLocalResource(String resource) Opens content from the given resourceurl.abstract voidopenLocalURL(URL url) Opens content from the givenurl.abstract voidopenStageAsPopup(javafx.stage.Stage stage) Opens the given stage in a new popup.abstract voidopenStageAsTab(javafx.stage.Stage stage) Opens the given stage in a new tab.abstract voidopenStageAsTab(javafx.stage.Stage stage, String target) Opens the given stage in a new tab.abstract voidOpens the givenurlin the current tab.abstract voidopenURLAsPopup(String url) Opens the givenurlin a new popup.abstract voidopenURLAsTab(String url) Opens the givenurlin a new tab.abstract JSVariableregisterJavaFunction(WebCallback callback) Writes a function which can be accessed with the js-variable.abstract voidregisterJavaFunction(String name, WebCallback callback) Writes a function into the javascript-variable jpro.*name*.abstract JSVariableregisterJavaFunctionWithVariable(Consumer<JSVariable> callback) Writes a function which can be accessed with the js-variable.abstract voidregisterValue(String name, String value) Deprecated.abstract voidregisterValue(String name, javafx.scene.Node value) Deprecated.abstract StringregisterWindow(javafx.stage.Window window) This method returns an id, which can be used to start the specified window in a new JProTag.abstract voidRemoves a listener from this WebAPI.abstract voidrequestLayout(javafx.scene.Scene scene) Deprecated.abstract voidrunAfterUpdate(Runnable runnable) abstract voidSets a new cookie in the current browser session.abstract voidsetLossless(javafx.scene.image.Image image, boolean value) Sets whether the Image must be transmitted lossless.static voidsetLosslessStatic(javafx.scene.image.Image image, boolean value) Sets whether the Image must be transmitted lossless.static voidsetWebAPIImpl(Class<?> clazz, BiConsumer<javafx.scene.Node, WebAPIConsumer> _getWebAPIImpl, WebAPI.WebAPIStatic staticImpl) Internal method.abstract JSVariableWraps a node in a tag.
-
Constructor Details
-
WebAPI
public WebAPI()
-
-
Method Details
-
isBrowser
public static boolean isBrowser()Returnstrueif the implementation is for a browser. An alternative way to check isBrowser is checking the propertyBoolean.getBoolean("jpro.isbrowser")- Returns:
trueif implementation for browser;falseotherwise.
-
getWebAPI
Returns the WebAPI implementation interface for the platform the application is currently running on.- Parameters:
window- The window, which is associated with a Session.- Returns:
- An instance of WebAPI which can be used to interface with the browser.
- Throws:
RuntimeException- ifisBrowserisfalse
-
getWebAPI
Returns the WebAPI implementation interface for the platform the application is currently running on.- Parameters:
scene- The scene, which is associated with a Session.- Returns:
- An instance of WebAPI which can be used to interface with the browser.
- Throws:
RuntimeException- ifisBrowserisfalse
-
getWebAPI
Returns the WebAPI implementation interface for the platform the application is currently running on.- Parameters:
node- A node, which gets added to a scene which is associated with a Session.consumer- Gets executed, when the scene of the node is set.- Since:
- 2019.1.0
-
setWebAPIImpl
public static void setWebAPIImpl(Class<?> clazz, BiConsumer<javafx.scene.Node, WebAPIConsumer> _getWebAPIImpl, WebAPI.WebAPIStatic staticImpl) Internal method. Do not use.- Parameters:
clazz- The class of the WebAPI implementation.
-
getInstanceInfo
Returns information about this running instance.- Returns:
- an
InstanceInfoobject containing instance information about this session.
-
getServerName
Deprecated.UsegetBrowserURL()instead.Returns the url, which was used to call this session.- Returns:
- The name of the server on which this session is currently running.
-
getBrowserURL
Returns the URL, which was used to call this session.- Returns:
- The URL string on which this session is currently running.
-
setCookie
Sets a new cookie in the current browser session. After this method is called, the map returned bygetCookies()will be updated to reflect the new cookie. The cookie will not expire unless manually removed.- Parameters:
key- The name of the cookie to set.value- The value of the cookie.
-
deleteCookie
Deletes a cookie from the current browser session. After this method is called, the map returned bygetCookies()will be updated to reflect the removal of the cookie.- Parameters:
key- The name of the cookie to delete.
-
getCookies
Retrieves the cookies of the current browser window. The returned cookies are identical to the cookies accessible viadocument.cookiein the browser.- Returns:
- An observable map of the browser window's cookies.
-
getWebsocketCookies
Retrieves the cookies associated with the WebSocket connection. The content of these cookies may differ from those retrieved bygetCookies()due to different domains.- Returns:
- A map containing the WebSocket connection's cookies.
-
isMobile
public abstract boolean isMobile()Determines whether the current session is running on a mobile device (Android or iOS).- Returns:
trueif the session is running on a mobile device,falseotherwise.
-
getLanguage
Retrieves the preferred language of the currently hosting browser.- Returns:
- The preferred language of the hosting browser.
-
getLanguages
Retrieves the list of preferred languages of the currently hosting browser. The first element in the list represents the language with the highest priority.- Returns:
- A list of preferred languages of the hosting browser.
-
getPlatformOld
Retrieves the String returned by the `navigator.platform` property. This JavaScript property is deprecated but widely supported. If it is not available, this method returns `null`. It is recommended to use `getPlatform()` and `getPlatformOld()` together for compatibility. A more elegant API is provided in the jpro-platform library.- Returns:
- the value of the `navigator.platform` property, or `null` if unavailable.
-
getPlatform
Retrieves the String returned by the `navigator.userAgentData.platform` property. This JavaScript property is recommended but not widely supported. If it is not available, this method returns `null`. It is recommended to use `getPlatform()` and `getPlatformOld()` together for compatibility. A more elegant API is provided in the jpro-platform library.- Returns:
- the value of the `navigator.userAgentData.platform` property, or `null` if unavailable.
-
getLocale
Retrieves the preferred locale of the currently hosting browser.- Returns:
- The locale of the hosting browser.
-
getTimeZone
Retrieves the preferred time zone of the currently hosting browser.- Returns:
- The time zone of the hosting browser.
-
getURLQueryParams
Retrieves all query parameters from the URL that was used to create the current session.- Returns:
- A map containing the query parameters and their values from the session URL. If no query parameters are present, an empty map is returned.
-
getHeaders
Retrieves all the headers provided to this session.- Returns:
- A map containing all the headers for this session.
-
getBrowserSize
public abstract javafx.geometry.Rectangle2D getBrowserSize()Retrieves the window size of the currently hosting browser.- Returns:
- The size of the hosting browser window as a
Rectangle2Dobject.
-
darkMode
public abstract javafx.beans.property.ReadOnlyBooleanProperty darkMode()A boolean property that changes value when the dark mode is activated or deactivated. -
isDarkMode
public abstract boolean isDarkMode()Retrieves the current value of the propertydarkMode().- Returns:
trueif dark mode is active,falseotherwise.
-
devicePixelRatio
public abstract javafx.beans.property.ReadOnlyDoubleProperty devicePixelRatio()Retrieves the device pixel ratio in the current browser tab. The value can change when the tab is moved to a different screen or when the browser's zoom level is adjusted. -
getDevicePixelRatio
public abstract double getDevicePixelRatio()Retrieves the current value of the device pixel ratio in the current browser tab.- Returns:
- The current device pixel ratio as a
double.
-
getInstanceID
Returns the ID of the current session.- Returns:
- an ID string which represents the current session.
-
getServer
Returns the server address used to instantiate the currently running session. It hast the form: "host:port".- Returns:
- the server address string.
-
addInstanceCloseListener
Adds a listener to this WebAPI, to get triggered as this session is closing. If this session is already closed, the listener gets triggered immediately.- Parameters:
listener- The listener to add.
-
removeInstanceCloseListener
Removes a listener from this WebAPI. This listener will no longer get triggered when the session gets closed.- Parameters:
listener- The listener to be removed.
-
loadJSFile
Loads and executes the js file in the currently hosting browser. Each url is only loaded once, even when called multiple times.- Parameters:
url- The url of the JavaScript file, which gets loaded. The js file must be accessible from the server.
-
loadCSSFile
Loads a CSS file into the browser. Each url is only loaded once, even when called multiple times.- Parameters:
url- The url of the CSS file, which gets loaded. The CSS file must be accessible from the server.
-
js
Returns as JS object, with which JavaScript code can be executed.- Returns:
- a JS object, with which JavaScript code can be executed.
-
executeScript
Deprecated.Executes JavaScriptcodein the currently hosting browser. useJS.eval(String)instead.- Parameters:
code- The code to be executed.
-
executeScriptWithReturn
Executes Javascriptcodein the currently hosting browser. The execution will block until it returns.- Parameters:
code- The code to be executed.- Returns:
- The return value of the code.
-
createUniqueJSName
Creates a unique name, which can be used in JavaScript code.- Returns:
- return an unused name, which can be used in JavaScript.
-
createUniqueJSName
Creates a unique name with the given prefix, which can be used in JavaScript code.- Parameters:
prefix- A prefix for generated name.- Returns:
- return an unused name, which can be used in JavaScript.
-
executeScriptWithVariable
Deprecated.Executes Javascript code in the currently hosting browser and returns the result as a JSVariable. UseJS.eval(String)instead.- Parameters:
code- The JavaScript code to be executed.- Returns:
- JSVariable, containing the result of the code.
-
executeScriptWithListener
@Deprecated public abstract void executeScriptWithListener(String code, ScriptResultListener listener) Deprecated.Executes Javascriptcodein the currently hosting browser and assigns a listener to the execution result. UseJS.eval(String)instead.- Parameters:
code- The code which gets executed.listener- The listener which executed with the return value of the code.
-
executeScriptWithFuture
Deprecated.Executes Javascriptcodein the currently hosting browser. The result will be returned as a CompletableFuture. UseJS.evalFuture(String).getString().thenAccept(listener) instead.- Parameters:
code- The code which gets executed.- Returns:
- A CompletableFuture, which contains the result of the code.
- Since:
- 2023.3.2
-
createPublicFile
Creates a public profile for a givenurl.- Parameters:
url- The url for the resource to be profiled. The url must accessible from the server.- Returns:
- url The url or the resource to be profiled. The url must be callable from the client.
-
downloadURL
Downloads content from the givenurl.- Parameters:
url- The url from where to download. The url must be accessible from the server.
-
downloadURL
Downloads content from the givenurl.- Parameters:
url- The url from where to download. The url must be accessible from the server.cleanup- gets executed after the resource was read by the server.
-
downloadResource
Downloads content from the given resourceurl.- Parameters:
resource- The resource from where to download. The resource must be accessible from the server.
-
downloadResource
Downloads content from the given resourceurl.- Parameters:
resource- The resource from where to download. The resource must be accessible from the server.cleanup- gets executed after the resource was read by the server.
-
openLocalURL
Opens content from the givenurl.- Parameters:
url- The url to be opened. The url must be accessible from the server.
-
openLocalResource
Opens content from the given resourceurl.- Parameters:
resource- The resource to be opened. The resource must be accessible from the server.
-
registerValue
Deprecated.Writes the id of the node into the javascript-variable jpro.*name*. usegetElement(Node)instead.- Parameters:
name- The name of the node.value- The node to be given an alias.
-
registerValue
Deprecated.Writes the value as json into the javascript-variable jpro.*name*.- Parameters:
name- The name of the variable.value- The node in the scenegraph.
-
getElement
This return a JSVariable, which reference the HTMLElement of the given node.- Parameters:
node- The node, which HTMLElement should be referenced.- Returns:
- a JSVariable, which reference the HTMLElement of the given node.
- Since:
- 2023.2.1
-
getHTMLViewElement
This return a JSVariable, which reference the HTMLElement of the given HTMLView.- Parameters:
node- The node, which HTMLElement should be referenced.- Returns:
- a JSVariable, which reference the HTMLElement of the given node.
- Since:
- 2023.2.2
-
wrapNode
Wraps a node in a tag. Make sure to not change anything regarding rendering. This can be used to better confirm to the HTML standard.- Parameters:
tag- The tag, which should be used to wrap the node.node- The node, which should be wrapped.- Returns:
- a JSVariable, which reference the HTMLElement of the given node.
- Since:
- 2023.2.2
-
loadNode
This loads the node into the browser. The node and all are children will be sent to the browser. Afterward, showing the node in the browser is very fast and no further communication with the server is needed.- Parameters:
node- The JavaFX node, which should be loaded.- Since:
- 2023.2.2
-
registerJavaFunction
Writes a function into the javascript-variable jpro.*name*. When this function is called, it's argument is sent to the JPro server, and used to call the callback.- Parameters:
name- The name of the function. It will be accessible in JavaScript with jpro.*name*.callback- The java function, which will get called when the JavaScript function is called.
-
registerJavaFunction
Writes a function which can be accessed with the js-variable. When this function is called, it's argument is sent to the JPro server, and used to call the callback. It will be cleaned up, when the JSVariable is no longer referenced.- Parameters:
callback- The java function, which will get called when the javascript function is called.
-
registerJavaFunctionWithVariable
Writes a function which can be accessed with the js-variable. When this function is called, the argument will be mapped to a JSVariable and sent to the JPro server and used to call the callback. The function will be cleaned up, when the JSVariable is no longer referenced.- Parameters:
callback- The java function, which will get called when the javascript function is called. It is called with an JSVariable.- Returns:
- a JSVariable, which contains the function.
- Since:
- 2023.3.2
-
executeJSAsync
Writes a function which contains asynchronous code and can be accessed with the JSVariable after it's finished. The JSVariable is accessible after the CompletableFuture is finished and contains the result of the code. The code should use a return statement. Otherwise, the result will be undefined.- Parameters:
code- The JavaScript code to be executed.- Returns:
- a CompletableFuture, which contains the result of the code.
- Since:
- 2023.3.2
-
executeJSAsyncPromise
Writes a function which contains asynchronous code. The result can be accessed with the JSVariable as a js-promise. The code should use a return statement. Otherwise, the result will be undefined.- Parameters:
code- The JavaScript code to be executed.- Returns:
- a JSVariable, which contains a js-promise.
- Since:
- 2023.3.2
-
layoutRoot
public abstract void layoutRoot(javafx.scene.Scene scene) Updates the width and height of the provided Scene. It is usually called by the root of the Scene.- Parameters:
scene- The scene which gets layout.
-
requestLayout
Deprecated.Updates the width and height of the provided Scene. It is usually called by the root of the Scene.This method is deprecated. Use
layoutRoot(Scene)instead.- Parameters:
scene- The scene which gets layout.
-
openURL
Opens the givenurlin the current tab.- Parameters:
url- The url which will be opened.- Since:
- 2019.2.5
-
registerWindow
This method returns an id, which can be used to start the specified window in a new JProTag. It's used like this <jpro-app href="/app/$id"></jpro-app>- Parameters:
window- The window which should be opened.- Returns:
- The id which can be used for a jpro-tag.
- Since:
- 2022.1.6
-
openURLAsTab
Opens the givenurlin a new tab.- Parameters:
url- The url which will be opened.- Since:
- 2019.2.5
-
openURLAsPopup
Opens the givenurlin a new popup.- Parameters:
url- The url which will be opened.- Since:
- 2019.2.5
-
openStageAsPopup
Opens the given stage in a new popup.- Parameters:
stage- The stage which gets opened as a popup. It's important that the owner of the Stage is null, because otherwise the stage is shown as a frame in the owner.- Throws:
IllegalStateException- The owner of the stage must be null.- Since:
- 2019.1.0
-
openStageAsTab
Opens the given stage in a new tab.- Parameters:
stage- The stage which gets opened as a tab. It's important that the owner of the Stage is null, because otherwise the stage is shown as a frame in the owner.- Throws:
IllegalStateException- The owner of the stage must be null.- Since:
- 2019.1.0
-
openStageAsTab
public abstract void openStageAsTab(javafx.stage.Stage stage, String target) throws IllegalStateException Opens the given stage in a new tab. The target specifies the name of the browsing context.- Parameters:
stage- The stage which gets opened as a tab. It's important that the owner of the Stage is null, because otherwise the stage is shown as a frame in the owner.target- A string, without whitespace, specifying the name of the browsing context the stage is being loaded into. If the name doesn't identify an existing context, a new context is created and given the specified name. The special target keywords, _self, _blank, _parent, _top, and can also be used.- Throws:
IllegalStateException- The owner of the stage must be null.- Since:
- 2024.3.3
-
runAfterUpdate
- Parameters:
runnable- The task which gets executed next. The runnable is executed, after the current state of the scene graph is sent to the client. This can be useful to load a page incrementally- Since:
- 2019.1.0
-
makeMultiFileUploadNode
Returns aWebAPI.MultiFileUploaderfor a specificnode.- Parameters:
node- The node which will be used for accessing files.- Returns:
WebAPI.FileUploaderof a specific node.
-
makeFileUploadNode
Returns aFileUploaderfor a specificnode.- Parameters:
node- The node which will be used for accessing files.- Returns:
WebAPI.FileUploaderof a specific node.
-
createJSFile
Creates aWebAPI.JSFileobject.- Parameters:
objectURL- The object URL of the file.filename- The filename of the file.size- The size of the file in bytes.- Returns:
- the
WebAPI.JSFileobject.
-
setLossless
public abstract void setLossless(javafx.scene.image.Image image, boolean value) Sets whether the Image must be transmitted lossless. The default value is true. It must be called before the image is serialized by JPro. This is useful for optimizing the size of images. A typical use case would be to set lossless to false for a dynamically created WritableImage. Then this Image would be sent to the client in a more compressed image format.- Since:
- 2019.2.2
-
makeFileUploadNodeStatic
Returns aFileUploaderfor a specificnode- Parameters:
node- The node which will be used for accessing files.- Returns:
FileUploaderof a specific node.
-
makeMultiFileUploadNodeStatic
Returns aMultiFileUploaderfor a specificnode- Parameters:
node- The node which will be used for accessing files.- Returns:
MultiFileUploaderof a specific node.
-
setLosslessStatic
public static void setLosslessStatic(javafx.scene.image.Image image, boolean value) Sets whether the Image must be transmitted lossless. The default value is true. It must be called before the image is serialized by JPro. This is useful for optimizing the size of images. A typical use case would be to set lossless to false for a dynamically created WritableImage. Then this Image would be sent to the client in a more compressed image format.- Since:
- 2022.1.0
-
createVirtualImage
Creates a virtual image that does not allocate any memory in the RAM. When rendered in the browser, the specified resource is downloaded directly. HTTP URLs are downloaded directly by the client, whereas file resources are accessed through the JPro server.- Parameters:
url- The URL of the image resource.w- The width of the virtual image.h- The height of the virtual image.- Returns:
- A virtual image object representing the specified image.
- Since:
- 2022.1.0
-
createVirtualImage
public static javafx.scene.image.Image createVirtualImage(String url, int w, int h, boolean jproServerAsProxy) Creates a virtual image that does not allocate any memory in the RAM. The image resource is downloaded directly when rendered in the browser. IfjproServerAsProxyistrue, the image URL is handled by the JPro server, allowing the server to act as a proxy. IfjproServerAsProxyisfalse, the image URL is accessed directly by the client.- Parameters:
url- The URL of the image resource.w- The width of the virtual image.h- The height of the virtual image.jproServerAsProxy- determines whether the JPro server will act as a proxy for the URL- Returns:
- a virtual image object representing the specified image
- Since:
- 2022.1.0
-
closeInstance
public abstract void closeInstance()Calling this method closes the current instance. This can be used to trigger a reconnect, to create a fresh instance. -
getServerInfo
Returns information about the current running server.- Returns:
- an
ServerInfoobject containing server information about this session.
-
getBrowserURL()instead.