@@ -1029,6 +1029,22 @@ public RequestHandle delete(Context context, String url, Header[] headers, Reque
1029
1029
1030
1030
// [-] HTTP DELETE
1031
1031
1032
+ /**
1033
+ * Instantiate a new asynchronous HTTP request for the passed parameters.
1034
+ *
1035
+ * @param client HttpClient to be used for request, can differ in single requests
1036
+ * @param contentType MIME body type, for POST and PUT requests, may be null
1037
+ * @param context Context of Android application, to hold the reference of request
1038
+ * @param httpContext HttpContext in which the request will be executed
1039
+ * @param responseHandler ResponseHandler or its subclass to put the response into
1040
+ * @param uriRequest instance of HttpUriRequest, which means it must be of HttpDelete,
1041
+ * HttpPost, HttpGet, HttpPut, etc.
1042
+ * @return AsyncHttpRequest ready to be dispatched
1043
+ */
1044
+ protected AsyncHttpRequest newAsyncHttpRequest (DefaultHttpClient client , HttpContext httpContext , HttpUriRequest uriRequest , String contentType , ResponseHandlerInterface responseHandler , Context context ) {
1045
+ return new AsyncHttpRequest (client , httpContext , uriRequest , responseHandler );
1046
+ }
1047
+
1032
1048
/**
1033
1049
* Puts a new request in queue as a new thread in pool to be executed
1034
1050
*
@@ -1061,7 +1077,7 @@ protected RequestHandle sendRequest(DefaultHttpClient client, HttpContext httpCo
1061
1077
responseHandler .setRequestHeaders (uriRequest .getAllHeaders ());
1062
1078
responseHandler .setRequestURI (uriRequest .getURI ());
1063
1079
1064
- AsyncHttpRequest request = new AsyncHttpRequest (client , httpContext , uriRequest , responseHandler );
1080
+ AsyncHttpRequest request = newAsyncHttpRequest (client , httpContext , uriRequest , contentType , responseHandler , context );
1065
1081
threadPool .submit (request );
1066
1082
RequestHandle requestHandle = new RequestHandle (request );
1067
1083
0 commit comments