本文整理汇总了Java中io.undertow.util.StringReadChannelListener类的典型用法代码示例。如果您正苦于以下问题:Java StringReadChannelListener类的具体用法?Java StringReadChannelListener怎么用?Java StringReadChannelListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StringReadChannelListener类属于io.undertow.util包,在下文中一共展示了StringReadChannelListener类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: handleRequest
import io.undertow.util.StringReadChannelListener; //导入依赖的package包/类
@Override
public void handleRequest(final HttpServerExchange exchange) throws Exception {
if(!exchange.isRequestComplete()) {
exchange.dispatch(SameThreadExecutor.INSTANCE, new Runnable() {
@Override
public void run() {
new StringReadChannelListener(exchange.getConnection().getBufferPool()) {
@Override
protected void stringDone(String string) {
exchange.putAttachment(DATA, string);
Connectors.executeRootHandler(next, exchange);
}
@Override
protected void error(IOException e) {
UndertowLogger.REQUEST_IO_LOGGER.ioException(e);
exchange.setResponseCode(500);
exchange.endExchange();
}
}.setup(exchange.getRequestChannel());
}
});
} else {
next.handleRequest(exchange);
}
}
开发者ID:undertow-io,项目名称:undertow.js,代码行数:30,代码来源:StringReadHandler.java
示例2: upgradeConnection
import io.undertow.util.StringReadChannelListener; //导入依赖的package包/类
private void upgradeConnection(ClientExchange result) throws IOException {
if (result.getResponse().getResponseCode() == 101) {
// flush response
new StringReadChannelListener(bufferPool) {
@Override
protected void stringDone(String string) {
}
@Override
protected void error(IOException e) {
}
}.setup(result.getResponseChannel());
// Create the upgraded SPDY connection
ByteBufferPool heapBufferPool =
new XnioByteBufferPool(new ByteBufferSlicePool(BufferAllocator.BYTE_BUFFER_ALLOCATOR, 8196, 8196));
SpdyChannel spdyChannel =
new SpdyChannelWithoutFlowControl(connection.performUpgrade(), bufferPool, null, heapBufferPool, true,
OptionMap.EMPTY);
Integer idleTimeout = DEFAULT_OPTIONS.get(UndertowOptions.IDLE_TIMEOUT);
if (idleTimeout != null && idleTimeout > 0) {
spdyChannel.setIdleTimeout(idleTimeout);
}
connection = new SpdyClientConnection(spdyChannel, null);
} else {
throw new IOException("Failed to upgrade connection");
}
}
开发者ID:arquillian,项目名称:arquillian-cube,代码行数:29,代码来源:PortForwarder.java
示例3: completed
import io.undertow.util.StringReadChannelListener; //导入依赖的package包/类
@Override
public void completed(ClientExchange clientExchange) {
StringReadChannelListener readChannelListener;
readChannelListener = new ResponseBodyListener(serverExchange, connection, clientExchange);
readChannelListener.setup(clientExchange.getResponseChannel());
}
开发者ID:hawkular,项目名称:hawkular-metrics,代码行数:7,代码来源:TokenAuthenticator.java
注:本文中的io.undertow.util.StringReadChannelListener类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论