Skip to content

Commit 93a4514

Browse files
committed
Updated client-wide headers documentation
1 parent 900e8bf commit 93a4514

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/com/loopj/android/http/AsyncHttpClient.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public class AsyncHttpClient {
103103
private HttpContext httpContext;
104104
private ThreadPoolExecutor threadPool;
105105
private Map<Context, List<WeakReference<Future>>> requestMap;
106-
private Map<String, String>headerMap;
106+
private Map<String, String> clientHeaderMap;
107107

108108

109109
/**
@@ -134,8 +134,8 @@ public void process(HttpRequest request, HttpContext context) {
134134
if (!request.containsHeader(HEADER_ACCEPT_ENCODING)) {
135135
request.addHeader(HEADER_ACCEPT_ENCODING, ENCODING_GZIP);
136136
}
137-
for (String header : headerMap.keySet()) {
138-
request.addHeader(header, headerMap.get(header));
137+
for (String header : clientHeaderMap.keySet()) {
138+
request.addHeader(header, clientHeaderMap.get(header));
139139
}
140140
}
141141
});
@@ -160,7 +160,7 @@ public void process(HttpResponse response, HttpContext context) {
160160
threadPool = (ThreadPoolExecutor)Executors.newCachedThreadPool();
161161

162162
requestMap = new WeakHashMap<Context, List<WeakReference<Future>>>();
163-
headerMap = new HashMap<String, String>();
163+
clientHeaderMap = new HashMap<String, String>();
164164
}
165165

166166
/**
@@ -208,10 +208,12 @@ public void setSSLSocketFactory(SSLSocketFactory sslSocketFactory) {
208208
}
209209

210210
/**
211-
* Sets headers that will get added when the request is intercepted (before sending).
211+
* Sets headers that will be added to all requests this client makes (before sending).
212+
* @param header the name of the header
213+
* @param value the contents of the header
212214
*/
213215
public void addHeader(String header, String value) {
214-
headerMap.put(header, value);
216+
clientHeaderMap.put(header, value);
215217
}
216218

217219
/**

0 commit comments

Comments
 (0)