本文整理了Java中org.apache.http.client.fluent.Request.Delete
方法的一些代码示例,展示了Request.Delete
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.Delete
方法的具体详情如下:
包路径:org.apache.http.client.fluent.Request
类名称:Request
方法名:Delete
暂无
代码示例来源:origin: dreamhead/moco
public HttpResponse deleteForResponse(final String url) throws IOException {
return execute(Request.Delete(url));
}
代码示例来源:origin: dreamhead/moco
public HttpResponse deleteForResponseWithHeaders(final String url, final ImmutableMultimap<String, String> headers)
throws IOException {
Request request = Request.Delete(url);
for (Map.Entry<String, String> entry : headers.entries()) {
request.addHeader(entry.getKey(), entry.getValue());
}
return execute(request);
}
代码示例来源:origin: dreamhead/moco
@Override
public void run() throws IOException {
Request request = Request.Delete(remoteUrl("/foo"));
String response = helper.executeAsString(request);
assertThat(response, is("bar"));
}
});
代码示例来源:origin: dreamhead/moco
@Override
public void run() throws IOException {
Request request = Request.Delete(remoteUrl("/foo"));
String response = helper.executeAsString(request);
assertThat(response, is("bar"));
}
});
代码示例来源:origin: jooby-project/jooby
public Request delete(final String path) {
this.req = new Request(this, executor(), org.apache.http.client.fluent.Request.Delete(host
+ path));
return req;
}
代码示例来源:origin: dreamhead/moco
@Test
public void should_return_expected_response_based_on_specified_delete_request() throws IOException {
runWithConfiguration("delete_method.json");
String response = helper.executeAsString(Request.Delete(remoteUrl("/delete")));
assertThat(response, is("response_for_delete_method"));
}
代码示例来源:origin: dreamhead/moco
@Override
public void run() throws IOException {
assertThat(helper.get(remoteUrl("/proxy")), is("get_proxy"));
assertThat(helper.postContent(remoteUrl("/proxy"), "proxy"), is("post_proxy"));
Request putRequest = Request.Put(remoteUrl("/proxy")).bodyString("proxy", ContentType.DEFAULT_TEXT);
assertThat(helper.executeAsString(putRequest), is("put_proxy"));
Request deleteRequest = Request.Delete(remoteUrl("/proxy"));
assertThat(helper.executeAsString(deleteRequest), is("delete_proxy"));
Request headRequest = Request.Head(remoteUrl("/proxy"));
StatusLine headStatusLine = helper.execute(headRequest).getStatusLine();
assertThat(headStatusLine.getStatusCode(), is(200));
Request optionsRequest = Request.Options(remoteUrl("/proxy"));
assertThat(helper.executeAsString(optionsRequest), is("options_proxy"));
Request traceRequest = Request.Trace(remoteUrl("/proxy"));
assertThat(helper.executeAsString(traceRequest), is("trace_proxy"));
}
});
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons
@Override
public Request delete(String partialUrl) {
String url = baseUrl + partialUrl;
return Request.Delete(url);
}
代码示例来源:origin: com.adobe.acs/acs-aem-commons-bundle
@Override
public Request delete(String partialUrl) {
String url = baseUrl + partialUrl;
return Request.Delete(url);
}
代码示例来源:origin: com.github.rebue.wheel/wheel-core
/**
* 发出DELETE请求
*
* @param url
* 请求的地址
* @return 响应的字符串
*/
public static String delete(String url) throws IOException {
_log.info("准备发出只有URL的DELETE请求: {}", url);
try {
String result = Request.Delete(url).execute().returnContent().asString();
_log.info("接收到response的信息: {}", result);
return result;
} catch (IOException e) {
_log.error("HTTP请求出现异常:" + e.getMessage(), e);
throw e;
}
}
代码示例来源:origin: mesosphere/dcos-commons
/**
* Delete an existing secret.
*
* @param path path which contains the secret
* @throws IOException if the operation failed
*/
public void delete(String path) throws IOException {
query("delete", path, Request.Delete(uriForPath(path)), HttpStatus.SC_NO_CONTENT);
}
代码示例来源:origin: streampipes/streampipes-ce
public PipelineElementStatus detach() {
try {
Response httpResp = Request.Delete(belongsTo).connectTimeout(10000).execute();
return handleResponse(httpResp);
} catch (Exception e) {
LOG.error("Could not stop pipeline " + belongsTo, e.getMessage());
return new PipelineElementStatus(belongsTo, payload.getName(), false, e.getMessage());
}
}
代码示例来源:origin: org.streampipes/streampipes-pipeline-management
public PipelineElementStatus detach() {
try {
Response httpResp = Request.Delete(belongsTo).connectTimeout(10000).execute();
return handleResponse(httpResp);
} catch (Exception e) {
LOG.error("Could not stop pipeline " + belongsTo, e.getMessage());
return new PipelineElementStatus(belongsTo, payload.getName(), false, e.getMessage());
}
}
代码示例来源:origin: com.github.dcshock/consul-rest-client
/**
* Issue a DELETE to the given URL.
*/
public static HttpResp delete(final String url) throws IOException {
return Http.toHttpResp(executor.execute(Request.Delete(url))
.returnResponse());
}
代码示例来源:origin: edu.jhuapl.dorset/dorset-core
private Response delete(HttpRequest request) throws IOException {
Request apacheRequest = Request.Delete(request.getUrl());
prepareRequest(apacheRequest);
return apacheRequest.execute();
}
}
代码示例来源:origin: mgtechsoftware/smockin
public static HttpClientResponseDTO delete(final HttpClientCallDTO reqDto) throws IOException {
final Request request = Request.Delete(reqDto.getUrl());
return executeRequest(request, reqDto.getHeaders());
}
代码示例来源:origin: com.github.rebue.wheel/wheel-core
/**
* 发出DELETE请求(将Map对象转为请求的FORM参数)
*
* @param url
* 请求的地址
* @param requestParams
* 请求的参数
* @return 响应的字符串
*/
public static String deleteByFormParams(String url, Map<String, Object> requestParams) throws IOException {
_log.info("准备发出带FORM参数的DELETE请求: {}", url);
Form form = Form.form();
for (Entry<String, Object> requestParam : requestParams.entrySet()) {
form.add(requestParam.getKey(), requestParam.getValue().toString());
}
try {
String result = Request.Delete(url).bodyForm(form.build()).execute().returnContent().asString();
_log.info("接收到response的信息: {}", result);
return result;
} catch (IOException e) {
_log.error("HTTP请求出现异常:" + e.getMessage(), e);
throw e;
}
}
代码示例来源:origin: mgtechsoftware/smockin
HttpClientResponseDTO delete(final HttpClientCallDTO reqDto) throws IOException {
final Request request = Request.Delete(reqDto.getUrl());
return executeRequest(request, reqDto.getHeaders());
}
代码示例来源:origin: rancher/cattle
public static boolean deleteExternalAccountLink(Region targetRegion, ExternalAccountLink externalLink) throws IOException {
String uri = String.format("%s/v2-beta/accountLinks/%s", getUrl(targetRegion), externalLink.getId());
Request req = Request.Delete(uri);
setHeaders(req, targetRegion);
req.execute().handleResponse(new ResponseHandler<ExternalAccountLink>() {
@Override
public ExternalAccountLink handleResponse(HttpResponse response) throws ClientProtocolException, IOException {
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode >= 300) {
throw new IOException(String.format("Failed to delete external accountLink [%s], response error code [%s]", externalLink.getId(),
response.getStatusLine().getReasonPhrase()));
}
return null;
}
});
return true;
}
代码示例来源:origin: rancher/cattle
public static void deleteExternalAgent(Agent agent, Region targetRegion, ExternalAgent externalAgent) throws ClientProtocolException, IOException {
String uri = String.format("%s/v2-beta/agents/%s", getUrl(targetRegion), externalAgent.getId());
Request req = Request.Delete(uri);
setHeaders(req, targetRegion);
req.execute().handleResponse(new ResponseHandler<ExternalAgent>() {
@Override
public ExternalAgent handleResponse(HttpResponse response) throws ClientProtocolException, IOException {
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode >= 300) {
throw new IOException(String.format("Failed to delete external agent externalId=%s, response error code %s", agent.getUuid(),
response.getStatusLine().getReasonPhrase()));
}
return null;
}
});
}
内容来源于网络,如有侵权,请联系作者删除!