io.undertow.util.StringWriteChannelListener Java Examples
The following examples show how to use
io.undertow.util.StringWriteChannelListener.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HttpReadListener.java From lams with GNU General Public License v2.0 | 6 votes |
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()); }