コード例 #1
0
 /**
  * Perform a HTTP GET request and track the Android Context which initiated the request with
  * customized headers
  *
  * @param url the URL to send the request to.
  * @param headers set headers only for this request
  * @param params additional GET parameters to send with the request.
  * @param responseHandler the response handler instance that should handle the response.
  */
 public void get(
     Context context,
     String url,
     Header[] headers,
     RequestParams params,
     AsyncHttpResponseHandler responseHandler) {
   HttpUriRequest request = new HttpGet(getUrlWithQueryString(url, params));
   if (headers != null) request.setHeaders(headers);
   sendRequest(httpClient, httpContext, request, null, responseHandler, context);
 }
 public void delete(
     Context context, String str, AsyncHttpResponseHandler asyncHttpResponseHandler) {
   sendRequest(
       this.httpClient,
       this.httpContext,
       new HttpDelete(str),
       null,
       asyncHttpResponseHandler,
       context);
 }
コード例 #3
0
 /**
  * Perform a HTTP GET request and track the Android Context which initiated the request.
  *
  * @param context the Android Context which initiated the request.
  * @param url the URL to send the request to.
  * @param params additional GET parameters to send with the request.
  * @param responseHandler the response handler instance that should handle the response.
  */
 public void get(
     Context context, String url, RequestParams params, AsyncHttpResponseHandler responseHandler) {
   sendRequest(
       httpClient,
       httpContext,
       new HttpGet(getUrlWithQueryString(url, params)),
       null,
       responseHandler,
       context);
 }
コード例 #4
0
 /**
  * Perform a HTTP PUT request and track the Android Context which initiated the request. And set
  * one-time headers for the request
  *
  * @param context the Android Context which initiated the request.
  * @param url the URL to send the request to.
  * @param headers set one-time headers for this request
  * @param entity a raw {@link HttpEntity} to send with the request, for example, use this to send
  *     string/json/xml payloads to a server by passing a {@link
  *     org.apache.http.entity.StringEntity}.
  * @param contentType the content type of the payload you are sending, for example
  *     application/json if sending a json payload.
  * @param responseHandler the response handler instance that should handle the response.
  */
 public void put(
     Context context,
     String url,
     Header[] headers,
     HttpEntity entity,
     String contentType,
     AsyncHttpResponseHandler responseHandler) {
   HttpEntityEnclosingRequestBase request = addEntityToRequestBase(new HttpPut(url), entity);
   if (headers != null) request.setHeaders(headers);
   sendRequest(httpClient, httpContext, request, contentType, responseHandler, context);
 }
コード例 #5
0
 /**
  * Perform a HTTP POST request and track the Android Context which initiated the request. Set
  * headers only for this request
  *
  * @param context the Android Context which initiated the request.
  * @param url the URL to send the request to.
  * @param headers set headers only for this request
  * @param params additional POST parameters to send with the request.
  * @param contentType the content type of the payload you are sending, for example
  *     application/json if sending a json payload.
  * @param responseHandler the response handler instance that should handle the response.
  */
 public void post(
     Context context,
     String url,
     Header[] headers,
     RequestParams params,
     String contentType,
     AsyncHttpResponseHandler responseHandler) {
   HttpEntityEnclosingRequestBase request = new HttpPost(url);
   if (params != null) request.setEntity(paramsToEntity(params));
   if (headers != null) request.setHeaders(headers);
   sendRequest(cachingHttpClient, httpContext, request, contentType, responseHandler, context);
 }
 public void delete(
     Context context,
     String str,
     Header[] headerArr,
     AsyncHttpResponseHandler asyncHttpResponseHandler) {
   HttpUriRequest httpDelete = new HttpDelete(str);
   if (headerArr != null) {
     httpDelete.setHeaders(headerArr);
   }
   sendRequest(
       this.httpClient, this.httpContext, httpDelete, null, asyncHttpResponseHandler, context);
 }
 public void get(
     Context context,
     String str,
     Header[] headerArr,
     RequestParams requestParams,
     AsyncHttpResponseHandler asyncHttpResponseHandler) {
   HttpUriRequest httpGet = new HttpGet(getUrlWithQueryString(str, requestParams));
   if (headerArr != null) {
     httpGet.setHeaders(headerArr);
   }
   sendRequest(
       this.httpClient, this.httpContext, httpGet, null, asyncHttpResponseHandler, context);
 }
 public void get(
     Context context,
     String str,
     RequestParams requestParams,
     AsyncHttpResponseHandler asyncHttpResponseHandler) {
   sendRequest(
       this.httpClient,
       this.httpContext,
       new HttpGet(getUrlWithQueryString(str, requestParams)),
       null,
       asyncHttpResponseHandler,
       context);
 }
