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 |
isChromiumTrafficDisabled()
Indicates whether Chromium services that cause additional traffic are disabled.
|
boolean |
isDnsQuickCheckDisabled()
Indicates whether DNS Quick Check is disabled in proxy resolution.
|
boolean |
isFileAccessFromFilesAllowed()
Indicates whether file access from files is allowed.
|
boolean |
isGpuDisabled()
Indicates whether GPU is disabled.
|
boolean |
isIncognitoEnabled()
Indicates whether the default profile of the
Engine instance is incognito. |
boolean |
isMediaRoutingEnabled()
Indicates whether media routing is enabled for the
Engine instance. |
boolean |
isProprietaryFeatureEnabled(ProprietaryFeature feature)
Indicates whether the given proprietary feature is enabled.
|
boolean |
isSandboxDisabled()
Indicates whether the sandbox is disabled.
|
boolean |
isTouchMenuDisabled()
Indicates whether touch popup menu 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.Set<ProprietaryFeature> |
proprietaryFeatures()
Returns a set of enabled proprietary features.
|
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. |
java.time.Duration |
rendererHangTimeout()
Returns how many seconds JavaScript can block the page before it is considered hanged.
|
RenderingMode |
renderingMode()
Returns the rendering mode indicating how the content of the web pages will be rendered.
|
java.util.Map<Scheme,InterceptUrlRequestCallback> |
schemes()
Returns an immutable map of the schemes that will be intercepted.
|
java.util.List<java.lang.String> |
secureOriginWhiteList()
Returns an immutable list of the insecure origins that will be treated as secure.
|
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 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.time.Duration rendererHangTimeout()
By default, it can block for 15
seconds.
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 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
.
public boolean isMediaRoutingEnabled()
Engine
instance.
By default, it is disabled.
public boolean isSandboxDisabled()
public boolean isWebSecurityDisabled()
public boolean isFileAccessFromFilesAllowed()
public boolean isAutoplayEnabled()
public boolean isGpuDisabled()
public boolean isDnsQuickCheckDisabled()
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).
public boolean isTouchMenuDisabled()
public boolean isChromiumTrafficDisabled()
public boolean isProprietaryFeatureEnabled(ProprietaryFeature feature)
By default, all the proprietary features are disabled.
feature
- an instance of ProprietaryFeature
representing the feature to checkpublic java.util.Set<ProprietaryFeature> proprietaryFeatures()
public java.util.List<java.lang.String> secureOriginWhiteList()
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.
public java.util.Map<Scheme,InterceptUrlRequestCallback> schemes()