當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。