public class DbxRequestConfig extends Object
Modifier and Type | Class and Description |
---|---|
static class |
DbxRequestConfig.Builder
Builder for
DbxRequestConfig . |
Constructor and Description |
---|
DbxRequestConfig(String clientIdentifier)
Creates a new configuration.
|
DbxRequestConfig(String clientIdentifier,
String userLocale)
Deprecated.
Use
newBuilder(java.lang.String) to customize configuration |
DbxRequestConfig(String clientIdentifier,
String userLocale,
HttpRequestor httpRequestor)
Deprecated.
Use
newBuilder(java.lang.String) to customize configuration |
Modifier and Type | Method and Description |
---|---|
DbxRequestConfig.Builder |
copy()
Returns a builder for building a copy of this configuration.
|
String |
getClientIdentifier()
Returns an identifier for the API client, typically of the form "Name/Version".
|
HttpRequestor |
getHttpRequestor()
The
HttpRequestor implementation to use when making HTTP requests to the Dropbox API
servers. |
int |
getMaxRetries()
Returns the maximum number of times the client should automatically retry RPC and download
requests that fail with a
RetryException . |
String |
getUserLocale()
Returns the locale of the user of your app as an IETF BCP 47 language tag.
|
boolean |
isAutoRetryEnabled()
Returns whether or not the client should automatically retry RPC and download requests after
recieving a
RetryException . |
static DbxRequestConfig.Builder |
newBuilder(String clientIdentifier)
Returns a new builder for creating a
DbxRequestConfig instance. |
public DbxRequestConfig(String clientIdentifier)
clientIdentifier
- client identifier typically in the form "Name/Version" to be used in
the User-Agent header (see getClientIdentifier()
).@Deprecated public DbxRequestConfig(String clientIdentifier, String userLocale)
newBuilder(java.lang.String)
to customize configurationclientIdentifier
- client identifier typically in the form "Name/Version" to be used in
the User-Agent header (see getClientIdentifier()
).userLocale
- IETF BCP 47 language tag of locale to use for user-visible text in responses, or
null
to use the user's Dropbox locale preference.@Deprecated public DbxRequestConfig(String clientIdentifier, String userLocale, HttpRequestor httpRequestor)
newBuilder(java.lang.String)
to customize configurationclientIdentifier
- client identifier typically in the form "Name/Version" to be used in
the User-Agent header (see getClientIdentifier()
).userLocale
- IETF BCP 47 language tag of locale to use for user-visible text in responses, or
null
to use the user's Dropbox locale preference.httpRequestor
- HTTP client to use for issuing requests.public String getClientIdentifier()
User-Agent
header when making API requests.
Example: "PhotoEditServer/1.3"
If you're the author a higher-level library on top of the basic SDK, and the
"Photo Edit" Android app is using your library to access Dropbox, you should append
your library's name and version to form the full identifier. For example,
if your library is called "File Picker", you might set this field to:
"PhotoEditAndroid/2.4 FilePicker/0.1-beta"
The exact format of the User-Agent
header is described in
section 3.8 of the HTTP specification.
Note that the underlying HttpRequestor
may
append other things to the User-Agent
, such as the name of the library being used to
actually make the HTTP request, or the version of the Java VM.
public String getUserLocale()
If the value is null
or some locale that Dropbox doesn't support, the strings
will be localized based on the user's Dropbox locale preference.
Defaults to null
.
null
to use user's Dropbox locale settings.public HttpRequestor getHttpRequestor()
HttpRequestor
implementation to use when making HTTP requests to the Dropbox API
servers.
Defaults to StandardHttpRequestor.INSTANCE
.
public boolean isAutoRetryEnabled()
RetryException
.
If enabled, the client will retry the request a max number of times (specified by getMaxRetries()
) before propagating the RetryException
.
Defaults to false
(the client will not automatically retry any requests).
RetryException
public int getMaxRetries()
RetryException
.
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()
is true
.
The value returned by this method is always positive if retries are enabled, otherwise it
is 0
.
Defaults to 3
when retries are enabled.
RetryException
.public DbxRequestConfig.Builder copy()
public static DbxRequestConfig.Builder newBuilder(String clientIdentifier)
DbxRequestConfig
instance.
Identifiers are typically of the form "Name/Version" (e.g. "PhotoEditServer/1.3"
). See getClientIdentifier()
for more details.clientIdentifier
- HTTP User-Agent identifier for the API app (see getClientIdentifier()
), never null