Package io.netty.handler.codec.http

Examples of io.netty.handler.codec.http.HttpServerCodec


        pipeline.remove(this);
    }

    private void switchToHttp(ChannelHandlerContext ctx) {
        ChannelPipeline pipeline = ctx.pipeline();
        pipeline.addLast(HttpServerCodec.class.getSimpleName(), new HttpServerCodec());
        pipeline.addLast(HttpProxyHandler.class.getSimpleName(), new HttpProxyHandler(logFilter, null, new InetSocketAddress(port), sslEnabled));
        pipeline.remove(this);
    }
View Full Code Here


            protected void initChannel(SocketChannel ch) throws Exception {
                // Create a default pipeline implementation.
                ChannelPipeline pipeline = ch.pipeline();

                // add HTTP decoder and encoder
                pipeline.addLast(HttpServerCodec.class.getSimpleName(), new HttpServerCodec());
                pipeline.addLast(HttpObjectAggregator.class.getSimpleName(), new HttpObjectAggregator(Integer.MAX_VALUE));

                // add handlers
                pipeline.addLast(HttpProxyHandler.class.getSimpleName(), new HttpProxyHandler(logFilter, HttpProxy.this, securePort != null ? new InetSocketAddress(securePort) : null, false));
            }
View Full Code Here

                SSLEngine engine = SSLFactory.getInstance().sslContext().createSSLEngine();
                engine.setUseClientMode(false);
                pipeline.addLast(SslHandler.class.getSimpleName(), new SslHandler(engine));

                // add HTTP decoder and encoder
                pipeline.addLast(HttpServerCodec.class.getSimpleName(), new HttpServerCodec());
                pipeline.addLast(HttpObjectAggregator.class.getSimpleName(), new HttpObjectAggregator(Integer.MAX_VALUE));

                // add handlers
                pipeline.addLast(HttpProxyHandler.class.getSimpleName(), new HttpProxyHandler(logFilter, HttpProxy.this, securePort != null ? new InetSocketAddress(securePort) : null, true));
            }
View Full Code Here

                                @Override
                                public void initChannel(SocketChannel ch) throws Exception {
                                    ChannelPipeline pipeline = ch.pipeline();

                                    pipeline.addLast("logger", new LoggingHandler("TEST_SERVER"));
                                    pipeline.addLast("codec", new HttpServerCodec());
                                    pipeline.addLast("chunk-aggregator", new HttpObjectAggregator(10 * 1024 * 1024));
                                    pipeline.addLast("handler", new TestServerHandler());
                                }
                            })
                            .bind(port).addListener(new ChannelFutureListener() {
                                @Override
                                public void operationComplete(ChannelFuture future) throws Exception {
                                    if (future.isSuccess()) {
                                        hasBoundToHTTPPort.set("CONNECTED");
                                    } else {
                                        hasBoundToHTTPPort.setException(future.cause());
                                    }
                                }
                            });

                    logger.debug("STARTING SERVER FOR HTTPS ON PORT: " + securePort);
                    ChannelFuture channelFutureHTTPS = new ServerBootstrap()
                            .option(ChannelOption.SO_BACKLOG, 1024)
                            .group(bossGroup, workerGroup)
                            .channel(NioServerSocketChannel.class)
                            .childHandler(new ChannelInitializer<SocketChannel>() {
                                @Override
                                public void initChannel(SocketChannel ch) throws Exception {
                                    ChannelPipeline pipeline = ch.pipeline();

                                    pipeline.addLast("raw logger", new LoggingHandler("RAW TEST_SERVER_SSL"));
                                    SSLEngine engine = SSLFactory.getInstance().sslContext().createSSLEngine();
                                    engine.setUseClientMode(false);
                                    pipeline.addLast("ssl", new SslHandler(engine));
                                    pipeline.addLast("logger", new LoggingHandler("TEST_SERVER_SSL"));
                                    pipeline.addLast("codec", new HttpServerCodec());
                                    pipeline.addLast("chunk-aggregator", new HttpObjectAggregator(10 * 1024 * 1024));
                                    pipeline.addLast("handler", new TestServerHandler());
                                }
                            })
                            .bind(securePort).addListener(new ChannelFutureListener() {
View Full Code Here

        if (logger.isDebugEnabled()) {
            pipeline.addLast("logger", new LoggingHandler());
        }

        // add msg <-> HTTP
        pipeline.addLast("decoder-encoder", new HttpServerCodec());
        pipeline.addLast("chunk-aggregator", new HttpObjectAggregator(Integer.MAX_VALUE));

        // add mock server handlers
        pipeline.addLast("handler", new MockServerHandler(mockServerMatcher, logFilter, mockServer, secure));
    }
View Full Code Here

    @Override
    public void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();

        pipeline.addLast("codec-http", new HttpServerCodec());

        ServerHandler handler = new ServerHandler();
        handler.setEnvironment(serverEnvironment);

        pipeline.addLast("handler", handler);
View Full Code Here

        @Override
        public void initChannel(SocketChannel ch) throws Exception {
            ChannelPipeline pipeline = ch.pipeline();
            pipeline.addLast(sslCtx.newHandler(ch.alloc()));
            pipeline.addLast(new HttpServerCodec());
            pipeline.addLast(new EchoServerHandler());
        }
View Full Code Here

    @Override
    public void configure(final ChannelPipeline pipeline) {
        if (logger.isDebugEnabled())
            pipeline.addLast(new LoggingHandler("log-io", LogLevel.DEBUG));

        pipeline.addLast("http-server", new HttpServerCodec());

        if (logger.isDebugEnabled())
            pipeline.addLast(new LoggingHandler("http-io", LogLevel.DEBUG));

        pipeline.addLast(new HttpObjectAggregator(1048576));
View Full Code Here

                protected void initChannel(Channel ch) throws Exception {
                  if (useSecureWebSocket) {
                    final SslHandler sslHandler = SslHandlerFactory.buildSslHandler(esc);
                    ch.pipeline().addLast("ssl", sslHandler);
                  }
                  ch.pipeline().addLast("codec-http", new HttpServerCodec());
                  ch.pipeline().addLast("aggregator", new HttpObjectAggregator(65536));
                  ch.pipeline().addLast("handler", webSocketHandler);
                }

              }).bind(port).sync();
View Full Code Here

    @Override
    public void configureNewPipeline(ChannelPipeline pipeline) {
        WebSocketServerHandshakerFactory handshakeHandlerFactory = new WebSocketServerHandshakerFactory(
                webSocketURI, subprotocols, allowExtensions, maxFramePayloadLength);

        pipeline.addLast(new HttpServerCodec());
        pipeline.addLast(new HttpObjectAggregator(65536));
        pipeline.addLast(new WebSocketServerHandler(
                handshakeHandlerFactory, maxFramePayloadLength, messageAggregator, eventsSubject));
    }
View Full Code Here

TOP

Related Classes of io.netty.handler.codec.http.HttpServerCodec

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.