Example usage for org.apache.http.nio.protocol HttpAsyncExchange setCallback

List of usage examples for org.apache.http.nio.protocol HttpAsyncExchange setCallback

Introduction

In this page you can find the example usage for org.apache.http.nio.protocol HttpAsyncExchange setCallback.

Prototype

void setCallback(Cancellable cancellable);

Source Link

Document

Sets Cancellable callback to be invoked in case the underlying connection times out or gets terminated prematurely by the client.

Usage

From source file:org.callimachusproject.server.helpers.Exchange.java

public synchronized void setHttpAsyncExchange(HttpAsyncExchange exchange) {
    assert exchange != null;
    this.exchange = exchange;
    exchange.setCallback(this);
    if (timeout != -1) {
        exchange.setTimeout(timeout);/* w w w. ja  va  2s  . c  o  m*/
    }
    if (response != null) {
        exchange.submitResponse(producer = new LoggingResponseProducer(response));
    } else if (submitContinue != null) {
        exchange.submitResponse(submitContinue);
    }
}