Code example for HttpDelete

Methods: setHeader

0
 
        // 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);
        } 
    }