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 |
disableExit()
Disables applets from calling exit.
|
static void |
exit(int i) |
static ApplicationInstance |
getApplication()
Return the current Application, or null if none can be
determined.
|
static DeploymentConfiguration |
getConfiguration()
Gets the Configuration associated with this runtime
|
static DownloadIndicator |
getDefaultDownloadIndicator()
Returns the default download indicator.
|
static LaunchHandler |
getDefaultLaunchHandler()
Returns the default launch handler.
|
static UpdatePolicy |
getDefaultUpdatePolicy()
Returns the default update policy.
|
static boolean |
getForksAllowed()
Returns
true if the current runtime will fork |
static java.util.List<java.lang.String> |
getInitialArguments() |
static java.lang.String |
getMessage(java.lang.String key)
Returns the localized resource string identified by the
specified key.
|
static java.lang.String |
getMessage(java.lang.String key,
java.lang.Object... args)
Returns the localized resource string using the specified arguments.
|
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 |
isDebug()
Return whether debug statements for the JNLP client code
should be printed.
|
static boolean |
isHeadless()
Returns whether the JNLP client will use any AWT/Swing
components.
|
static boolean |
isIgnoreHeaders() |
static boolean |
isInitialized()
Returns whether the JNLP runtime environment has been
initialized.
|
static boolean |
isSecurityEnabled()
Returns whether the secure runtime environment is enabled.
|
static boolean |
isSetDebug() |
static boolean |
isTrustAll() |
static boolean |
isTrustNone() |
static boolean |
isUnix() |
static boolean |
isVerifying()
Returns whether we are verifying code signing.
|
static boolean |
isWebstartApplication()
Returns true if a webstart application has been initialized, and false
for a plugin applet.
|
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 |
setIgnoreHeaders(boolean ignoreHeaders) |
static void |
setInitialArgments(java.util.List<java.lang.String> args) |
static void |
setSecurityEnabled(boolean enabled)
Sets whether to enable the secure runtime environment.
|
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 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
).java.lang.IllegalStateException
- if the runtime was previously initializedpublic static void setAllowRedirect(boolean enabled)
public static boolean isAllowRedirect()
public static void setVerify(boolean enabled)
java.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)
java.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)
java.lang.IllegalStateException
- if caller is not the exit classpublic static void setDefaultUpdatePolicy(UpdatePolicy policy)
java.lang.IllegalStateException
- if caller is not the exit classpublic static UpdatePolicy getDefaultUpdatePolicy()
public static void setDefaultLaunchHandler(LaunchHandler handler)
public static LaunchHandler getDefaultLaunchHandler()
public static void setDefaultDownloadIndicator(DownloadIndicator indicator)
java.lang.IllegalStateException
- if caller is not the exit classpublic static DownloadIndicator getDefaultDownloadIndicator()
public static java.lang.String getMessage(java.lang.String key)
public static java.lang.String getMessage(java.lang.String key, java.lang.Object... args)
args
- the formatting arguments to the resource stringpublic static boolean getForksAllowed()
true
if the current runtime will forkpublic static void setForksAllowed(boolean value)
public static boolean isWindows()
true
if running on Windowspublic 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 boolean isTrustAll()
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)