Class DbxRequestConfig.Builder
- java.lang.Object
-
- com.dropbox.core.DbxRequestConfig.Builder
-
- Enclosing class:
- DbxRequestConfig
public static final class DbxRequestConfig.Builder extends java.lang.Object
Builder forDbxRequestConfig
.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DbxRequestConfig
build()
Builds an instance ofDbxRequestConfig
with this builder's configured parameters or defaults.DbxRequestConfig.Builder
withAutoRetryDisabled()
Disables automatic retry of RPC and download requests that fail with aRetryException
.DbxRequestConfig.Builder
withAutoRetryEnabled()
Enables automatic retry of RPC and download requests that fail with aRetryException
.DbxRequestConfig.Builder
withAutoRetryEnabled(int maxRetries)
Enables automatic retry of RPC and download requests that fail with aRetryException
.DbxRequestConfig.Builder
withHttpRequestor(HttpRequestor httpRequestor)
Set the HTTP requestor to use for issuing network requests to the Dropbox servers.DbxRequestConfig.Builder
withUserLocale(java.lang.String userLocale)
Set the locale of the app user.DbxRequestConfig.Builder
withUserLocaleFrom(java.util.Locale userLocale)
Set the locale of the app user.DbxRequestConfig.Builder
withUserLocaleFromPreferences()
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, ornull
to 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, ornull
to 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
3
retries 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
maxRetries
times before propogating the exception. Note thatmaxRetries
does not count the initial request attempt. For example, ifmaxRetries
is 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
- ifmaxRetries
is not positive.
-
build
public DbxRequestConfig build()
Builds an instance ofDbxRequestConfig
with this builder's configured parameters or defaults.- Returns:
- new
DbxRequestConfig
instance.
-
-