Example usage for org.apache.http.impl.nio.client HttpExchange reset

List of usage examples for org.apache.http.impl.nio.client HttpExchange reset

Introduction

In this page you can find the example usage for org.apache.http.impl.nio.client HttpExchange reset.

Prototype

public void reset() 

Source Link

Usage

From source file:org.apache.http.impl.nio.client.NHttpClientProtocolHandler.java

private void processResponse(final NHttpClientConnection conn, final HttpExchange httpexchange,
        final HttpAsyncExchangeHandler<?> handler) throws IOException {
    if (!httpexchange.isValid()) {
        conn.close();//from   www  .  j  a  v a  2  s . c  om
    }
    HttpRequest request = httpexchange.getRequest();
    HttpResponse response = httpexchange.getResponse();

    String method = request.getRequestLine().getMethod();
    int status = response.getStatusLine().getStatusCode();
    if (method.equalsIgnoreCase("CONNECT") && status == HttpStatus.SC_OK) {
        this.log.debug("CONNECT method succeeded");
        conn.resetInput();
    } else {
        if (!handler.keepAlive(response)) {
            conn.close();
        }
    }
    if (this.log.isDebugEnabled()) {
        this.log.debug("Response processed " + formatState(conn, httpexchange));
    }
    handler.responseCompleted();
    httpexchange.reset();
}