/** * Get the response sender. * <p> * For blocking exchanges this will return a sender that uses the underlying output stream. * * @return the response sender, or {@code null} if another party already acquired the channel or the sender * @see #getResponseChannel() */ public Sender getResponseSender() { if (blockingHttpExchange != null) { return blockingHttpExchange.getSender(); } if (sender != null) { return sender; } return sender = new AsyncSenderImpl(this); }
@Override public void close() { close(null); }
invokeOnException(callback, new ClosedChannelException()); return; invokeOnException(callback, new IOException(UndertowMessages.MESSAGES.responseComplete())); ++i; send(bufs, callback);
invokeOnException(callback, new ClosedChannelException()); return; invokeOnException(callback, new IOException(UndertowMessages.MESSAGES.responseComplete())); invokeOnException(callback, UndertowLogger.ROOT_LOGGER.dataLargerThanContentLength(buffer.remaining(), responseContentLength)); return; initWriteListener(); invokeOnComplete(); invokeOnException(callback, e);
@Override public void send(final String data, final Charset charset) { send(data, charset, IoCallback.END_EXCHANGE); }
if (res == 0) { if(writeListener == null) { initWriteListener(); invokeOnException(callback, e);
@Override public void transferFrom(FileChannel source, IoCallback callback) { if (callback == null) { throw UndertowMessages.MESSAGES.argumentCannotBeNull("callback"); } if(!exchange.getConnection().isOpen()) { invokeOnException(callback, new ClosedChannelException()); return; } if(exchange.isResponseComplete()) { invokeOnException(callback, new IOException(UndertowMessages.MESSAGES.responseComplete())); } if (this.fileChannel != null || this.buffer != null) { throw UndertowMessages.MESSAGES.dataAlreadyQueued(); } this.callback = callback; this.fileChannel = source; if (inCallback) { return; } if(transferTask == null) { transferTask = new TransferTask(); } if (exchange.isInIoThread()) { exchange.dispatch(transferTask); return; } transferTask.run(); }
invokeOnException(callback, new ClosedChannelException()); return; invokeOnException(callback, new IOException(UndertowMessages.MESSAGES.responseComplete())); long responseContentLength = exchange.getResponseContentLength(); if(responseContentLength > 0 && totalToWrite > responseContentLength) { invokeOnException(callback, UndertowLogger.ROOT_LOGGER.dataLargerThanContentLength(totalToWrite, responseContentLength)); return; initWriteListener(); invokeOnComplete(); invokeOnException(callback, e);
@Override public void send(final ByteBuffer buffer) { send(buffer, IoCallback.END_EXCHANGE); }
if (res == 0) { if(writeListener == null) { initWriteListener(); invokeOnException(callback, e);
invokeOnException(callback, e);
invokeOnException(callback, new ClosedChannelException()); return; invokeOnException(callback, new IOException(UndertowMessages.MESSAGES.responseComplete())); invokeOnException(callback, UndertowLogger.ROOT_LOGGER.dataLargerThanContentLength(buffer.remaining(), responseContentLength)); return; initWriteListener(); invokeOnComplete(); invokeOnException(callback, e);
@Override public void send(final String data, final IoCallback callback) { send(data, StandardCharsets.UTF_8, callback); }
invokeOnException(callback, new ClosedChannelException()); return; invokeOnException(callback, new IOException(UndertowMessages.MESSAGES.responseComplete())); ++i; send(bufs, callback);
if (res == 0) { if(writeListener == null) { initWriteListener(); invokeOnException(callback, e);
@Override public void transferFrom(FileChannel source, IoCallback callback) { if (callback == null) { throw UndertowMessages.MESSAGES.argumentCannotBeNull("callback"); } if(!exchange.getConnection().isOpen()) { invokeOnException(callback, new ClosedChannelException()); return; } if(exchange.isResponseComplete()) { invokeOnException(callback, new IOException(UndertowMessages.MESSAGES.responseComplete())); } if (this.fileChannel != null || this.buffer != null) { throw UndertowMessages.MESSAGES.dataAlreadyQueued(); } this.callback = callback; this.fileChannel = source; if (inCallback) { return; } if(transferTask == null) { transferTask = new TransferTask(); } if (exchange.isInIoThread()) { exchange.dispatch(transferTask); return; } transferTask.run(); }
@Override public void close() { close(null); }
/** * Get the response sender. * <p> * For blocking exchanges this will return a sender that uses the underlying output stream. * * @return the response sender, or {@code null} if another party already acquired the channel or the sender * @see #getResponseChannel() */ public Sender getResponseSender() { if (blockingHttpExchange != null) { return blockingHttpExchange.getSender(); } if (sender != null) { return sender; } return sender = new AsyncSenderImpl(this); }
invokeOnException(callback, new ClosedChannelException()); return; invokeOnException(callback, new IOException(UndertowMessages.MESSAGES.responseComplete())); invokeOnException(callback, UndertowLogger.ROOT_LOGGER.dataLargerThanContentLength(buffer.remaining(), responseContentLength)); return; initWriteListener(); invokeOnComplete(); invokeOnException(callback, e);
@Override public void send(final String data) { send(data, IoCallback.END_EXCHANGE); }