Java Code Examples for org.apache.http.client.methods.HttpRequestBase#reset()

The following examples show how to use org.apache.http.client.methods.HttpRequestBase#reset() . 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: HttpClient.java    From hsac-fitnesse-fixtures with Apache License 2.0 5 votes vote down vote up
protected void cleanupAfterRequest(org.apache.http.HttpResponse response, HttpRequestBase method) {
    method.reset();
    if (response instanceof CloseableHttpResponse) {
        try {
            ((CloseableHttpResponse)response).close();
        } catch (IOException e) {
            throw new RuntimeException("Unable to close connection", e);
        }
    }
}
 
Example 2
Source File: HttpCaller.java    From timbuctoo with GNU General Public License v3.0 5 votes vote down vote up
private <T> T executeRequest(HttpRequest value, ValueTransformer<T> valueConverter) throws IOException {
  HttpRequestBase request = createRequest(value);

  try {
    HttpResponse response = client.execute(request);
    T returnValue = valueConverter.transform(response);
    return returnValue;
  } finally {
    request.reset();
  }
}
 
Example 3
Source File: AbstractCalendarHandler.java    From openmeetings with Apache License 2.0 4 votes vote down vote up
/**
 * Resets the Method for reusablility.
 * @param method Method to reset.
 */
void releaseConnection(HttpRequestBase method) {
	if (method != null) {
		method.reset();
	}
}