Class UpdateCheckRequest


  • public class UpdateCheckRequest
    extends java.lang.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 Detail

      • UpdateCheckRequest

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

      • getUrlSpec

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

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

        public UpdateCheckRequest applicationDisplayMode​(ApplicationDisplayMode applicationDisplayMode)
        Sets the display mode that should be used if proxy information should be required
      • 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 java.util.Map<java.lang.String,​java.util.List<java.lang.String>> getRequestHeaders()
        Returns the value set with requestHeaders(Map). The default map non-null and modifiable.
        Returns:
        the value
      • requestHeaders

        public UpdateCheckRequest requestHeaders​(java.util.Map<java.lang.String,​java.util.List<java.lang.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
      • 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