Class UpdateCheckRequest

java.lang.Object
com.install4j.api.update.UpdateCheckRequest

public class UpdateCheckRequest extends Object
An update check request for UpdateChecker.getUpdateDescriptor(UpdateCheckRequest). Only the urlSpec is mandatory, all other options have a default value that is documented in the setters. This class is intended to be used in a fluent API invocation style:

 UpdateDescriptor updateDescriptor = UpdateChecker.getUpdateDescriptor(
      new UpdateCheckRequest("http://test.com/updates.xml").
          applicationDisplayMode(ApplicationDisplayMode.CONSOLE).
          askForProxy(false).
          connectTimeout(50000)
      )
 );
 
  • Constructor Details

    • UpdateCheckRequest

      public UpdateCheckRequest(String urlSpec)
      Constructs an update check request instance.
      Parameters:
      urlSpec - the URL from which the updates.xml file can be downloaded.
  • Method Details

    • getUrlSpec

      public String getUrlSpec()
      Returns the value set with urlSpec(String)
      Returns:
      the value
    • urlSpec

      public UpdateCheckRequest urlSpec(String urlSpec)
      Sets the URL from which the updates.xml file can be downloaded.
      Parameters:
      urlSpec - the url
      Returns:
      this instance
    • getApplicationDisplayMode

      public ApplicationDisplayMode getApplicationDisplayMode()
      Returns the value set with applicationDisplayMode(ApplicationDisplayMode) The default value is ApplicationDisplayMode.GUI.
      Returns:
      the value
    • applicationDisplayMode

      public UpdateCheckRequest applicationDisplayMode(ApplicationDisplayMode applicationDisplayMode)
      Sets the display mode that should be used if proxy information should be required
    • getErrorHandlingCallback

      public ErrorHandlingCallback getErrorHandlingCallback()
      Returns:
      the value
    • errorHandlingCallback

      public UpdateCheckRequest errorHandlingCallback(ErrorHandlingCallback errorHandlingCallback)
      Sets the callback for handling network errors. If you return ErrorHandlingMode.IGNORE, the regular proxy or failure handling will proceed, if you return ErrorHandlingMode.CANCEL the action will fail immediately. If you can take corrective action in the script, you can return ErrorHandlingMode.RETRY to make the same HTTP request again. However, you have to take special care not to enter an infinite loop. Typically, there should be user input before you retry and the user should be given the option to cancel.

      The script is only executed for actual network failures, and not if the server or the proxy connection require authentication.

      The default value is null.

      Parameters:
      errorHandlingCallback - the callback
      Returns:
      this instance
    • isAskForProxy

      @Deprecated public boolean isAskForProxy()
      Deprecated.
    • askForProxy

      @Deprecated public UpdateCheckRequest askForProxy(boolean askForProxy)
      Deprecated.
    • isShowProxyOnErrorCode

      @Deprecated public boolean isShowProxyOnErrorCode()
      Deprecated.
    • showProxyOnErrorCode

      @Deprecated public UpdateCheckRequest showProxyOnErrorCode(boolean showProxyOnErrorCode)
      Deprecated.
    • getRequestHeaders

      public Map<String,List<String>> getRequestHeaders()
      Returns the value set with requestHeaders(Map). The default map non-null and modifiable.
      Returns:
      the value
    • requestHeaders

      public UpdateCheckRequest requestHeaders(Map<String,List<String>> requestHeaders)
      Sets request headers that should be set for the HTTP connection. The default value is an empty map.
      Parameters:
      requestHeaders - the request headers as a map of key-value pairs
      Returns:
      this instance
    • getConnectTimeout

      public int getConnectTimeout()
      Returns the value set with connectTimeout(int) The default value is 10000 ms.
      Returns:
      the value
    • connectTimeout

      public UpdateCheckRequest connectTimeout(int connectTimeout)
      Sets the connect timeout in milliseconds for the HTTP connection.
      Parameters:
      connectTimeout - the value in milliseconds
      Returns:
      this instance
    • getReadTimeout

      public int getReadTimeout()
      Returns the value set with readTimeout(int) The default value is 10000 ms.
      Returns:
      the value
    • readTimeout

      public UpdateCheckRequest readTimeout(int readTimeout)
      Sets the read timeout in milliseconds for the HTTP connection.
      Parameters:
      readTimeout - the value in milliseconds
      Returns:
      this instance
    • isAcceptAllCertificates

      public boolean isAcceptAllCertificates()
      Returns the value set with acceptAllCertificates(boolean)
      Returns:
      the value
    • acceptAllCertificates

      public UpdateCheckRequest acceptAllCertificates(boolean acceptAllCertificates)
      Sets if an HTTPS connection should accept invalid certificates (not recommended for production). The default value is false.
      Parameters:
      acceptAllCertificates - the value
      Returns:
      this instance