Android HttpDelete - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android HttpDelete class.

This code example shows how to use the following methods:
     * @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);
    } 
     
    /** 
     * 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);
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
        if( !( args[0] instanceof String ) )
        { 
            throw new IllegalArgumentException( "First argument must be a string." ); //$NON-NLS-1$
        } 
 
        HttpDelete deleteAPIMethod = new HttpDelete();
 
        return httpJSONAPI( deleteAPIMethod, args );
    } 
 
    public String getHost()
    { 
        return hostname;
    } 
 
    private HttpClient getHttpClient()
    { 
        if( httpClient == null )
        { 
            httpClient = new DefaultHttpClient();
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setHeader
	    	HttpClient httpClient = new DefaultHttpClient();
	         
			String id = params[0];
			 
			HttpDelete del = 
					new HttpDelete("http://10.0.2.2:2731/Api/Clientes/Cliente/" + id);
			 
			del.setHeader("content-type", "application/json");
			 
			try 
	        {			 
	        	HttpResponse resp = httpClient.execute(del);
	        	String respStr = EntityUtils.toString(resp.getEntity());
	        	 
	        	if(!respStr.equals("true"))
	        		resul = false;
	        } 
	        catch(Exception ex)
	        { 
	        	Log.e("ServicioRest","Error!", ex);
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
                // UrlEncodedFormEntity entity = getPostParamters(params); 
                ByteArrayEntity formEntity = new ByteArrayEntity(data);
                post.setEntity(formEntity);
                request = post;
            } else if (method.equals("DELETE")) {
                request = new HttpDelete(url);
            } 
            setHeader(method, request, params, url, token);
            HttpResponse response = client.execute(request);
            StatusLine status = response.getStatusLine();
            int statusCode = status.getStatusCode();
 
            if (statusCode != 200) {
                result = read(response);
                String err = null;
                int errCode = 0;
				try { 
					JSONObject json = new JSONObject(result);
					err = json.getString("error");
					errCode = json.getInt("error_code");
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
	public <T> void deleteChildId(Class<?> parentClass, String parentId, T object, 
                Integer value) throws RedmineException {
            final EntityConfig<T> config = getConfig(object.getClass());
            URI uri = getURIConfigurator().getChildIdURI(parentClass, 
                    parentId, object.getClass(), value);
            HttpDelete httpDelete = new HttpDelete(uri);
            String response = getCommunicator().sendRequest(httpDelete);
            logger.debug(response);
	} 
 
	/** 
	 * Deletes an object. 
	 *  
	 * @param classs 
	 *            object class. 
	 * @param id 
	 *            object id. 
	 * @throws RedmineException 
	 *             if something goes wrong. 
	 */ 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setHeaders
   * @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);
  } 
 
  // Private stuff 
  private void sendRequest(DefaultHttpClient client, HttpContext httpContext,
      HttpUriRequest uriRequest, String contentType, AsyncHttpResponseHandler responseHandler,
      Context context) {
    if (contentType != null) {
      uriRequest.addHeader("Content-Type", contentType);
    } 
 
    Future<?> request =
        threadPool.submit(new AsyncHttpRequest(client, httpContext, uriRequest, responseHandler));
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:addHeader, addHeader
 
	public HttpBundle delete(LoadBalancer loadBalancer) throws CloudServersException {
		HttpResponse resp = null;
		CustomHttpClient httpclient = new CustomHttpClient(context);
 
		HttpDelete delete = new HttpDelete(LoadBalancer.getRegionUrl(loadBalancer.getRegion()) + Account.getAccount().getAccountId() 
				+ "/loadbalancers/" + loadBalancer.getId() + "/connectionthrottle");				
		delete.addHeader("X-Auth-Token", Account.getAccount().getAuthToken());
		delete.addHeader("Content-Type", "application/xml");
		httpclient.removeRequestInterceptorByClass(RequestExpectContinue.class);
 
		HttpBundle bundle = new HttpBundle();
		bundle.setCurlRequest(delete);
 
		try {			 
			resp = httpclient.execute(delete);
			bundle.setHttpResponse(resp);
		} catch (ClientProtocolException e) {
			CloudServersException cse = new CloudServersException();
			cse.setMessage(e.getLocalizedMessage());
			throw cse;
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setHeader
 
        // Create client and set our specific user-agent string 
        HttpClient client = CreateClient();
        java.net.URI uri = URI.create(url);
        HttpHost host = GetHost(uri);
        HttpDelete request = new HttpDelete(uri.getPath());
        request.setHeader("User-Agent", sUserAgent);
 
        try { 
            HttpResponse response = client.execute(host, request);
 
            // Check if server response is valid 
            StatusLine status = response.getStatusLine();
            Log.i(cTag, "delete with response " + status.toString());
            return status.getStatusCode() == HttpStatus.SC_OK;
 
        } catch (IOException e) {
            throw new ApiException("Problem communicating with API", e);
        } 
    } 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:addHeader
 
	public HttpBundle delete(String string) throws CloudServersException {
		HttpResponse resp = null;
		CustomHttpClient httpclient = new CustomHttpClient(context);
		String url = getSafeURL(Account.getAccount().getStorageUrl(), string);
		HttpDelete put = new HttpDelete(url);
		 
		put.addHeader("X-Auth-Token", Account.getAccount().getAuthToken());
		httpclient.removeRequestInterceptorByClass(RequestExpectContinue.class);
 
		HttpBundle bundle = new HttpBundle();
		bundle.setCurlRequest(put);
		 
		try { 
			resp = httpclient.execute(put);
			bundle.setHttpResponse(resp);
		} catch (ClientProtocolException e) {
			CloudServersException cse = new CloudServersException();
			cse.setMessage(e.getLocalizedMessage());
			throw cse;
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setHeaders
     * @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);
    } 
 
 
    // Private stuff 
    protected void sendRequest(DefaultHttpClient client, HttpContext httpContext, HttpUriRequest uriRequest, String contentType, AsyncHttpResponseHandler responseHandler, Context context) {
        if(contentType != null) {
            uriRequest.addHeader("Content-Type", contentType);
        } 
 
        Future<?> request = threadPool.submit(new AsyncHttpRequest(client, httpContext, uriRequest, responseHandler));
 
        if(context != null) {
5
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Android HttpDelete Questions & Answers:

See Code Examples for Android HttpDelete Methods: