Class EngineOptions
Engine
instances.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
A builder class to construct engine options. -
Method Summary
Modifier and TypeMethodDescriptionReturns an absolute path to the directory where Chromium binaries are located or the empty string if it was not set.Returns anOptional
that contains the disk cache size in bytes or an emptyOptional
if the disk cache size was not set.Returns anOptional
that contains a string representing the Google API key or an emptyOptional
if the Google API key was not set.Returns anOptional
that contains a string representing the Google client ID or an emptyOptional
if the Google client ID was not set.Returns anOptional
that contains a string representing the Google client secret or an emptyOptional
if the Google client secret was not set.boolean
Indicates whether video playback will automatically start after page loading.boolean
Indicates whether Chromium services that cause additional traffic are disabled.boolean
Indicates whether DNS Quick Check is disabled in proxy resolution.boolean
Indicates whether file access from files is allowed.boolean
Indicates whether GPU is disabled.boolean
Indicates whether the default profile of theEngine
instance is incognito.boolean
Indicates whether media routing is enabled for theEngine
instance.boolean
Indicates whether the given proprietary feature is enabled.boolean
Indicates whether the sandbox is disabled.boolean
Indicates whether touch popup menu is disabled.boolean
Indicates whether the same-origin policy is disabled.language()
Returns the Chromium language that is used on the default error pages and message dialogs.Returns anOptional
that contains a string representing the license key or an emptyOptional
if the license key was not set.static EngineOptions.Builder
newBuilder
(RenderingMode renderingMode) Creates a newEngineOptions
builder.Returns anOptional
that contains the password store type or an emptyOptional
if the password store type was not set.Returns a set of enabled proprietary features.Returns anOptional
that contains the number representing the remote debugging port or an emptyOptional
if the remote debugging port was not set.Returns how many seconds JavaScript can block the page before it is considered hanged.Returns the rendering mode indicating how the content of the web pages will be rendered.schemes()
Returns an immutable map of the schemes that will be intercepted.Returns an immutable list of the insecure origins that will be treated as secure.switches()
Returns an immutable list of the Chromium switches that will be passed to the Chromium Main process.Returns anOptional
that contains a string that is used to override the default user agent or an emptyOptional
if the custom user agent string was not set.Returns an absolute path to the directory where the user data is stored.
-
Method Details
-
newBuilder
Creates a newEngineOptions
builder.- Parameters:
renderingMode
- the rendering mode that indicates how the content of the web pages will be rendered
-
userDataDir
Returns an absolute path to the directory where the user data is stored.The user data directory stores the data such as cache, cookies, history, GPU cache, local storage, visited links, web data, spell checking dictionary files, etc.
Important: the user data directory cannot be used at the same time by multiple
Engine
instances running in a single or different applications. -
chromiumDir
Returns an absolute path to the directory where Chromium binaries are located or the empty string if it was not set.If the directory contains the Chromium binaries, the library will check them and make sure that they are compatible with the current library version. If the directory does not contain the Chromium binaries, or the binaries aren't compatible with the current library version, the library will search for the binaries inside the JAR files from the application classpath and extract them into the given directory programmatically. It might take some time to extract the Chromium binaries from a JAR archive. The time depends on the hardware (CPU and SSD/HDD) performance.
-
licenseKey
Returns anOptional
that contains a string representing the license key or an emptyOptional
if the license key was not set.The license key can be set via the "jxbrowser.license.key" system property or individually for every
Engine
using theEngineOptions.Builder.licenseKey(String)
method. -
userAgent
Returns anOptional
that contains a string that is used to override the default user agent or an emptyOptional
if the custom user agent string was not set. -
googleApiKey
Returns anOptional
that contains a string representing the Google API key or an emptyOptional
if the Google API key was not set.Some Chromium features such as Geolocation, Spelling, Speech, etc. use Google APIs, and to access those APIs, an API Key, OAuth 2.0 client ID, and client secret are required. Setting up API keys is optional. If you do not do it, the specific APIs using Google services won't work.
-
googleDefaultClientId
Returns anOptional
that contains a string representing the Google client ID or an emptyOptional
if the Google client ID was not set.Some Chromium features such as Geolocation, Spelling, Speech, etc. use Google APIs, and to access those APIs, an API Key, OAuth 2.0 client ID, and client secret are required. Setting up API keys is optional. If you do not do it, the specific APIs using Google services won't work.
-
googleDefaultClientSecret
Returns anOptional
that contains a string representing the Google client secret or an emptyOptional
if the Google client secret was not set.Some Chromium features such as Geolocation, Spelling, Speech, etc. use Google APIs, and to access those APIs, an API Key, OAuth 2.0 client ID, and client secret are required. Setting up API keys is optional. If you do not do it, the specific APIs using Google services won't work.
-
renderingMode
Returns the rendering mode indicating how the content of the web pages will be rendered. -
language
Returns the Chromium language that is used on the default error pages and message dialogs.By default, the language is dynamically configured according to the default locale of the application. If the list of supported languages does not contain the language obtained from the application locale, then the US English language is used. The current option allows you to override the default behavior and configure the Chromium engine with the given language.
-
remoteDebuggingPort
Returns anOptional
that contains the number representing the remote debugging port or an emptyOptional
if the remote debugging port was not set.This option enables remote debugging over HTTP at the specific port. When remote debugging is enabled, you can navigate to the
http://localhost:<port>
address from anotherBrowser
instance or from the Google Chrome browser and debug the loaded web pages using Chrome DevTools. If you use Google Chrome browser for remote debugging, its version must be equal to the Chromium engine version that is used in JxBrowser. -
rendererHangTimeout
Returns how many seconds JavaScript can block the page before it is considered hanged.By default, it can block for
15
seconds. -
passwordStore
Returns anOptional
that contains the password store type or an emptyOptional
if the password store type was not set. The password store type specifies which storage backend should be used to encrypt cookies on Linux.If the password store type was not set, then the encryption storage backend is chosen by Chromium engine automatically.
-
diskCacheSize
Returns anOptional
that contains the disk cache size in bytes or an emptyOptional
if the disk cache size was not set.If the disk cache size was not set, then it will be calculated automatically. The size depends on the available disk space in the volume where the disk cache is located.
-
isIncognitoEnabled
public boolean isIncognitoEnabled()Indicates whether the default profile of theEngine
instance is incognito.In the incognito mode the user data such as browsing history, cookies, site data, and the information entered in forms are stored in memory and released once you close the
Engine
. -
isMediaRoutingEnabled
public boolean isMediaRoutingEnabled()Indicates whether media routing is enabled for theEngine
instance.By default, it is disabled.
- Since:
- 7.29
-
isSandboxDisabled
public boolean isSandboxDisabled()Indicates whether the sandbox is disabled. -
isWebSecurityDisabled
public boolean isWebSecurityDisabled()Indicates whether the same-origin policy is disabled. -
isFileAccessFromFilesAllowed
public boolean isFileAccessFromFilesAllowed()Indicates whether file access from files is allowed. -
isAutoplayEnabled
public boolean isAutoplayEnabled()Indicates whether video playback will automatically start after page loading. -
isGpuDisabled
public boolean isGpuDisabled()Indicates whether GPU is disabled. -
isDnsQuickCheckDisabled
public boolean isDnsQuickCheckDisabled()Indicates whether DNS Quick Check is disabled in proxy resolution.By default, it is enabled.
This is a performance optimization for WPAD (Web Proxy Auto-Discovery) which places a 1-second timeout on resolving the DNS for PAC script URLs.
For instance, if the DNS resolution for WPAD takes longer than 1 second, auto-detection will give up and fallback to the next proxy configuration (which could be manually configured proxy server rules, or an implicit fallback to
ProxyType.DIRECT
connections).- Since:
- 7.29
-
isTouchMenuDisabled
public boolean isTouchMenuDisabled()Indicates whether touch popup menu is disabled.- Since:
- 7.1
-
isChromiumTrafficDisabled
public boolean isChromiumTrafficDisabled()Indicates whether Chromium services that cause additional traffic are disabled.- Since:
- 7.10
-
isProprietaryFeatureEnabled
Indicates whether the given proprietary feature is enabled.By default, all the proprietary features are disabled.
- Parameters:
feature
- an instance ofProprietaryFeature
representing the feature to check- Since:
- 7.4
-
proprietaryFeatures
Returns a set of enabled proprietary features.- Since:
- 7.8
-
secureOriginWhiteList
Returns an immutable list of the insecure origins that will be treated as secure.- Since:
- 7.2
-
switches
Returns an immutable list of the Chromium switches that will be passed to the Chromium Main process.The library does not support all the possible Chromium switches, so there is no guarantee that the passed switches will work. The switches from this list will overwrite the corresponding options configured through the
EngineOptions.Builder
.For example, if you configure the remote debugging port using the
EngineOptions.Builder.remoteDebuggingPort(int)
method and then add the--remote-debugging-port
switch using theEngineOptions.Builder.addSwitch(String)
method, then the port from the switch will be used. -
schemes
Returns an immutable map of the schemes that will be intercepted.
-