@@ -809,8 +809,16 @@ public void delete(Context context, String url, Header[] headers, RequestParams
809
809
sendRequest (httpClient , httpContext , httpDelete , null , responseHandler , context );
810
810
}
811
811
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
+ */
814
822
protected void sendRequest (DefaultHttpClient client , HttpContext httpContext , HttpUriRequest uriRequest , String contentType , AsyncHttpResponseHandler responseHandler , Context context ) {
815
823
if (contentType != null ) {
816
824
uriRequest .addHeader ("Content-Type" , contentType );
@@ -832,6 +840,12 @@ protected void sendRequest(DefaultHttpClient client, HttpContext httpContext, Ht
832
840
}
833
841
}
834
842
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
+ */
835
849
public void setURLEncodingEnabled (boolean enabled ) {
836
850
this .isUrlEncodingEnabled = enabled ;
837
851
}
@@ -858,6 +872,13 @@ public static String getUrlWithQueryString(boolean isUrlEncodingEnabled, String
858
872
return url ;
859
873
}
860
874
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
+ */
861
882
private HttpEntity paramsToEntity (RequestParams params , AsyncHttpResponseHandler responseHandler ) {
862
883
HttpEntity entity = null ;
863
884
@@ -875,6 +896,12 @@ private HttpEntity paramsToEntity(RequestParams params, AsyncHttpResponseHandler
875
896
return entity ;
876
897
}
877
898
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
+ */
878
905
private HttpEntityEnclosingRequestBase addEntityToRequestBase (HttpEntityEnclosingRequestBase requestBase , HttpEntity entity ) {
879
906
if (entity != null ) {
880
907
requestBase .setEntity (entity );
@@ -883,6 +910,9 @@ private HttpEntityEnclosingRequestBase addEntityToRequestBase(HttpEntityEnclosin
883
910
return requestBase ;
884
911
}
885
912
913
+ /**
914
+ * Enclosing entity to hold stream of gzip decoded data for accessing HttpEntity contents
915
+ */
886
916
private static class InflatingEntity extends HttpEntityWrapper {
887
917
public InflatingEntity (HttpEntity wrapped ) {
888
918
super (wrapped );
0 commit comments