Class DbxRequestConfig.Builder
- java.lang.Object
-
- com.dropbox.core.DbxRequestConfig.Builder
-
- Enclosing class:
- DbxRequestConfig
public static final class DbxRequestConfig.Builder extends java.lang.ObjectBuilder forDbxRequestConfig.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DbxRequestConfigbuild()Builds an instance ofDbxRequestConfigwith this builder's configured parameters or defaults.DbxRequestConfig.BuilderwithAutoRetryDisabled()Disables automatic retry of RPC and download requests that fail with aRetryException.DbxRequestConfig.BuilderwithAutoRetryEnabled()Enables automatic retry of RPC and download requests that fail with aRetryException.DbxRequestConfig.BuilderwithAutoRetryEnabled(int maxRetries)Enables automatic retry of RPC and download requests that fail with aRetryException.DbxRequestConfig.BuilderwithHttpRequestor(HttpRequestor httpRequestor)Set the HTTP requestor to use for issuing network requests to the Dropbox servers.DbxRequestConfig.BuilderwithUserLocale(java.lang.String userLocale)Set the locale of the app user.DbxRequestConfig.BuilderwithUserLocaleFrom(java.util.Locale userLocale)Set the locale of the app user.DbxRequestConfig.BuilderwithUserLocaleFromPreferences()Set the locale of user-visible messages returned by the Dropbox servers to the user's Dropbox locale.
-
-
-
Method Detail
-
withUserLocale
public DbxRequestConfig.Builder withUserLocale(java.lang.String userLocale)
Set the locale of the app user. User-visible messages returned by the Dropbox servers will be localized to this locale.Defaults to
null, which means strings will be localized according to the user's Dropbox locale preference.- Parameters:
userLocale- locale of app user as an IETF BCP 47 language tag, ornullto use the user's Dropbox locale settings.- Returns:
- this builder
-
withUserLocaleFromPreferences
public DbxRequestConfig.Builder withUserLocaleFromPreferences()
Set the locale of user-visible messages returned by the Dropbox servers to the user's Dropbox locale.User-visible strings will be localized according to the user's Dropbox locale preference.
- Returns:
- this builder
-
withUserLocaleFrom
public DbxRequestConfig.Builder withUserLocaleFrom(java.util.Locale userLocale)
Set the locale of the app user. User-visible messages returned by the Dropbox servers will be localized to this locale.Defaults to
null, which means strings will be localized according to the user's Dropbox locale preference.- Parameters:
userLocale- Locale of app user, ornullto use user's Dropbox locale settings.- Returns:
- this builder
-
withHttpRequestor
public DbxRequestConfig.Builder withHttpRequestor(HttpRequestor httpRequestor)
Set the HTTP requestor to use for issuing network requests to the Dropbox servers.Defaults to
StandardHttpRequestor.INSTANCE.- Parameters:
httpRequestor- HTTP requestor to use for network requests, nevernull- Returns:
- this builder
-
withAutoRetryEnabled
public DbxRequestConfig.Builder withAutoRetryEnabled()
Enables automatic retry of RPC and download requests that fail with aRetryException.The default number of
3retries will be used in addition to the initial request. To specify the maximum number of retries, seewithAutoRetryEnabled(int).By default, the client will not automatically retry any requests.
- Returns:
- this builder
-
withAutoRetryDisabled
public DbxRequestConfig.Builder withAutoRetryDisabled()
Disables automatic retry of RPC and download requests that fail with aRetryException.By default, the client will not automatically retry any requests.
- Returns:
- this builder
- See Also:
withAutoRetryEnabled()
-
withAutoRetryEnabled
public DbxRequestConfig.Builder withAutoRetryEnabled(int maxRetries)
Enables automatic retry of RPC and download requests that fail with aRetryException.The client will retry failed requests a maximum of
maxRetriestimes before propogating the exception. Note thatmaxRetriesdoes not count the initial request attempt. For example, ifmaxRetriesis 3, the client may issue a request a total of 4 times: once for the initial call, then 3 additional times for the 3 retries.By default, the client will not automatically retry any requests.
To enable automatic retries with the default maximum number of attempts, use
withAutoRetryEnabled().- Parameters:
maxRetries- maximum number of times to retry a retriable failed request. Must be positive.- Returns:
- this builder
- Throws:
java.lang.IllegalArgumentException- ifmaxRetriesis not positive.
-
build
public DbxRequestConfig build()
Builds an instance ofDbxRequestConfigwith this builder's configured parameters or defaults.- Returns:
- new
DbxRequestConfiginstance.
-
-