public final class EngineOptions
extends java.lang.Object
Engine
instances.Modifier and Type | Class and Description |
---|---|
static class |
EngineOptions.Builder
A builder class to construct engine options.
|
Modifier and Type | Method and Description |
---|---|
java.nio.file.Path |
chromiumDir()
Returns an absolute path to the directory where Chromium binaries are located or the empty
string if it was not set.
|
java.util.Optional<java.lang.Long> |
diskCacheSize()
Returns an
Optional that contains the disk cache size in bytes or an empty Optional if the disk cache size was not set. |
java.util.Optional<java.lang.String> |
googleApiKey()
Returns an
Optional that contains a string representing the Google API key or an
empty Optional if the Google API key was not set. |
java.util.Optional<java.lang.String> |
googleDefaultClientId()
Returns an
Optional that contains a string representing the Google client ID or an
empty Optional if the Google client ID was not set. |
java.util.Optional<java.lang.String> |
googleDefaultClientSecret()
Returns an
Optional that contains a string representing the Google client secret or
an empty Optional if the Google client secret was not set. |
boolean |
isAutoplayEnabled()
Indicates whether video playback will automatically start after page loading.
|
boolean |
isFileAccessFromFilesAllowed()
Indicates whether file access from files is allowed.
|
boolean |
isGpuDisabled()
Indicates whether GPU is disabled.
|
boolean |
isIncognitoEnabled()
Indicates whether the incognito mode for the
Engine instance is enabled. |
boolean |
isSandboxDisabled()
Indicates whether the sandbox is disabled.
|
boolean |
isWebSecurityDisabled()
Indicates whether the same-origin policy is disabled.
|
Language |
language()
Returns the Chromium language that is used on the default error pages and message dialogs.
|
java.util.Optional<java.lang.String> |
licenseKey()
Returns an
Optional that contains a string representing the license key or an empty
Optional if the license key was not set. |
static EngineOptions.Builder |
newBuilder(RenderingMode renderingMode)
Creates a new
EngineOptions builder. |
java.util.Optional<PasswordStore> |
passwordStore()
Returns an
Optional that contains the password store type or an empty Optional if the password store type was not set. |
java.util.Optional<java.nio.file.Path> |
ppapiFlashPath()
Returns an
Optional that contains the path to the PPAPI (Pepper) Flash or an empty
Optional if the path was not set. |
java.util.Optional<java.lang.String> |
ppapiFlashVersion()
Returns an
Optional that contains a string representing the version of the PPAPI
(Pepper) Flash or an empty Optional if the version was not set. |
java.util.Optional<java.lang.Integer> |
remoteDebuggingPort()
Returns an
Optional that contains the number representing the remote debugging port
or an empty Optional if the remote debugging port was not set. |
RenderingMode |
renderingMode()
Returns the rendering mode indicating how the content of the web pages will be rendered.
|
java.util.List<java.lang.String> |
switches()
Returns an immutable list of the Chromium switches that will be passed to the Chromium Main
process.
|
java.util.Optional<java.lang.String> |
userAgent()
Returns an
Optional that contains a string that is used to override the default user
agent or an empty Optional if the custom user agent string was not set. |
java.nio.file.Path |
userDataDir()
Returns an absolute path to the directory where the user data is stored.
|
public static EngineOptions.Builder newBuilder(RenderingMode renderingMode)
EngineOptions
builder.renderingMode
- the rendering mode that indicates how the content of the web pages will
be renderedpublic java.nio.file.Path userDataDir()
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.
public java.nio.file.Path chromiumDir()
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.
public java.util.Optional<java.lang.String> licenseKey()
Optional
that contains a string representing the license key or an empty
Optional
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 the EngineOptions.Builder.licenseKey(String)
method.
public java.util.Optional<java.lang.String> userAgent()
Optional
that contains a string that is used to override the default user
agent or an empty Optional
if the custom user agent string was not set.public java.util.Optional<java.lang.String> googleApiKey()
Optional
that contains a string representing the Google API key or an
empty Optional
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.
public java.util.Optional<java.lang.String> googleDefaultClientId()
Optional
that contains a string representing the Google client ID or an
empty Optional
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.
public java.util.Optional<java.lang.String> googleDefaultClientSecret()
Optional
that contains a string representing the Google client secret or
an empty Optional
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.
public java.util.Optional<java.nio.file.Path> ppapiFlashPath()
Optional
that contains the path to the PPAPI (Pepper) Flash or an empty
Optional
if the path was not set.public java.util.Optional<java.lang.String> ppapiFlashVersion()
Optional
that contains a string representing the version of the PPAPI
(Pepper) Flash or an empty Optional
if the version was not set.public RenderingMode renderingMode()
public Language language()
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.
public java.util.Optional<java.lang.Integer> remoteDebuggingPort()
Optional
that contains the number representing the remote debugging port
or an empty Optional
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
another Browser
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.
public java.util.Optional<PasswordStore> passwordStore()
Optional
that contains the password store type or an empty Optional
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.
public java.util.Optional<java.lang.Long> diskCacheSize()
Optional
that contains the disk cache size in bytes or an empty Optional
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.
public boolean isIncognitoEnabled()
Engine
instance is enabled.
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
.
public boolean isSandboxDisabled()
public boolean isWebSecurityDisabled()
public boolean isFileAccessFromFilesAllowed()
public boolean isAutoplayEnabled()
public boolean isGpuDisabled()
public java.util.List<java.lang.String> switches()
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 the EngineOptions.Builder.addSwitch(String)
method, then the port from the switch will
be used.