@Override public void cancelled() { this.request.abort(); } }
@Override public void close() throws IOException { HttpPost request = this.request; if (request != null) { request.abort(); } }
@Override public URI getURI() { return this.httpRequest.getURI(); }
/** * Create a Commons HttpMethodBase object for the given HTTP method and URI specification. * @param httpMethod the HTTP method * @param uri the URI * @return the Commons HttpMethodBase object */ protected HttpUriRequest createHttpUriRequest(HttpMethod httpMethod, URI uri) { switch (httpMethod) { case GET: return new HttpGet(uri); case HEAD: return new HttpHead(uri); case POST: return new HttpPost(uri); case PUT: return new HttpPut(uri); case PATCH: return new HttpPatch(uri); case DELETE: return new HttpDelete(uri); case OPTIONS: return new HttpOptions(uri); case TRACE: return new HttpTrace(uri); default: throw new IllegalArgumentException("Invalid HTTP method: " + httpMethod); } }
public HttpPost createPost(String url) { return new HttpPost(url); }
/** * Creates a new HttpUriRequest for the given url. The default is to create a HttpGet without * any further configuration. Subclasses may override this method and provide their own logic. * * @param url the url to be fetched * @return the HttpUriRequest for the given url */ protected HttpUriRequest newHttpUriRequest(String url) { return new HttpGet(url); }
@Override public void addHeader(String key, String value) { request.addHeader(new BasicHeader(key, value)); }
@Override public String getMethodValue() { return this.httpRequest.getMethod(); }
public HttpClientConnection(HttpClient httpClient, URL url) { this.httpClient = httpClient; this.output = new ByteArrayOutputStream(); this.request = new HttpPost(url.toString()); }
public HttpGet createGet(String url) { return new HttpGet(url); }
@Override public void addHeader(String key, String value) { request.addHeader(new BasicHeader(key, value)); }
@Override public URI getURI() { return this.httpRequest.getURI(); }
@Override public String getMethodValue() { return this.httpRequest.getMethod(); }
@Override public void cancelled() { this.request.abort(); } }
@Override public void close() throws IOException { HttpPost request = this.request; if (request != null) { request.abort(); } }
public HttpClientConnection(HttpClient httpClient, URL url) { this.httpClient = httpClient; this.output = new ByteArrayOutputStream(); this.request = new HttpPost(url.toString()); }
@Override public URI getURI() { return this.httpRequest.getURI(); }
@Override public String getMethodValue() { return this.httpRequest.getMethod(); }
@Override public String getMethodValue() { return this.httpRequest.getMethod(); }