Package com.install4j.api.update
Class UpdateCheckRequest
- java.lang.Object
-
- com.install4j.api.update.UpdateCheckRequest
-
public class UpdateCheckRequest extends java.lang.Object
An update check request forUpdateChecker.getUpdateDescriptor(UpdateCheckRequest)
. Only theurlSpec
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 Summary
Constructors Constructor Description UpdateCheckRequest(java.lang.String urlSpec)
Constructs an update check request instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UpdateCheckRequest
acceptAllCertificates(boolean acceptAllCertificates)
Sets if an HTTPS connection should accept invalid certificates (not recommended for production).UpdateCheckRequest
applicationDisplayMode(ApplicationDisplayMode applicationDisplayMode)
Sets the display mode that should be used if proxy information should be requiredUpdateCheckRequest
askForProxy(boolean askForProxy)
Sets if a proxy config dialog should be shown if the connection fails.UpdateCheckRequest
connectTimeout(int connectTimeout)
Sets the connect timeout in milliseconds for the HTTP connection.UpdateCheckRequest
errorHandlingCallback(ErrorHandlingCallback errorHandlingCallback)
Sets the callback for handling network errors.ApplicationDisplayMode
getApplicationDisplayMode()
Returns the value set withapplicationDisplayMode(ApplicationDisplayMode)
The default value isApplicationDisplayMode.GUI
.int
getConnectTimeout()
Returns the value set withconnectTimeout(int)
The default value is 10000 ms.ErrorHandlingCallback
getErrorHandlingCallback()
Returns the value set witherrorHandlingCallback(ErrorHandlingCallback)
int
getReadTimeout()
Returns the value set withreadTimeout(int)
The default value is 10000 ms.java.util.Map<java.lang.String,java.util.List<java.lang.String>>
getRequestHeaders()
Returns the value set withrequestHeaders(Map)
.java.lang.String
getUrlSpec()
Returns the value set withurlSpec(String)
boolean
isAcceptAllCertificates()
Returns the value set withacceptAllCertificates(boolean)
boolean
isAskForProxy()
Returns the value set withaskForProxy(boolean)
boolean
isShowProxyOnErrorCode()
Returns the value set withshowProxyOnErrorCode(boolean)
UpdateCheckRequest
readTimeout(int readTimeout)
Sets the read timeout in milliseconds for the HTTP connection.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.UpdateCheckRequest
showProxyOnErrorCode(boolean showProxyOnErrorCode)
Sets if a proxy config dialog should be shown if the connection succeeds, but an error code is returned.UpdateCheckRequest
urlSpec(java.lang.String urlSpec)
Sets the URL from which theupdates.xml
file can be downloaded.
-
-
-
Method Detail
-
getUrlSpec
public java.lang.String getUrlSpec()
Returns the value set withurlSpec(String)
- Returns:
- the value
-
urlSpec
public UpdateCheckRequest urlSpec(java.lang.String urlSpec)
Sets the URL from which theupdates.xml
file can be downloaded.- Parameters:
urlSpec
- the url- Returns:
- this instance
-
getApplicationDisplayMode
public ApplicationDisplayMode getApplicationDisplayMode()
Returns the value set withapplicationDisplayMode(ApplicationDisplayMode)
The default value isApplicationDisplayMode.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 set witherrorHandlingCallback(ErrorHandlingCallback)
- Returns:
- the value
-
errorHandlingCallback
public UpdateCheckRequest errorHandlingCallback(ErrorHandlingCallback errorHandlingCallback)
Sets the callback for handling network errors. If you returnErrorHandlingMode.IGNORE
, the regular proxy or failure handling will proceed, if you returnErrorHandlingMode.CANCEL
the action will fail immediately. If you can take corrective action in the script, you can returnErrorHandlingMode.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
public boolean isAskForProxy()
Returns the value set withaskForProxy(boolean)
- Returns:
- the value
-
askForProxy
public UpdateCheckRequest askForProxy(boolean askForProxy)
Sets if a proxy config dialog should be shown if the connection fails. The default value istrue
.- Parameters:
askForProxy
- the value- Returns:
- this instance
-
isShowProxyOnErrorCode
public boolean isShowProxyOnErrorCode()
Returns the value set withshowProxyOnErrorCode(boolean)
- Returns:
- the value
-
showProxyOnErrorCode
public UpdateCheckRequest showProxyOnErrorCode(boolean showProxyOnErrorCode)
Sets if a proxy config dialog should be shown if the connection succeeds, but an error code is returned. The default value isfalse
.- Parameters:
showProxyOnErrorCode
- the value- Returns:
- this instance
-
getRequestHeaders
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getRequestHeaders()
Returns the value set withrequestHeaders(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 withconnectTimeout(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 withreadTimeout(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 withacceptAllCertificates(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 isfalse
.- Parameters:
acceptAllCertificates
- the value- Returns:
- this instance
-
-