public class JNLPRuntime
extends java.lang.Object
Configure and access the runtime environment. This class stores global jnlp properties such as default download indicators, the install/base directory, the default resource update policy, etc. Some settings, such as the base directory, cannot be changed once the runtime has been initialized.
The JNLP runtime can be locked to prevent further changes to the runtime environment except by a specified class. If set, only instances of the exit class can exit the JVM or change the JNLP runtime settings once the runtime has been initialized.
Modifier and Type | Field and Description |
---|---|
static java.lang.Object |
initMutex
mutex to wait on, for initialization
|
Constructor and Description |
---|
JNLPRuntime() |
Modifier and Type | Method and Description |
---|---|
static void |
detectOnline(java.net.URL location) |
static void |
disableExit()
Disables applets from calling exit.
|
static void |
exit(int i) |
static ApplicationInstance |
getApplication() |
static DeploymentConfiguration |
getConfiguration()
Gets the Configuration associated with this runtime
|
static DownloadIndicator |
getDefaultDownloadIndicator() |
static LaunchHandler |
getDefaultLaunchHandler()
Returns the default launch handler.
|
static UpdatePolicy |
getDefaultUpdatePolicy() |
static boolean |
getForksAllowed() |
static java.util.List<java.lang.String> |
getInitialArguments() |
static java.lang.String |
getLocalisedTimeStamp(java.util.Date timestamp) |
static SecurityDialogMessageHandler |
getSecurityDialogHandler() |
static void |
initialize(boolean isApplication)
Initialize the JNLP runtime environment by installing the
security manager and security policy, initializing the JNLP
standard services, etc.
|
static boolean |
isAllowRedirect() |
static boolean |
isConnectable(java.net.URL location) |
static boolean |
isDebug() |
static boolean |
isHeadless() |
static boolean |
isHtml() |
static boolean |
isIgnoreHeaders() |
static boolean |
isInitialized()
Returns whether the JNLP runtime environment has been
initialized.
|
static boolean |
isOfflineForced() |
static boolean |
isOnline() |
static boolean |
isOnlineDetected() |
static boolean |
isSecurityEnabled()
Returns whether the secure runtime environment is enabled.
|
static boolean |
isSetDebug() |
static boolean |
isTrustAll() |
static boolean |
isTrustNone() |
static boolean |
isUnix()
Deprecated.
|
static boolean |
isVerifying() |
static boolean |
isWebstartApplication() |
static boolean |
isWindows() |
static void |
markNetxRunning()
Indicate that netx is running by creating the
DeploymentConfiguration.KEY_USER_NETX_RUNNING_FILE and
acquiring a shared lock on it |
static void |
reloadPolicy() |
static void |
saveHistory(java.lang.String documentBase) |
static void |
setAllowRedirect(boolean enabled) |
static void |
setDebug(boolean enabled)
Sets whether debug statements for the JNLP client code
should be printed to the standard output.
|
static void |
setDefaultDownloadIndicator(DownloadIndicator indicator)
Sets the default download indicator.
|
static void |
setDefaultLaunchHandler(LaunchHandler handler)
Sets the default launch handler.
|
static void |
setDefaultUpdatePolicy(UpdatePolicy policy)
Sets the default update policy.
|
static void |
setExitClass(java.lang.Class<?> exitClass)
Set a class that can exit the JVM; if not set then any class
can exit the JVM.
|
static void |
setForksAllowed(boolean value) |
static void |
setHeadless(boolean enabled)
Sets whether the JNLP client will use any AWT/Swing
components.
|
static void |
setHtml(boolean html) |
static void |
setIgnoreHeaders(boolean ignoreHeaders) |
static void |
setInitialArgments(java.util.List<java.lang.String> args) |
static void |
setOfflineForced(boolean b) |
static void |
setOnlineDetected(boolean online) |
static void |
setSecurityEnabled(boolean enabled)
Sets whether to enable the secure runtime environment.
|
static void |
setTrustAll(boolean b) |
static void |
setTrustNone(boolean b) |
static void |
setVerify(boolean enabled)
Sets whether we will verify code signing.
|
public static java.lang.Object initMutex
public static boolean isInitialized()
public static void initialize(boolean isApplication) throws java.lang.IllegalStateException
This method should be called from the main AppContext/Thread.
This method cannot be called more than once. Once initialized, methods that alter the runtime can only be called by the exit class.
isApplication
- is true
if a webstart application is being
initializedjava.lang.IllegalStateException
- if the runtime was previously initializedpublic static void reloadPolicy()
public static void setOfflineForced(boolean b)
public static boolean isOfflineForced()
public static void setOnlineDetected(boolean online)
public static boolean isOnlineDetected()
public static boolean isOnline()
public static void detectOnline(java.net.URL location)
public static boolean isConnectable(java.net.URL location)
public static DeploymentConfiguration getConfiguration()
DeploymentConfiguration
object that can be queried to
find relevant configuration settingspublic static boolean isWebstartApplication()
public static boolean isHeadless()
public static boolean isVerifying()
public static void setHeadless(boolean enabled)
java.awt.headless=true
).enabled
- true if application do not wont/need gui or X at alljava.lang.IllegalStateException
- if the runtime was previously initializedpublic static void setAllowRedirect(boolean enabled)
public static boolean isAllowRedirect()
public static void setVerify(boolean enabled)
enabled
- true if app should verify signaturesjava.lang.IllegalStateException
- if the runtime was previously initializedpublic static boolean isSecurityEnabled()
public static void setSecurityEnabled(boolean enabled)
Disabling security is not recommended and should only be used if the JNLP files opened are trusted. This method can only be called before initalizing the runtime.
enabled
- whether security should be enabledjava.lang.IllegalStateException
- if the runtime is already initializedpublic static SecurityDialogMessageHandler getSecurityDialogHandler()
SecurityDialogMessageHandler
that should be used to
post security dialog messagespublic static void setExitClass(java.lang.Class<?> exitClass)
exitClass
- a class that can exit the JVMjava.lang.IllegalStateException
- if caller is not the exit classpublic static void disableExit()
public static ApplicationInstance getApplication()
public static boolean isDebug()
public static boolean isSetDebug()
public static void setDebug(boolean enabled)
enabled
- set to true if you need full debug outputjava.lang.IllegalStateException
- if caller is not the exit classpublic static void setDefaultUpdatePolicy(UpdatePolicy policy)
policy
- global update policy of environmentjava.lang.IllegalStateException
- if caller is not the exit classpublic static UpdatePolicy getDefaultUpdatePolicy()
public static void setDefaultLaunchHandler(LaunchHandler handler)
handler
- default handlerpublic static LaunchHandler getDefaultLaunchHandler()
public static void setDefaultDownloadIndicator(DownloadIndicator indicator)
indicator
- where to show progressjava.lang.IllegalStateException
- if caller is not the exit classpublic static DownloadIndicator getDefaultDownloadIndicator()
public static java.lang.String getLocalisedTimeStamp(java.util.Date timestamp)
public static boolean getForksAllowed()
true
if the current runtime will forkpublic static void setForksAllowed(boolean value)
public static boolean isWindows()
true
if running on Windows@Deprecated public static boolean isUnix()
true
if running on a Unix or Unix-like system (including
Linux and *BSD)public static void setInitialArgments(java.util.List<java.lang.String> args)
public static java.util.List<java.lang.String> getInitialArguments()
public static void markNetxRunning()
DeploymentConfiguration.KEY_USER_NETX_RUNNING_FILE
and
acquiring a shared lock on itpublic static void setHtml(boolean html)
public static boolean isHtml()
public static void setTrustAll(boolean b)
public static boolean isTrustAll()
public static void setTrustNone(boolean b)
public static boolean isTrustNone()
public static boolean isIgnoreHeaders()
public static void setIgnoreHeaders(boolean ignoreHeaders)
public static void exit(int i)
public static void saveHistory(java.lang.String documentBase)