当前位置: 首页>>代码示例>>Java>>正文


Java FullHttpRequest.retain方法代码示例

本文整理汇总了Java中io.netty.handler.codec.http.FullHttpRequest.retain方法的典型用法代码示例。如果您正苦于以下问题:Java FullHttpRequest.retain方法的具体用法?Java FullHttpRequest.retain怎么用?Java FullHttpRequest.retain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.netty.handler.codec.http.FullHttpRequest的用法示例。


在下文中一共展示了FullHttpRequest.retain方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: decode

import io.netty.handler.codec.http.FullHttpRequest; //导入方法依赖的package包/类
@Override
protected void decode(ChannelHandlerContext ctx, FullHttpRequest msg, List<Object> out) throws Exception {
    msg.retain();
    out.add(msg);
    // If the session cookie exists, set its value on the ctx.
    final String sessionId = HttpRequestDecoder.getSessionId(msg, this.anonymousAccessAllowed);
    ctx.channel().attr(SESSION_ID_ATTR).set(sessionId);
    LOG.info("Found session id in WebSocket channel, setting sessionId {} on context", sessionId);
}
 
开发者ID:NationalSecurityAgency,项目名称:qonduit,代码行数:10,代码来源:WebSocketHttpCookieHandler.java

示例2: channelRead0

import io.netty.handler.codec.http.FullHttpRequest; //导入方法依赖的package包/类
@Override
public void channelRead0(final ChannelHandlerContext ctx, final FullHttpRequest msg) throws Exception {
    final Channel inboundChannel = ctx.channel();

    String host = msg.headers().get("Host");
    int port = 80;

    String pattern = "(http://|https://)?([^:]+)(:[\\d]+)?";
    Pattern r = Pattern.compile(pattern);
    Matcher m = r.matcher(host);
    if (m.find()) {
        host = m.group(2);
        port = (m.group(3) == null) ? 80 : Integer.parseInt(m.group(3).substring(1));
    }

    Bootstrap b = new Bootstrap();
    b.group(inboundChannel.eventLoop())     // use inboundChannel thread
            .channel(ctx.channel().getClass())
            .handler(new BackendHandlerInitializer(inboundChannel));

    ChannelFuture f = b.connect(host, port);
    outboundChannel = f.channel();
    msg.retain();
    f.addListener(new ChannelFutureListener() {
        public void operationComplete(ChannelFuture future) throws Exception {
            if (future.isSuccess()) {
                outboundChannel.writeAndFlush(msg);
            } else {
                inboundChannel.close();
            }
        }
    });
}
 
开发者ID:biezhi,项目名称:probe,代码行数:34,代码来源:HttpFrontendHandler.java

示例3: decode

import io.netty.handler.codec.http.FullHttpRequest; //导入方法依赖的package包/类
@Override
protected void decode(ChannelHandlerContext ctx, FullHttpRequest msg, List<Object> out) throws Exception {
    msg.retain();
    out.add(msg);
    // If the session cookie exists, set its value on the ctx.
    final String sessionId = HttpRequestDecoder.getSessionId(msg, this.anonymousAccessAllowed);
    ctx.channel().attr(SubscriptionRegistry.SESSION_ID_ATTR).set(sessionId);
    LOG.info("Found session id in WebSocket channel, setting sessionId {} on context", sessionId);
}
 
开发者ID:NationalSecurityAgency,项目名称:timely,代码行数:10,代码来源:WebSocketHttpCookieHandler.java

示例4: encode

import io.netty.handler.codec.http.FullHttpRequest; //导入方法依赖的package包/类
@Override
protected void encode(ChannelHandlerContext ctx, FullHttpRequest msg, List<Object> out) throws Exception {
    msg.retain();
    out.add(msg);
}
 
开发者ID:NationalSecurityAgency,项目名称:qonduit,代码行数:6,代码来源:WebSocketHttpCookieHandler.java


注:本文中的io.netty.handler.codec.http.FullHttpRequest.retain方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。