Class JNLPRuntime
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.
- Version:
- $Revision: 1.19 $
- Author:
- Jon A. Maxwell (JAM) - initial author
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voiddetectOnline(URL location) static voidDisables applets from calling exit.static <T> Texit(int i) static <T> Texit(int i, boolean waitToCloseExceptionDialogs) static ApplicationInstancestatic DeploymentConfigurationGets the Configuration associated with this runtimestatic DownloadIndicatorstatic LaunchHandlerReturns the default launch handler.static UpdatePolicystatic ExtensionPointstatic ForkingStrategystatic Stringstatic StringgetLocalisedTimeStamp(Date timestamp) static SecurityDialogMessageHandlerstatic SecurityDialogMessageHandlerReturns the Security Dialog Message Handler.static voidInitialize the JNLP runtime environment by installing the security manager and security policy, initializing the JNLP standard services, etc.static booleanstatic booleanisConnectable(URL location) static booleanisDebug()static booleanstatic booleanstatic booleanReturns whether the JNLP runtime environment has been initialized.static booleanstatic booleanisOnline()static booleanstatic booleanstatic booleanReturns whether the secure runtime environment is enabled.static booleanstatic booleanstatic booleanstatic booleanstatic booleanisUnix()Deprecated.static booleanstatic voidIndicate that netx is running by creating theConfigurationConstants.KEY_USER_NETX_RUNNING_FILEand acquiring a shared lock on itstatic voidstatic voidsaveHistory(String documentBase) static voidsetAllowRedirect(boolean enabled) static voidsetDebug(boolean enabled) Sets whether debug statements for the JNLP client code should be printed to the standard output.static voidsetDefaultDownloadIndicator(DownloadIndicator indicator) Sets the default download indicator.static voidsetDefaultLaunchHandler(LaunchHandler handler) Sets the default launch handler.static voidsetDefaultUpdatePolicy(UpdatePolicy policy) Sets the default update policy.static voidsetExitClass(Class<?> exitClass) Set a class that can exit the JVM; if not set then any class can exit the JVM.static voidsetForkingStrategy(ForkingStrategy strategy) static voidsetHeadless(boolean enabled) Sets whether the JNLP client will use any AWT/Swing components.static voidsetIgnoreHeaders(boolean ignoreHeaders) static voidsetInitialArguments(List<String> args) static voidsetOfflineForced(boolean b) static voidsetOnlineDetected(boolean online) static voidsetSecurityDialogMessageHandler(SecurityDialogMessageHandler securityDialogMessageHandler) Sets the Security Dialog Message Handler.static voidsetSecurityEnabled(boolean enabled) Sets whether to enable the secure runtime environment.static voidsetShowWebSplash(boolean showWebSplash) static voidsetTrustAll(boolean b) static voidsetTrustNone(boolean b) static voidsetVerify(boolean enabled) Sets whether we will verify code signing.static void
-
Field Details
-
initMutex
mutex to wait on, for initialization
-
-
Constructor Details
-
JNLPRuntime
public JNLPRuntime()
-
-
Method Details
-
isInitialized
public static boolean isInitialized()Returns whether the JNLP runtime environment has been initialized. Once initialized, some properties such as the base directory cannot be changed. Before- Returns:
- whether this runtime was already initialized
-
initialize
Initialize the JNLP runtime environment by installing the security manager and security policy, initializing the JNLP standard services, etc.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.
- Throws:
IllegalStateException- if the runtime was previously initialized
-
reloadPolicy
public static void reloadPolicy() -
setOfflineForced
public static void setOfflineForced(boolean b) -
isOfflineForced
public static boolean isOfflineForced() -
setOnlineDetected
public static void setOnlineDetected(boolean online) -
isOnlineDetected
public static boolean isOnlineDetected() -
isOnline
public static boolean isOnline() -
detectOnline
-
isConnectable
-
getConfiguration
Gets the Configuration associated with this runtime- Returns:
- a
DeploymentConfigurationobject that can be queried to find relevant configuration settings
-
isHeadless
public static boolean isHeadless()- Returns:
- whether the JNLP client will use any AWT/Swing components.
-
isVerifying
public static boolean isVerifying()- Returns:
- whether we are verifying code signing.
-
setHeadless
public static void setHeadless(boolean enabled) Sets whether the JNLP client will use any AWT/Swing components. In headless mode, client features that use the AWT are disabled such that the client can be used in headless mode (java.awt.headless=true).- Parameters:
enabled- true if application do not wont/need gui or X at all- Throws:
IllegalStateException- if the runtime was previously initialized
-
setAllowRedirect
public static void setAllowRedirect(boolean enabled) -
isAllowRedirect
public static boolean isAllowRedirect() -
setVerify
public static void setVerify(boolean enabled) Sets whether we will verify code signing.- Parameters:
enabled- true if app should verify signatures- Throws:
IllegalStateException- if the runtime was previously initialized
-
isSecurityEnabled
public static boolean isSecurityEnabled()Returns whether the secure runtime environment is enabled.- Returns:
- true if security manager is created
-
isSandboxUnsupported
public static boolean isSandboxUnsupported()- Returns:
- true if security is enabled but the JVM cannot enforce it (no SecurityManager); restricted applications must then be refused
-
setSecurityEnabled
public static void setSecurityEnabled(boolean enabled) Sets whether to enable the secure runtime environment. Disabling security can increase performance for some applications, and can be used to use netx with other code that uses its own security manager or policy.Disabling security is not recommended and should only be used if the JNLP files opened are trusted. This method can only be called before initializing the runtime.
- Parameters:
enabled- whether security should be enabled- Throws:
IllegalStateException- if the runtime is already initialized
-
getSecurityDialogHandler
- Returns:
- the
SecurityDialogMessageHandlerthat should be used to post security dialog messages
-
setExitClass
Set a class that can exit the JVM; if not set then any class can exit the JVM.- Parameters:
exitClass- a class that can exit the JVM- Throws:
IllegalStateException- if caller is not the exit class
-
disableExit
public static void disableExit()Disables applets from calling exit. Once disabled, exit cannot be re-enabled for the duration of the JVM instance -
getApplication
- Returns:
- the current Application, or null if none can be determined.
-
isDebug
public static boolean isDebug()- Returns:
- whether debug statements for the JNLP client code should be printed.
-
isSetDebug
public static boolean isSetDebug() -
setDebug
public static void setDebug(boolean enabled) Sets whether debug statements for the JNLP client code should be printed to the standard output.- Parameters:
enabled- set to true if you need full debug output- Throws:
IllegalStateException- if caller is not the exit class
-
setDefaultUpdatePolicy
Sets the default update policy.- Parameters:
policy- global update policy of environment- Throws:
IllegalStateException- if caller is not the exit class
-
getDefaultUpdatePolicy
- Returns:
- the default update policy.
-
setDefaultLaunchHandler
Sets the default launch handler.- Parameters:
handler- default handler
-
getDefaultLaunchHandler
Returns the default launch handler.- Returns:
- default handler
-
getSecurityDialogMessageHandler
Returns the Security Dialog Message Handler.- Returns:
- SecurityDialogMessageHandler
-
setSecurityDialogMessageHandler
public static void setSecurityDialogMessageHandler(SecurityDialogMessageHandler securityDialogMessageHandler) Sets the Security Dialog Message Handler.- Parameters:
securityDialogMessageHandler- handler for Security Dialog messages
-
setDefaultDownloadIndicator
Sets the default download indicator.- Parameters:
indicator- where to show progress- Throws:
IllegalStateException- if caller is not the exit class
-
getDefaultDownloadIndicator
- Returns:
- the default download indicator.
-
getLocalisedTimeStamp
-
getForksStrategy
- Returns:
trueif the current runtime will fork
-
setForkingStrategy
-
isUnix
Deprecated.- Returns:
trueif running on a Unix or Unix-like system (including Linux and *BSD)
-
setInitialArguments
-
getJnlpPath
-
getInitialArguments
-
markNetxRunning
public static void markNetxRunning()Indicate that netx is running by creating theConfigurationConstants.KEY_USER_NETX_RUNNING_FILEand acquiring a shared lock on it -
setTrustAll
public static void setTrustAll(boolean b) -
isTrustAll
public static boolean isTrustAll() -
setTrustNone
public static void setTrustNone(boolean b) -
isTrustNone
public static boolean isTrustNone() -
isIgnoreHeaders
public static boolean isIgnoreHeaders() -
setIgnoreHeaders
public static void setIgnoreHeaders(boolean ignoreHeaders) -
exit
public static <T> T exit(int i, boolean waitToCloseExceptionDialogs) -
exit
public static <T> T exit(int i) -
waitForExceptionDialogsToBeClosed
public static void waitForExceptionDialogsToBeClosed() -
saveHistory
-
setShowWebSplash
public static void setShowWebSplash(boolean showWebSplash) - Parameters:
showWebSplash- show splash screen at start of webstart application
-
isShowWebSplash
public static boolean isShowWebSplash()- Returns:
- show splash screen at start of webstart application
-
getExtensionPoint
-