Java Code Examples for org.apache.http.client.methods.HttpDelete#abort()

The following examples show how to use org.apache.http.client.methods.HttpDelete#abort() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HttpClientUtil.java    From charging_pile_cloud with MIT License 5 votes vote down vote up
/**
 * 封装HTTP DELETE方法
 *
 * @param
 * @return
 */
public static String delete(String url) throws ClientProtocolException, IOException {
    HttpClient httpClient = new DefaultHttpClient();
    HttpDelete httpDelete = new HttpDelete();
    httpDelete.setURI(URI.create(url));
    HttpResponse response = httpClient.execute(httpDelete);
    String httpEntityContent = getHttpEntityContent(response);
    httpDelete.abort();
    return httpEntityContent;
}
 
Example 2
Source File: HttpClientUtil.java    From charging_pile_cloud with MIT License 5 votes vote down vote up
/**
 * 封装HTTP DELETE方法
 *
 * @param
 * @param
 * @return
 */
public static String delete(String url, Map<String, String> paramMap)
        throws ClientProtocolException, IOException {
    HttpClient httpClient = new DefaultHttpClient();
    HttpDelete httpDelete = new HttpDelete();
    List<NameValuePair> formparams = setHttpParams(paramMap);
    String param = URLEncodedUtils.format(formparams, "UTF-8");
    httpDelete.setURI(URI.create(url + "?" + param));
    HttpResponse response = httpClient.execute(httpDelete);
    String httpEntityContent = getHttpEntityContent(response);
    httpDelete.abort();
    return httpEntityContent;
}
 
Example 3
Source File: HttpClients.java    From flash-waimai with MIT License 5 votes vote down vote up
/**
 * 封装HTTP DELETE方法
 *
 * @param
 * @return
 * @throws ClientProtocolException
 * @throws IOException
 */
public static String delete(String url) throws ClientProtocolException, IOException {
	HttpClient httpClient = new DefaultHttpClient();
	HttpDelete httpDelete = new HttpDelete();
	httpDelete.setURI(URI.create(url));
	HttpResponse response = httpClient.execute(httpDelete);
	String httpEntityContent = getHttpEntityContent(response);
	httpDelete.abort();
	return httpEntityContent;
}
 
Example 4
Source File: HttpClients.java    From flash-waimai with MIT License 5 votes vote down vote up
/**
 * 封装HTTP DELETE方法
 *
 * @param
 * @param
 * @return
 * @throws ClientProtocolException
 * @throws IOException
 */
public static String delete(String url, Map<String, String> paramMap) throws ClientProtocolException, IOException {
	HttpClient httpClient = new DefaultHttpClient();
	HttpDelete httpDelete = new HttpDelete();
	List<NameValuePair> formparams = setHttpParams(paramMap);
	String param = URLEncodedUtils.format(formparams, "UTF-8");
	httpDelete.setURI(URI.create(url + "?" + param));
	HttpResponse response = httpClient.execute(httpDelete);
	String httpEntityContent = getHttpEntityContent(response);
	httpDelete.abort();
	return httpEntityContent;
}