コード例 #1
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 params additional DELETE parameters or files to send along with request
  * @param responseHandler the response handler instance that should handle the response.
  */
 public RequestHandle delete(
     Context context,
     String url,
     Header[] headers,
     RequestParams params,
     AsyncHttpResponseHandler responseHandler) {
   HttpDelete httpDelete =
       new HttpDelete(getUrlWithQueryString(isUrlEncodingEnabled, url, params));
   if (headers != null) httpDelete.setHeaders(headers);
   return sendRequest(httpClient, httpContext, httpDelete, null, responseHandler, context);
 }
コード例 #2
0
ファイル: Http.java プロジェクト: Carboni/jenkins-jobs
  /**
   * Sends a POST request and returns the response.
   *
   * @param endpoint The endpoint to send the request to.
   * @param responseClass The class to deserialise the Json response to. Can be null if no response
   *     message is expected.
   * @param headers Any additional headers to send with this request. You can use {@link
   *     org.apache.http.HttpHeaders} constants for header names.
   * @param <T> The type to deserialise the response to.
   * @return A {@link Response} containing the deserialised body, if any.
   * @throws IOException If an error occurs.
   */
  public <T> Response<T> delete(Endpoint endpoint, Class<T> responseClass, NameValuePair... headers)
      throws IOException {

    // Create the request
    HttpDelete delete = new HttpDelete(endpoint.url());
    delete.setHeaders(combineHeaders(headers));

    // Send the request and process the response
    try (CloseableHttpResponse response = httpClient().execute(delete)) {
      T body = deserialiseResponseMessage(response, responseClass);
      return new Response<>(response.getStatusLine(), body);
    }
  }
コード例 #3
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);
 }
コード例 #4
0
ファイル: Http.java プロジェクト: ZhangUP/CloudposSDK
 public Object deleteSync(String url, Header[] headers) {
   final HttpDelete delete = new HttpDelete(url);
   if (headers != null) delete.setHeaders(headers);
   return sendSyncRequest(httpClient, httpContext, delete, null);
 }
コード例 #5
0
ファイル: Http.java プロジェクト: ZhangUP/CloudposSDK
 public void delete(String url, Header[] headers, AjaxCallBack<? extends Object> callBack) {
   final HttpDelete delete = new HttpDelete(url);
   if (headers != null) delete.setHeaders(headers);
   sendRequest(httpClient, httpContext, delete, null, callBack);
 }