File Downloads


Actions that perform file downloads

Several actions can perform a file download, including

Both HTTP and HTTPS connections are supported. HTTPS requires that at least a 1.4 JRE is used for the installer.

When creating an HTTP connection to the requested resource there are three different concerns that may require user interaction: Proxy selection, proxy authentication and server authentication.

Proxy selection and authentication

On Windows, the installer will try to obtain the proxy settings of the default browsers and use them for the HTTP connection. If no such proxy information is available, a direct connection will be made. If the direct connection fails, a proxy dialog will be opened that allows the user to enter the proxy or edit the cached information.

If the proxy requires credentials, the user can enter the credentials in the same dialog. All user input on this dialog will be cached, except for the password. The password has to be re-entered every time the installer is run. If there are several download actions in the same installer, the password has to be entered just once.

This proxy information will be cached globally for all installers created by install4j. If the proxy requires a password, the above proxy dialog will be displayed the first time a connection is made in the installer. To clear the cached proxy information for testing purposes, you can start the installer with the argument -Dinstall4j.clearProxyCache=true. If the proxy information can be taken from the default browser, that data is applied again after the previously cached information has been cleared. Also, you can force the proxy dialog to be shown for testing purposes by passing the argument install4j.showProxyConfig=true. This allows you to specify a proxy even if the direct connection succeeds.

If a selected proxy is not available, the installer will fall back to a direct connection. If the proxy is available and the password is wrong, the proxy dialog will be shown again.

Entering proxy data is supported in console mode as well. In unattended mode there is no user interaction, so the proxy information has to be given as arguments to the installer. The standard Java properties for proxy configuration have to be used for that case: -DproxySet=true, -DproxyHost=[host name] and -DproxyPort=[port number]. If the proxy requires credentials, you have to specify -DproxyAuth=true, -DproxyAuthUser=[user name] and -DproxyAuthPassword=[password] as well.

Server authentication

The download URL can be password protected. In this case, the user has to supply a user name and password.

Neither the user name nor the password is cached by install4j. In unattended mode you have to pass the arguments -DserverAuthUser=[user name] and -DserverAuthPassword=[password]. You can set these system properties via System.setProperty("serverAuthUser", "[user name]") and System.setProperty("serverAuthPassword", "[password]") if you want to hard-code the credentials or if you have another source for obtaining the credentials.