private void sendBadRequestAndClose(final StreamConnection connection, final Throwable exception) { UndertowLogger.REQUEST_IO_LOGGER.failedToParseRequest(exception); connection.getSourceChannel().suspendReads(); new StringWriteChannelListener(BAD_REQUEST) { @Override protected void writeDone(final StreamSinkChannel c) { super.writeDone(c); c.suspendWrites(); IoUtils.safeClose(connection); } @Override protected void handleError(StreamSinkChannel channel, IOException e) { IoUtils.safeClose(connection); } }.setup(connection.getSinkChannel()); }
private void sendBadRequestAndClose(final StreamConnection connection, final Throwable exception) { UndertowLogger.REQUEST_IO_LOGGER.failedToParseRequest(exception); connection.getSourceChannel().suspendReads(); new StringWriteChannelListener(BAD_REQUEST) { @Override protected void writeDone(final StreamSinkChannel c) { super.writeDone(c); c.suspendWrites(); IoUtils.safeClose(connection); } @Override protected void handleError(StreamSinkChannel channel, IOException e) { IoUtils.safeClose(connection); } }.setup(connection.getSinkChannel()); }
private void sendBadRequestAndClose(final StreamConnection connection, final Throwable exception) { UndertowLogger.REQUEST_IO_LOGGER.failedToParseRequest(exception); connection.getSourceChannel().suspendReads(); new StringWriteChannelListener(BAD_REQUEST) { @Override protected void writeDone(final StreamSinkChannel c) { super.writeDone(c); c.suspendWrites(); IoUtils.safeClose(connection); } @Override protected void handleError(StreamSinkChannel channel, IOException e) { IoUtils.safeClose(connection); } }.setup(connection.getSinkChannel()); }