コード例 #9
0
 /**
  * Perform a HTTP PUT request and track the Android Context which initiated the request. And set
  * one-time headers for the request
  *
  * @param context the Android Context which initiated the request.
  * @param url the URL to send the request to.
  * @param entity a raw {@link HttpEntity} to send with the request, for example, use this to send
  *     string/json/xml payloads to a server by passing a {@link
  *     org.apache.http.entity.StringEntity}.
  * @param contentType the content type of the payload you are sending, for example
  *     application/json if sending a json payload.
  * @param responseHandler the response handler instance that should handle the response.
  */
 public void put(
     Context context,
     String url,
     HttpEntity entity,
     String contentType,
     AsyncHttpResponseHandler responseHandler) {
   sendRequest(
       httpClient,
       httpContext,
       addEntityToRequestBase(new HttpPut(url), entity),
       contentType,
       responseHandler,
       context);
 }
コード例 #10
0
 public void put(
     Context context,
     String str,
     HttpEntity httpEntity,
     String str2,
     AsyncHttpResponseHandler asyncHttpResponseHandler) {
   sendRequest(
       this.httpClient,
       this.httpContext,
       addEntityToRequestBase(new HttpPut(str), httpEntity),
       str2,
       asyncHttpResponseHandler,
       context);
 }
コード例 #11
0
 public void post(
     Context context,
     String str,
     Header[] headerArr,
     RequestParams requestParams,
     String str2,
     AsyncHttpResponseHandler asyncHttpResponseHandler) {
   HttpUriRequest httpPost = new HttpPost(str);
   if (requestParams != null) {
     httpPost.setEntity(paramsToEntity(requestParams));
   }
   if (headerArr != null) {
     httpPost.setHeaders(headerArr);
   }
   sendRequest(
       this.httpClient, this.httpContext, httpPost, str2, asyncHttpResponseHandler, context);
 }
コード例 #12
0
 public void put(
     Context context,
     String str,
     Header[] headerArr,
     HttpEntity httpEntity,
     String str2,
     AsyncHttpResponseHandler asyncHttpResponseHandler) {
   HttpUriRequest addEntityToRequestBase = addEntityToRequestBase(new HttpPut(str), httpEntity);
   if (headerArr != null) {
     addEntityToRequestBase.setHeaders(headerArr);
   }
   sendRequest(
       this.httpClient,
       this.httpContext,
       addEntityToRequestBase,
       str2,
       asyncHttpResponseHandler,
       context);
 }
コード例 #13
0
 /**
  * Perform a HTTP DELETE request.
  *
  * @param context the Android Context which initiated the request.
  * @param url the URL to send the request to.
  * @param headers set one-time headers for this request
  * @param responseHandler the response handler instance that should handle the response.
  */
 public void delete(
     Context context, String url, Header[] headers, AsyncHttpResponseHandler responseHandler) {
   final HttpDelete delete = new HttpDelete(url);
   if (headers != null) delete.setHeaders(headers);
   sendRequest(httpClient, httpContext, delete, null, responseHandler, context);
 }
コード例 #14
0
 /**
  * Perform a HTTP DELETE request.
  *
  * @param context the Android Context which initiated the request.
  * @param url the URL to send the request to.
  * @param responseHandler the response handler instance that should handle the response.
  */
 public void delete(Context context, String url, AsyncHttpResponseHandler responseHandler) {
   final HttpDelete delete = new HttpDelete(url);
   sendRequest(httpClient, httpContext, delete, null, responseHandler, context);
 }