Skip to content

Commit 8760193

Browse files
committed
Javadoc for AsyncHttpClient
1 parent 3799800 commit 8760193

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

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

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -809,8 +809,16 @@ public void delete(Context context, String url, Header[] headers, RequestParams
809809
sendRequest(httpClient, httpContext, httpDelete, null, responseHandler, context);
810810
}
811811

812-
813-
// Private stuff
812+
/**
813+
* Puts a new request in queue as a new thread in pool to be executed
814+
*
815+
* @param client HttpClient to be used for request, can differ in single requests
816+
* @param contentType MIME body type, for POST and PUT requests, may be null
817+
* @param context Context of Android application, to hold the reference of request
818+
* @param httpContext HttpContext in which the request will be executed
819+
* @param responseHandler ResponseHandler or its subclass to put the response into
820+
* @param uriRequest instance of HttpUriRequest, which means it must be of HttpDelete, HttpPost, HttpGet, HttpPut, etc.
821+
*/
814822
protected void sendRequest(DefaultHttpClient client, HttpContext httpContext, HttpUriRequest uriRequest, String contentType, AsyncHttpResponseHandler responseHandler, Context context) {
815823
if (contentType != null) {
816824
uriRequest.addHeader("Content-Type", contentType);
@@ -832,6 +840,12 @@ protected void sendRequest(DefaultHttpClient client, HttpContext httpContext, Ht
832840
}
833841
}
834842

843+
/**
844+
* Sets state of URL encoding feature, see bug #227, this method
845+
* allows you to turn off and on this auto-magic feature on-demand.
846+
*
847+
* @param enabled desired state of feature
848+
*/
835849
public void setURLEncodingEnabled(boolean enabled) {
836850
this.isUrlEncodingEnabled = enabled;
837851
}
@@ -858,6 +872,13 @@ public static String getUrlWithQueryString(boolean isUrlEncodingEnabled, String
858872
return url;
859873
}
860874

875+
/**
876+
* Returns HttpEntity containing data from RequestParams included with request declaration.
877+
* Allows also passing progress from upload via provided ResponseHandler
878+
*
879+
* @param params additional request params
880+
* @param responseHandler AsyncHttpResponseHandler or its subclass to be notified on progress
881+
*/
861882
private HttpEntity paramsToEntity(RequestParams params, AsyncHttpResponseHandler responseHandler) {
862883
HttpEntity entity = null;
863884

@@ -875,6 +896,12 @@ private HttpEntity paramsToEntity(RequestParams params, AsyncHttpResponseHandler
875896
return entity;
876897
}
877898

899+
/**
900+
* Applicable only to HttpRequest methods extending HttpEntityEnclosingRequestBase, which is for example not DELETE
901+
*
902+
* @param entity entity to be included within the request
903+
* @param requestBase HttpRequest instance, must not be null
904+
*/
878905
private HttpEntityEnclosingRequestBase addEntityToRequestBase(HttpEntityEnclosingRequestBase requestBase, HttpEntity entity) {
879906
if (entity != null) {
880907
requestBase.setEntity(entity);
@@ -883,6 +910,9 @@ private HttpEntityEnclosingRequestBase addEntityToRequestBase(HttpEntityEnclosin
883910
return requestBase;
884911
}
885912

913+
/**
914+
* Enclosing entity to hold stream of gzip decoded data for accessing HttpEntity contents
915+
*/
886916
private static class InflatingEntity extends HttpEntityWrapper {
887917
public InflatingEntity(HttpEntity wrapped) {
888918
super(wrapped);

0 commit comments

Comments
 (0)