Skip to content

Commit febbd44

Browse files
author
Kannan Goundan
committed
DbxRequestConfig: Clarify docs for userLocale, clientIdentifier, etc.
1 parent d237d5c commit febbd44

File tree

1 file changed

+34
-46
lines changed

1 file changed

+34
-46
lines changed

src/main/java/com/dropbox/core/DbxRequestConfig.java

Lines changed: 34 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ private DbxRequestConfig(String clientIdentifier, /*@Nullable*/ String userLocal
3131
/**
3232
* Creates a new configuration.
3333
*
34-
* @param clientIdentifier client identifier typically in the form "Name/Version" to be used in
35-
* the User-Agent header (see {@link #getClientIdentifier}).
34+
* @param clientIdentifier see {@link #getClientIdentifier}
3635
*/
3736
public DbxRequestConfig(String clientIdentifier) {
3837
this(clientIdentifier, null);
@@ -41,10 +40,8 @@ public DbxRequestConfig(String clientIdentifier) {
4140
/**
4241
* Creates a new configuration.
4342
*
44-
* @param clientIdentifier client identifier typically in the form "Name/Version" to be used in
45-
* the User-Agent header (see {@link #getClientIdentifier}).
46-
* @param userLocale IETF BCP 47 language tag of locale to use for user-visible text in responses, or
47-
* {@code null} to use the user's Dropbox locale preference.
43+
* @param clientIdentifier see {@link #getClientIdentifier}
44+
* @param userLocale see {@link #getUserLocale}
4845
*
4946
* @deprecated Use {@link #newBuilder} to customize configuration
5047
*/
@@ -56,11 +53,9 @@ public DbxRequestConfig(String clientIdentifier, /*@Nullable*/ String userLocale
5653
/**
5754
* Creates a new configuration.
5855
*
59-
* @param clientIdentifier client identifier typically in the form "Name/Version" to be used in
60-
* the User-Agent header (see {@link #getClientIdentifier}).
61-
* @param userLocale IETF BCP 47 language tag of locale to use for user-visible text in responses, or
62-
* {@code null} to use the user's Dropbox locale preference.
63-
* @param httpRequestor HTTP client to use for issuing requests.
56+
* @param clientIdentifier see {@link #getClientIdentifier}
57+
* @param userLocale see {@link #getUserLocale}
58+
* @param httpRequestor see {@link #getHttpRequestor}
6459
*
6560
* @deprecated Use {@link #newBuilder} to customize configuration
6661
*/
@@ -70,57 +65,54 @@ public DbxRequestConfig(String clientIdentifier, /*@Nullable*/ String userLocale
7065
}
7166

7267
/**
73-
* Returns an identifier for the API client, typically of the form "Name/Version".
74-
* This is used to set the HTTP {@code User-Agent} header when making API requests.
75-
* Example: {@code "PhotoEditServer/1.3"}
68+
* Returns the {@link clientIdentifier} you passed in when constructing this object.
7669
*
7770
* <p>
78-
* If you're the author a higher-level library on top of the basic SDK, and the
79-
* "Photo Edit" Android app is using your library to access Dropbox, you should append
80-
* your library's name and version to form the full identifier. For example,
81-
* if your library is called "File Picker", you might set this field to:
82-
* {@code "PhotoEditAndroid/2.4 FilePicker/0.1-beta"}
71+
* The client identifier is usually of the form "SoftwareName/SoftwareVersion".
72+
* For example, if you have a project named "PhotoEdit", your might set the client
73+
* identifier to {@code "PhotoEditServer/1.3"} in your server software and to
74+
* {@code "PhotoEditAndroid/1.8"} in your Android app.
8375
* </p>
8476
*
8577
* <p>
86-
* The exact format of the {@code User-Agent} header is described in
87-
* <a href="http://tools.ietf.org/html/rfc2616#section-3.8">section 3.8 of the HTTP specification</a>.
78+
* This value is prepended to the
79+
* <a href="https://tools.ietf.org/html/rfc7231#section-5.5.3">"User-Agent"
80+
* HTTP header</a> on all requests made to the Dropbox API. This has no effect on the
81+
* behavior of the Dropbox API, but it may help identify your application when
82+
* debugging things later.
8883
* </p>
89-
*
90-
* <p>
91-
* Note that the underlying {@link com.dropbox.core.http.HttpRequestor HttpRequestor} may
92-
* append other things to the {@code User-Agent}, such as the name of the library being used to
93-
* actually make the HTTP request, or the version of the Java VM.
94-
* </p>
95-
*
96-
* @return HTTP User-Agent identifier for the API client
9784
*/
9885
public String getClientIdentifier() {
9986
return clientIdentifier;
10087
}
10188

10289
/**
103-
* Returns the locale of the user of your app as an IETF BCP 47 language tag. This is used by
104-
* the Dropbox server to localize user-visible strings returned by API calls.
90+
* Returns the {@code userLocale} you passed in when constructing this object, which
91+
* defaults to {@code null}.
10592
*
106-
* <p> If the value is {@code null} or some locale that Dropbox doesn't support, the strings
107-
* will be localized based on the user's Dropbox locale preference.
93+
* <p>
94+
* This should be set to the <a href="https://tools.ietf.org/html/bcp47">IETF BCP 47
95+
* language tag</a> of the end user currently using your software. Example: "en-US".
96+
* </p>
10897
*
109-
* <p> Defaults to {@code null}.
98+
* <p>
99+
* This value is passed in as the "Dropbox-API-User-Locale" HTTP header on all requests
100+
* made to the Dropbox API. It controls the language used by the Dropbox API for certain
101+
* return values, e.g. like error messages intended for the user.
102+
* </p>
110103
*
111-
* @return locale of app user, or {@code null} to use user's Dropbox locale settings.
104+
* <p>
105+
* If {@code null}, or if set to a value Dropbox doesn't support, the server will default
106+
* to the user's configured locale setting.
107+
* </p>
112108
*/
113109
public String getUserLocale() {
114110
return userLocale;
115111
}
116112

117113
/**
118-
* The {@link HttpRequestor} implementation to use when making HTTP requests to the Dropbox API
119-
* servers.
120-
*
121-
* <p> Defaults to {@link StandardHttpRequestor#INSTANCE}.
122-
*
123-
* @return HTTP requestor to use for issuing HTTP requests.
114+
* Returns the {@link HttpRequestor} you passed in when constructing this object, which
115+
* defaults to {@link StandardHttpRequestor#INSTANCE}.
124116
*/
125117
public HttpRequestor getHttpRequestor() {
126118
return httpRequestor;
@@ -178,11 +170,7 @@ public Builder copy() {
178170
/**
179171
* Returns a new builder for creating a {@link DbxRequestConfig} instance.
180172
*
181-
* Identifiers are typically of the form "Name/Version" (e.g. {@code
182-
* "PhotoEditServer/1.3"}). See {@link #getClientIdentifier} for more details.
183-
*
184-
* @param clientIdentifier HTTP User-Agent identifier for the API app (see {@link
185-
* #getClientIdentifier}), never {@code null}
173+
* @param clientIdentifier see {@link #getClientIdentifier}
186174
*/
187175
public static Builder newBuilder(String clientIdentifier) {
188176
if (clientIdentifier == null) throw new NullPointerException("clientIdentifier");

0 commit comments

Comments
 (0)