Java Code Examples for org.apache.http.client.methods.RequestBuilder#delete()
The following examples show how to use
org.apache.http.client.methods.RequestBuilder#delete() .
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: HttpDownloadHandler.java From cetty with Apache License 2.0 | 6 votes |
private RequestBuilder getRequestMethod(Seed seed) { String method = seed.getMethod(); if (method == null || method.equalsIgnoreCase(HttpConstants.GET)) { return RequestBuilder.get(); } else if (method.equalsIgnoreCase(HttpConstants.POST)) { return addFormParams(RequestBuilder.post(), seed); } else if (method.equalsIgnoreCase(HttpConstants.HEAD)) { return RequestBuilder.head(); } else if (method.equalsIgnoreCase(HttpConstants.PUT)) { return addFormParams(RequestBuilder.put(), seed); } else if (method.equalsIgnoreCase(HttpConstants.DELETE)) { return RequestBuilder.delete(); } else if (method.equalsIgnoreCase(HttpConstants.TRACE)) { return RequestBuilder.trace(); } throw new IllegalArgumentException("Illegal HTTP Method " + method); }
Example 2
Source File: HttpClientDownloader.java From zongtui-webcrawler with GNU General Public License v2.0 | 6 votes |
protected RequestBuilder selectRequestMethod(Request request) { String method = request.getMethod(); if (method == null || method.equalsIgnoreCase(HttpConstant.Method.GET)) { //default get return RequestBuilder.get(); } else if (method.equalsIgnoreCase(HttpConstant.Method.POST)) { RequestBuilder requestBuilder = RequestBuilder.post(); NameValuePair[] nameValuePair = (NameValuePair[]) request.getExtra("nameValuePair"); if (nameValuePair != null && nameValuePair.length > 0) { requestBuilder.addParameters(nameValuePair); } return requestBuilder; } else if (method.equalsIgnoreCase(HttpConstant.Method.HEAD)) { return RequestBuilder.head(); } else if (method.equalsIgnoreCase(HttpConstant.Method.PUT)) { return RequestBuilder.put(); } else if (method.equalsIgnoreCase(HttpConstant.Method.DELETE)) { return RequestBuilder.delete(); } else if (method.equalsIgnoreCase(HttpConstant.Method.TRACE)) { return RequestBuilder.trace(); } throw new IllegalArgumentException("Illegal HTTP Method " + method); }
Example 3
Source File: HttpUriRequestConverter.java From webmagic with Apache License 2.0 | 6 votes |
private RequestBuilder selectRequestMethod(Request request) { String method = request.getMethod(); if (method == null || method.equalsIgnoreCase(HttpConstant.Method.GET)) { //default get return RequestBuilder.get(); } else if (method.equalsIgnoreCase(HttpConstant.Method.POST)) { return addFormParams(RequestBuilder.post(),request); } else if (method.equalsIgnoreCase(HttpConstant.Method.HEAD)) { return RequestBuilder.head(); } else if (method.equalsIgnoreCase(HttpConstant.Method.PUT)) { return addFormParams(RequestBuilder.put(), request); } else if (method.equalsIgnoreCase(HttpConstant.Method.DELETE)) { return RequestBuilder.delete(); } else if (method.equalsIgnoreCase(HttpConstant.Method.TRACE)) { return RequestBuilder.trace(); } throw new IllegalArgumentException("Illegal HTTP Method " + method); }
Example 4
Source File: HTTPUtil.java From OpenAs2App with BSD 2-Clause "Simplified" License | 5 votes |
private static RequestBuilder getRequestBuilder(String method, URL urlObj, NameValuePair[] params, Enumeration<Header> headers) throws URISyntaxException { RequestBuilder req = null; if (method == null || method.equalsIgnoreCase(Method.GET)) { //default get req = RequestBuilder.get(); } else if (method.equalsIgnoreCase(Method.POST)) { req = RequestBuilder.post(); } else if (method.equalsIgnoreCase(Method.HEAD)) { req = RequestBuilder.head(); } else if (method.equalsIgnoreCase(Method.PUT)) { req = RequestBuilder.put(); } else if (method.equalsIgnoreCase(Method.DELETE)) { req = RequestBuilder.delete(); } else if (method.equalsIgnoreCase(Method.TRACE)) { req = RequestBuilder.trace(); } else { throw new IllegalArgumentException("Illegal HTTP Method: " + method); } req.setUri(urlObj.toURI()); if (params != null && params.length > 0) { req.addParameters(params); } if (headers != null) { boolean removeHeaderFolding = "true".equals(Properties.getProperty(HTTP_PROP_REMOVE_HEADER_FOLDING, "true")); while (headers.hasMoreElements()) { Header header = headers.nextElement(); String headerValue = header.getValue(); if (removeHeaderFolding) { headerValue = headerValue.replaceAll("\r\n[ \t]*", " "); } req.setHeader(header.getName(), headerValue); } } return req; }