public class UpdateCheckRequest
extends java.lang.Object
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 and Description |
---|
UpdateCheckRequest(java.lang.String urlSpec)
Constructs an update check request instance.
|
Modifier and Type | Method and 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 required
|
UpdateCheckRequest |
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 with
applicationDisplayMode(ApplicationDisplayMode)
The default value is ApplicationDisplayMode.GUI . |
int |
getConnectTimeout()
Returns the value set with
connectTimeout(int)
The default value is 10000 ms. |
ErrorHandlingCallback |
getErrorHandlingCallback()
Returns the value set with
errorHandlingCallback(ErrorHandlingCallback) |
int |
getReadTimeout()
Returns the value set with
readTimeout(int)
The default value is 10000 ms. |
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getRequestHeaders()
Returns the value set with
requestHeaders(Map) . |
java.lang.String |
getUrlSpec()
Returns the value set with
urlSpec(String) |
boolean |
isAcceptAllCertificates()
Returns the value set with
acceptAllCertificates(boolean) |
boolean |
isAskForProxy()
Returns the value set with
askForProxy(boolean) |
boolean |
isShowProxyOnErrorCode()
Returns the value set with
showProxyOnErrorCode(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 the
updates.xml file can be downloaded. |
public UpdateCheckRequest(java.lang.String urlSpec)
urlSpec
- the URL from which the updates.xml
file can be downloaded.public java.lang.String getUrlSpec()
urlSpec(String)
public UpdateCheckRequest urlSpec(java.lang.String urlSpec)
updates.xml
file can be downloaded.urlSpec
- the urlpublic ApplicationDisplayMode getApplicationDisplayMode()
applicationDisplayMode(ApplicationDisplayMode)
The default value is ApplicationDisplayMode.GUI
.public UpdateCheckRequest applicationDisplayMode(ApplicationDisplayMode applicationDisplayMode)
public ErrorHandlingCallback getErrorHandlingCallback()
errorHandlingCallback(ErrorHandlingCallback)
public UpdateCheckRequest errorHandlingCallback(ErrorHandlingCallback errorHandlingCallback)
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
.
errorHandlingCallback
- the callbackpublic boolean isAskForProxy()
askForProxy(boolean)
public UpdateCheckRequest askForProxy(boolean askForProxy)
true
.askForProxy
- the valuepublic boolean isShowProxyOnErrorCode()
showProxyOnErrorCode(boolean)
public UpdateCheckRequest showProxyOnErrorCode(boolean showProxyOnErrorCode)
false
.showProxyOnErrorCode
- the valuepublic java.util.Map<java.lang.String,java.util.List<java.lang.String>> getRequestHeaders()
requestHeaders(Map)
. The default map non-null and modifiable.public UpdateCheckRequest requestHeaders(java.util.Map<java.lang.String,java.util.List<java.lang.String>> requestHeaders)
requestHeaders
- the request headers as a map of key-value pairspublic int getConnectTimeout()
connectTimeout(int)
The default value is 10000 ms.public UpdateCheckRequest connectTimeout(int connectTimeout)
connectTimeout
- the value in millisecondspublic int getReadTimeout()
readTimeout(int)
The default value is 10000 ms.public UpdateCheckRequest readTimeout(int readTimeout)
readTimeout
- the value in millisecondspublic boolean isAcceptAllCertificates()
acceptAllCertificates(boolean)
public UpdateCheckRequest acceptAllCertificates(boolean acceptAllCertificates)
false
.acceptAllCertificates
- the value