Class DbxRequestConfig
- java.lang.Object
-
- com.dropbox.core.DbxRequestConfig
-
public class DbxRequestConfig extends java.lang.Object
A grouping of a few configuration parameters for how we should make requests to the Dropbox servers.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DbxRequestConfig.Builder
Builder forDbxRequestConfig
.
-
Constructor Summary
Constructors Constructor Description DbxRequestConfig(java.lang.String clientIdentifier)
Creates a new configuration.DbxRequestConfig(java.lang.String clientIdentifier, java.lang.String userLocale)
Deprecated.UsenewBuilder(java.lang.String)
to customize configurationDbxRequestConfig(java.lang.String clientIdentifier, java.lang.String userLocale, HttpRequestor httpRequestor)
Deprecated.UsenewBuilder(java.lang.String)
to customize configuration
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description DbxRequestConfig.Builder
copy()
Returns a builder for building a copy of this configuration.java.lang.String
getClientIdentifier()
Returns theclientIdentifier
you passed in when constructing this object.HttpRequestor
getHttpRequestor()
Returns theHttpRequestor
you passed in when constructing this object, which defaults toStandardHttpRequestor.INSTANCE
.int
getMaxRetries()
Returns the maximum number of times the client should automatically retry RPC and download requests that fail with aRetryException
.java.lang.String
getUserLocale()
Returns theuserLocale
you passed in when constructing this object, which defaults tonull
.boolean
isAutoRetryEnabled()
Returns whether or not the client should automatically retry RPC and download requests after receiving aRetryException
.static DbxRequestConfig.Builder
newBuilder(java.lang.String clientIdentifier)
Returns a new builder for creating aDbxRequestConfig
instance.
-
-
-
Constructor Detail
-
DbxRequestConfig
public DbxRequestConfig(java.lang.String clientIdentifier)
Creates a new configuration.- Parameters:
clientIdentifier
- seegetClientIdentifier()
-
DbxRequestConfig
@Deprecated public DbxRequestConfig(java.lang.String clientIdentifier, java.lang.String userLocale)
Deprecated.UsenewBuilder(java.lang.String)
to customize configurationCreates a new configuration.- Parameters:
clientIdentifier
- seegetClientIdentifier()
userLocale
- seegetUserLocale()
-
DbxRequestConfig
@Deprecated public DbxRequestConfig(java.lang.String clientIdentifier, java.lang.String userLocale, HttpRequestor httpRequestor)
Deprecated.UsenewBuilder(java.lang.String)
to customize configurationCreates a new configuration.- Parameters:
clientIdentifier
- seegetClientIdentifier()
userLocale
- seegetUserLocale()
httpRequestor
- seegetHttpRequestor()
-
-
Method Detail
-
getClientIdentifier
public java.lang.String getClientIdentifier()
Returns theclientIdentifier
you passed in when constructing this object.The client identifier is usually of the form "SoftwareName/SoftwareVersion". For example, if you have a project named "PhotoEdit", your might set the client identifier to
"PhotoEditServer/1.3"
in your server software and to"PhotoEditAndroid/1.8"
in your Android app.This value is prepended to the "User-Agent" HTTP header on all requests made to the Dropbox API. This has no effect on the behavior of the Dropbox API, but it may help identify your application when debugging things later.
-
getUserLocale
public java.lang.String getUserLocale()
Returns theuserLocale
you passed in when constructing this object, which defaults tonull
.This should be set to the IETF BCP 47 language tag of the end user currently using your software. Example: "en-US".
This value is passed in as the "Dropbox-API-User-Locale" HTTP header on all requests made to the Dropbox API. It controls the language used by the Dropbox API for certain return values, e.g. like error messages intended for the user.
If
null
, or if set to a value Dropbox doesn't support, the server will default to the user's configured locale setting.
-
getHttpRequestor
public HttpRequestor getHttpRequestor()
Returns theHttpRequestor
you passed in when constructing this object, which defaults toStandardHttpRequestor.INSTANCE
.
-
isAutoRetryEnabled
public boolean isAutoRetryEnabled()
Returns whether or not the client should automatically retry RPC and download requests after receiving aRetryException
.If enabled, the client will retry the request a max number of times (specified by
getMaxRetries()
) before propagating theRetryException
.Defaults to
false
(the client will not automatically retry any requests).- Returns:
- whether this client will automatically retry requests that fail with a
RetryException
-
getMaxRetries
public int getMaxRetries()
Returns the maximum number of times the client should automatically retry RPC and download requests that fail with aRetryException
.This value does not count the initial request attempt. For example, if maximum retries 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.
This value is ignored unless
isAutoRetryEnabled()
istrue
.The value returned by this method is always positive if retries are enabled, otherwise it is
0
.Defaults to
3
when retries are enabled.- Returns:
- maximum number of times the client will retry a request that throws a
RetryException
.
-
copy
public DbxRequestConfig.Builder copy()
Returns a builder for building a copy of this configuration. Useful for modifying an existing configuration.- Returns:
- builder configured to build a copy of this instance
-
newBuilder
public static DbxRequestConfig.Builder newBuilder(java.lang.String clientIdentifier)
Returns a new builder for creating aDbxRequestConfig
instance.- Parameters:
clientIdentifier
- seegetClientIdentifier()
-
-