HttpClient - Delete Method
Author: Adrian Sutton

##### Overview

- Features
- News
- Status
- Download
- Wiki
- User Guide
  - Authentication Guide
  - Character Encodings
  - Cookies
  - Exception Handling
  - Logging Guide
  - Methods
  - Optimization Guide
  - Preference Architecture
  - Redirects Handling
  - Sample Code
  - SSL Guide
  - Threading
  - Trouble Shooting
  - Tutorial
- Developer Guide

##### Project Documentation

- About
- Project Info
- Project Reports
- Development Process

##### Legend

- External Link
- Opens in a new window

## Introduction

The delete method requests that the origin server delete the resource identified by the request URL. This method may be overridden by human intervention (or other means) on the origin server. The client cannot be guaranteed that the operation has been carried out, even if the status code returned from the origin server indicates that the action has been completed successfully. However, the server should not indicate success unless, at the time the response is given, it intends to delete the resource or move it to an inaccessible location.

A successful response should be 200 (OK) if the response includes a response body describing the status, 202 (Accepted) if the action has not yet been enacted, or 204 (No Content) if the action has been enacted but the response does not include a response body.

If the request passes through a cache and the URL identifies one or more currently cached entities, those entries should be treated as stale. Responses to this method are not cacheable.

## Typical Usage

The delete method is used by supplying a URL to delete the resource at and reading the response from the server.

            DeleteMethod delete = new DeleteMethod("http://jakarata.apache.org");
            // execute the method and handle any error responses.
            ...
            // Ensure that if there is a response body it is read, then release the
            // connection.
            ...
            delete.releaseConnection();

## Common Problems

The DELETE method is not widely supported on public servres due to security concerns and generally FTP is used to delete files on the webserver. Before executing a DELETE method, it may be worth checking that DELETE is supported using the OPTIONS method.

## RFC Section

The delete method is defined in section 9.7 of RFC2616.