|
40 | 40 | import org.apache.http.client.CredentialsProvider;
|
41 | 41 | import org.apache.http.client.HttpClient;
|
42 | 42 | import org.apache.http.client.RedirectHandler;
|
43 |
| -import org.apache.http.client.methods.HttpDelete; |
44 | 43 | import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
|
45 |
| -import org.apache.http.client.methods.HttpGet; |
46 | 44 | import org.apache.http.client.methods.HttpHead;
|
47 | 45 | import org.apache.http.client.methods.HttpPost;
|
48 | 46 | import org.apache.http.client.methods.HttpPut;
|
@@ -901,6 +899,23 @@ public RequestHandle get(Context context, String url, Header[] headers, RequestP
|
901 | 899 | context);
|
902 | 900 | }
|
903 | 901 |
|
| 902 | + /** |
| 903 | + * Perform a HTTP GET request and track the Android Context which initiated the request. |
| 904 | + * |
| 905 | + * @param context the Android Context which initiated the request. |
| 906 | + * @param url the URL to send the request to. |
| 907 | + * @param entity a raw {@link org.apache.http.HttpEntity} to send with the request, for |
| 908 | + * example, use this to send string/json/xml payloads to a server by |
| 909 | + * passing a {@link org.apache.http.entity.StringEntity}. |
| 910 | + * @param contentType the content type of the payload you are sending, for example |
| 911 | + * application/json if sending a json payload. |
| 912 | + * @param responseHandler the response ha ndler instance that should handle the response. |
| 913 | + * @return RequestHandle of future request process |
| 914 | + */ |
| 915 | + public RequestHandle get(Context context, String url, HttpEntity entity, String contentType, ResponseHandlerInterface responseHandler) { |
| 916 | + return sendRequest(httpClient, httpContext, addEntityToRequestBase(new HttpGet(URI.create(url).normalize()), entity), contentType, responseHandler, context); |
| 917 | + } |
| 918 | + |
904 | 919 | // [-] HTTP GET
|
905 | 920 | // [+] HTTP POST
|
906 | 921 |
|
@@ -1218,6 +1233,23 @@ public RequestHandle delete(Context context, String url, Header[] headers, Reque
|
1218 | 1233 | return sendRequest(httpClient, httpContext, httpDelete, null, responseHandler, context);
|
1219 | 1234 | }
|
1220 | 1235 |
|
| 1236 | + /** |
| 1237 | + * Perform a HTTP DELETE request and track the Android Context which initiated the request. |
| 1238 | + * |
| 1239 | + * @param context the Android Context which initiated the request. |
| 1240 | + * @param url the URL to send the request to. |
| 1241 | + * @param entity a raw {@link org.apache.http.HttpEntity} to send with the request, for |
| 1242 | + * example, use this to send string/json/xml payloads to a server by |
| 1243 | + * passing a {@link org.apache.http.entity.StringEntity}. |
| 1244 | + * @param contentType the content type of the payload you are sending, for example |
| 1245 | + * application/json if sending a json payload. |
| 1246 | + * @param responseHandler the response ha ndler instance that should handle the response. |
| 1247 | + * @return RequestHandle of future request process |
| 1248 | + */ |
| 1249 | + public RequestHandle delete(Context context, String url, HttpEntity entity, String contentType, ResponseHandlerInterface responseHandler) { |
| 1250 | + return sendRequest(httpClient, httpContext, addEntityToRequestBase(new HttpDelete(URI.create(url).normalize()), entity), contentType, responseHandler, context); |
| 1251 | + } |
| 1252 | + |
1221 | 1253 | // [-] HTTP DELETE
|
1222 | 1254 |
|
1223 | 1255 | /**
|
|
0 commit comments