use of org.eclipse.jetty.client.HttpExchange in project jetty.project by eclipse.
the class HttpChannelOverFCGI method content.
protected boolean content(ByteBuffer buffer, Callback callback) {
idle.notIdle();
HttpExchange exchange = getHttpExchange();
if (exchange != null)
return receiver.responseContent(exchange, buffer, callback);
callback.succeeded();
return false;
}
use of org.eclipse.jetty.client.HttpExchange in project jetty.project by eclipse.
the class HttpChannelOverFCGI method responseBegin.
protected boolean responseBegin(int code, String reason) {
idle.notIdle();
HttpExchange exchange = getHttpExchange();
if (exchange == null)
return false;
exchange.getResponse().version(version).status(code).reason(reason);
return receiver.responseBegin(exchange);
}
use of org.eclipse.jetty.client.HttpExchange in project jetty.project by eclipse.
the class HttpChannelOverFCGI method responseHeaders.
protected boolean responseHeaders() {
idle.notIdle();
HttpExchange exchange = getHttpExchange();
return exchange != null && receiver.responseHeaders(exchange);
}
use of org.eclipse.jetty.client.HttpExchange in project jetty.project by eclipse.
the class HttpReceiverOverHTTP2 method onReset.
@Override
public void onReset(Stream stream, ResetFrame frame) {
HttpExchange exchange = getHttpExchange();
if (exchange == null)
return;
ErrorCode error = ErrorCode.from(frame.getError());
String reason = error == null ? "reset" : error.name().toLowerCase(Locale.ENGLISH);
exchange.getRequest().abort(new IOException(reason));
}
use of org.eclipse.jetty.client.HttpExchange in project jetty.project by eclipse.
the class HttpReceiverOverHTTP2 method onHeaders.
@Override
public void onHeaders(Stream stream, HeadersFrame frame) {
HttpExchange exchange = getHttpExchange();
if (exchange == null)
return;
HttpResponse response = exchange.getResponse();
MetaData.Response metaData = (MetaData.Response) frame.getMetaData();
response.version(metaData.getHttpVersion()).status(metaData.getStatus()).reason(metaData.getReason());
if (responseBegin(exchange)) {
HttpFields headers = metaData.getFields();
for (HttpField header : headers) {
if (!responseHeader(exchange, header))
return;
}
if (responseHeaders(exchange)) {
int status = metaData.getStatus();
boolean informational = HttpStatus.isInformational(status) && status != HttpStatus.SWITCHING_PROTOCOLS_101;
if (frame.isEndStream() || informational)
responseSuccess(exchange);
}
}
}
Aggregations