@Override public void handleEvent(final StreamSinkChannel channel) { if(callback != null) { callback.onComplete(exchange, AsyncSenderImpl.this); } } }, new ChannelExceptionHandler<StreamSinkChannel>() {
@Override public void onComplete(final HttpServerExchange exchange, final Sender sender) { callback.onComplete(exchange, sender); }
@Override public void onComplete(final HttpServerExchange exchange, final Sender sender) { try { entry.dereference(); } finally { callback.onComplete(exchange, sender); } }
private void invokeOnComplete(final IoCallback callback) { inCall = true; try { callback.onComplete(exchange, this); } finally { inCall = false; } while (next != null || pendingFile != null) { ByteBuffer[] next = this.next; IoCallback queuedCallback = this.queuedCallback; FileChannel file = this.pendingFile; this.next = null; this.queuedCallback = null; this.pendingFile = null; if (next != null) { for (ByteBuffer buffer : next) { writeBuffer(buffer, queuedCallback); } } else if (file != null) { performTransfer(file, queuedCallback); } inCall = true; try { queuedCallback.onComplete(exchange, this); } finally { inCall = false; } } }
callback.onComplete(exchange, this); } else { int i = 0;
if (count == -1 || (len != -1 && total >= len)) { done(); callback.onComplete(exchange, sender); } else { total += count;
do { if (buffer.remaining() == 0) { callback.onComplete(exchange, this); return;
private static void internalSendContinueResponse(final HttpServerExchange exchange, final IoCallback callback) { if(exchange.getAttachment(ALREADY_SENT) != null) { callback.onComplete(exchange, null); return; exchange.dispatch(); } else { callback.onComplete(exchange, null);
inCallback = true; try { callback.onComplete(exchange, this); } finally { inCallback = false;
} else { if (callback != null) { callback.onComplete(exchange, this);
@Override public void handleEvent(final StreamSinkChannel channel) { if(callback != null) { callback.onComplete(exchange, AsyncSenderImpl.this); } } }, new ChannelExceptionHandler<StreamSinkChannel>() {
@Override public void handleEvent(final StreamSinkChannel channel) { if(callback != null) { callback.onComplete(exchange, AsyncSenderImpl.this); } } }, new ChannelExceptionHandler<StreamSinkChannel>() {
@Override public void onComplete(final HttpServerExchange exchange, final Sender sender) { callback.onComplete(exchange, sender); }
@Override public void onComplete(final HttpServerExchange exchange, final Sender sender) { try { entry.dereference(); } finally { callback.onComplete(exchange, sender); } }
@Override public void onComplete(HttpServerExchange exchange, Sender sender) { IO.close(channel); IoCallback.END_EXCHANGE.onComplete(exchange, sender); }
@Override public void onComplete(HttpServerExchange exchange, Sender sender) { IO.close(channel); IoCallback.END_EXCHANGE.onComplete(exchange, sender); }
@Override public void onComplete(final HttpServerExchange exchange, final Sender sender) { try { entry.dereference(); } finally { callback.onComplete(exchange, sender); } }
private void invokeOnComplete(final IoCallback callback) { inCall = true; try { callback.onComplete(exchange, this); } finally { inCall = false; } while (next != null) { String next = this.next; IoCallback queuedCallback = this.queuedCallback; this.next = null; this.queuedCallback = null; writer.write(next); if (writer.checkError()) { queuedCallback.onException(exchange, this, new IOException()); } else { inCall = true; try { queuedCallback.onComplete(exchange, this); } finally { inCall = false; } } } }
private void invokeOnComplete(final IoCallback callback) { inCall = true; try { callback.onComplete(exchange, this); } finally { inCall = false; } while (next != null || pendingFile != null) { ByteBuffer[] next = this.next; IoCallback queuedCallback = this.queuedCallback; FileChannel file = this.pendingFile; this.next = null; this.queuedCallback = null; this.pendingFile = null; if (next != null) { for (ByteBuffer buffer : next) { writeBuffer(buffer, queuedCallback); } } else if (file != null) { performTransfer(file, queuedCallback); } inCall = true; try { queuedCallback.onComplete(exchange, this); } finally { inCall = false; } } }
@Override public void serve(final Sender sender, final HttpServerExchange exchange, final IoCallback ioCallback) { exchange.startBlocking(); final OutputStream outStream = exchange.getOutputStream(); try { Files.copy(path, outStream); ioCallback.onComplete(exchange, sender); } catch (IOException e) { LOG.error("Could not serve content file", e); ioCallback.onException(exchange, sender, e); } }