@Override public String name() { return ctx.name(); }
@Override public String name() { return ctx.name(); }
@Override public String name() { return ctx.name(); }
@Override public String name() { return ctx.name(); }
@Override public String name() { return context.name(); }
private static void removeThisHandler(ChannelHandlerContext ctx) { ctx.pipeline().remove(ctx.name()); }
@Override protected void addCodec(ChannelHandlerContext ctx) throws Exception { ChannelPipeline p = ctx.pipeline(); String name = ctx.name(); p.addBefore(name, null, codec); }
@Override public void handlerAdded(ChannelHandlerContext ctx) throws Exception { super.handlerAdded(ctx); name = ctx.name(); }
@Override public void operationComplete(ChannelFuture future) throws Exception { if (future.isSuccess()) { for (WebSocketServerExtension extension : validExtensions) { WebSocketExtensionDecoder decoder = extension.newExtensionDecoder(); WebSocketExtensionEncoder encoder = extension.newExtensionEncoder(); ctx.pipeline().addAfter(ctx.name(), decoder.getClass().getName(), decoder); ctx.pipeline().addAfter(ctx.name(), encoder.getClass().getName(), encoder); } } ctx.pipeline().remove(ctx.name()); } });
@Override public void handlerAdded(ChannelHandlerContext ctx) { ChannelPipeline cp = ctx.pipeline(); if (cp.get(WebSocketClientProtocolHandshakeHandler.class) == null) { // Add the WebSocketClientProtocolHandshakeHandler before this one. ctx.pipeline().addBefore(ctx.name(), WebSocketClientProtocolHandshakeHandler.class.getName(), new WebSocketClientProtocolHandshakeHandler(handshaker)); } if (cp.get(Utf8FrameValidator.class) == null) { // Add the UFT8 checking before this one. ctx.pipeline().addBefore(ctx.name(), Utf8FrameValidator.class.getName(), new Utf8FrameValidator()); } } }
@Override public void upgradeTo(ChannelHandlerContext ctx, FullHttpResponse upgradeResponse) throws Exception { // Add the handler to the pipeline. ctx.pipeline().addAfter(ctx.name(), handlerName, upgradeToHandler); // Reserve local stream 1 for the response. connectionHandler.onHttpClientUpgrade(); }
@Override public void handlerAdded(ChannelHandlerContext ctx) throws Exception { ctx.pipeline() .addBefore(ctx.name(), null, new Http2ServerUpgradeHandler.PriorKnowledgeHandler()) .addBefore(ctx.name(), "HttpServerCodec", httpServerCodec) .replace(this, "HttpServerUpgradeHandler", httpServerUpgradeHandler); }
@Override public void handlerAdded(ChannelHandlerContext ctx) throws Exception { ctx.pipeline() .addBefore(ctx.name(), null, new Http2ServerUpgradeHandler.PriorKnowledgeHandler()) .addBefore(ctx.name(), "HttpServerCodec", httpServerCodec) .replace(this, "HttpServerUpgradeHandler", httpServerUpgradeHandler); }
@Override protected void addCodec(ChannelHandlerContext ctx) throws Exception { ChannelPipeline p = ctx.pipeline(); String name = ctx.name(); Socks4ClientDecoder decoder = new Socks4ClientDecoder(); p.addBefore(name, null, decoder); decoderName = p.context(decoder).name(); encoderName = decoderName + ".encoder"; p.addBefore(name, encoderName, Socks4ClientEncoder.INSTANCE); }
@Override protected void addCodec(ChannelHandlerContext ctx) throws Exception { ChannelPipeline p = ctx.pipeline(); String name = ctx.name(); Socks5InitialResponseDecoder decoder = new Socks5InitialResponseDecoder(); p.addBefore(name, null, decoder); decoderName = p.context(decoder).name(); encoderName = decoderName + ".encoder"; p.addBefore(name, encoderName, Socks5ClientEncoder.DEFAULT); }
private String addAfter(ChannelPipeline p, String baseName, ChannelHandler handler) { p.addAfter(baseName, null, handler); return p.context(handler).name(); } }
private String addAfter(final ChannelPipeline p, final String baseName, final String name, final ChannelHandler h) { p.addAfter(baseName, name, h); return p.context(h).name(); } }
void addBeforeSessionHandler(ChannelPipeline pipeline, ChannelHandler handler) { // Get the name of the HttpSessionHandler so that we can put our handlers before it. final ChannelHandlerContext lastContext = pipeline.lastContext(); assert lastContext.handler().getClass() == HttpSessionHandler.class; pipeline.addBefore(lastContext.name(), null, handler); }
@Override protected void channelRead0(ChannelHandlerContext ctx, HttpMessage msg) throws Exception { // If this handler is hit then no upgrade has been attempted and the client is just talking HTTP. // "Directly talking: " + msg.protocolVersion() + " (no upgrade was attempted)"); ChannelPipeline pipeline = ctx.pipeline(); ChannelHandlerContext thisCtx = pipeline.context(this); pipeline.addAfter(thisCtx.name(), null, new JerseyServerHandler(baseUri, container)); pipeline.replace(this, null, new ChunkedWriteHandler()); ctx.fireChannelRead(msg); } });