@Override public void failed(IOException e) { result.setException(e); } }, bindAddress, uri, ioThread, ssl, bufferPool, options);
@Override public void failed(IOException e) { ioFuture.setException(e); } }, bindAddress, proxyUri, worker, proxySsl, bufferPool, optionMap);
@Override public void failed(IOException e) { result.setException(e); } }, bindAddress, uri, worker, ssl, bufferPool, options);
public void handleError(final Channel channel, final IOException error) { futureResult.setException(error); }
public void handleFailed(final IOException exception, final FutureResult<T> manager) { manager.setException(exception); }
@Override public void failed(IOException e) { result.setException(e); } }, bindAddress, uri, worker, ssl, bufferPool, options);
@Override public void failed(IOException e) { result.setException(e); } }, bindAddress, uri, ioThread, ssl, bufferPool, options);
public void handleError(final Channel channel, final IOException error) { futureResult.setException(error); }
@Override public void handleException(StreamSinkChannel channel, IOException exception) { safeClose(channel); future.setException(exception); } }));
@Override public void onException(final HttpServerExchange exchange, final Sender sender, final IOException exception) { UndertowLogger.REQUEST_IO_LOGGER.ioException(exception); future.setException(exception); } });
@Override public IoFuture<Void> sendData(final ByteBuffer data) { try { while (data.hasRemaining()) { out.write(data.get()); } return new FinishedIoFuture<>(null); } catch (IOException e) { final FutureResult<Void> ioFuture = new FutureResult<>(); ioFuture.setException(e); return ioFuture.getIoFuture(); } }
@Override public IoFuture<byte[]> readRequestData() { final ByteArrayOutputStream data = new ByteArrayOutputStream(); try { byte[] buf = new byte[1024]; int r; while ((r = in.read(buf)) != -1) { data.write(buf, 0, r); } return new FinishedIoFuture<>(data.toByteArray()); } catch (IOException e) { final FutureResult<byte[]> ioFuture = new FutureResult<>(); ioFuture.setException(e); return ioFuture.getIoFuture(); } } }
@Override public void handleEvent(final StreamSourceChannel channel) { int res; try { res = channel.read(buffer); if (res == -1) { future.setResult(data.toByteArray()); channel.suspendReads(); return; } else if (res == 0) { return; } else { buffer.flip(); while (buffer.hasRemaining()) { data.write(buffer.get()); } buffer.clear(); } } catch (IOException e) { future.setException(e); } } });
if (contentLength != null) { if (!"0".equals(contentLength)) { future.setException(new IOException("Upgrade responses must have a content length of zero.")); return; future.setException(new IOException("Upgrade responses cannot have a transfer coding")); return; future.setException(e); return;
private void handleRedirect(final HttpUpgradeParser parser) { List<String> location = parser.getHeaders().get("location"); future.setException(new RedirectException(msg.redirect(), parser.getResponseCode(), location == null ? null : location.get(0))); }
public void handleEvent(final StreamConnection connection) { try { SSLEngine sslEngine = JsseSslUtils.createSSLEngine(sslContext, optionMap, destination); SSLParameters params = sslEngine.getSSLParameters(); params.setServerNames(Collections.singletonList(new SNIHostName(destination.getHostString()))); sslEngine.setSSLParameters(params); final SslConnection wrappedConnection = new UndertowSslConnection(connection, sslEngine, bufferPool); if (!futureResult.setResult(wrappedConnection)) { IoUtils.safeClose(connection); } else { ChannelListeners.invokeChannelListener(wrappedConnection, openListener); } } catch (Throwable e) { futureResult.setException(new IOException(e)); } } }
void handleReady(final int ops) { final SocketChannel channel = getChannel(); boolean ok = false; try { if (channel.finishConnect()) { selectorLog.tracef("handleReady connect finished"); suspend(SelectionKey.OP_CONNECT); getSelectionKey().attach(connection.getConduit()); if (futureResult.setResult(connection)) { ok = true; ChannelListeners.invokeChannelListener(connection, openListener); } } } catch (IOException e) { selectorLog.tracef("ConnectHandle.handleReady Exception, " + e); futureResult.setException(e); } finally { if (!ok) { selectorLog.tracef("!OK, closing connection"); safeClose(connection); } } }
futureResult.setException(e); } finally { if (! ok) {
} catch (final IOException e) { channel.closeAsync(); channel.addCloseHandler((closed, exception) -> futureResult.setException(e));
private void flushUpgradeChannel() { try { if(!connection.getSinkChannel().flush()) { connection.getSinkChannel().getWriteSetter().set(ChannelListeners.flushingChannelListener(new ChannelListener<StreamSinkChannel>() { @Override public void handleEvent(StreamSinkChannel channel) { channel.suspendWrites(); new UpgradeResultListener().handleEvent(connection.getSourceChannel()); } }, new ChannelExceptionHandler<StreamSinkChannel>() { @Override public void handleException(StreamSinkChannel channel, IOException exception) { safeClose(channel); future.setException(exception); } })); connection.getSinkChannel().resumeWrites(); return; } } catch (IOException e) { safeClose(connection); future.setException(e); return; } new UpgradeResultListener().handleEvent(connection.getSourceChannel()); }