Examples of ChannelPipeline


Examples of org.jboss.netty.channel.ChannelPipeline

  }

  @Override
  public ChannelPipeline getPipeline() throws Exception
  {
    ChannelPipeline result = super.getPipeline();;

    result.addBefore(ExceptionListenerTestHandler.class.getSimpleName(),
                     ExtendedWriteTimeoutHandler.class.getSimpleName(),
                    new ExtendedWriteTimeoutHandler("client write timeout", null, 100, true));
    result.addFirst(SleepingDownstreamHandler.class.getName(),
                    new SleepingDownstreamHandler(_defaultSleep));

    return result;
  }
View Full Code Here

Examples of org.jboss.netty.channel.ChannelPipeline

     * @throws IllegalStateException
     *         if {@link #setPipelineFactory(ChannelPipelineFactory)} was
     *         called by a user last time.
     */
    public ChannelPipeline getPipeline() {
        ChannelPipeline pipeline = this.pipeline;
        if (pipeline == null) {
            throw new IllegalStateException("pipelineFactory in use");
        }
        return pipeline;
    }
View Full Code Here

Examples of org.jboss.netty.channel.ChannelPipeline

     * @throws IllegalStateException
     *         if {@link #setPipelineFactory(ChannelPipelineFactory)} is in
     *         use to create a new pipeline
     */
    public Map<String, ChannelHandler> getPipelineAsMap() {
        ChannelPipeline pipeline = this.pipeline;
        if (pipeline == null) {
            throw new IllegalStateException("pipelineFactory in use");
        }
        return pipeline.toMap();
    }
View Full Code Here

Examples of org.jboss.netty.channel.ChannelPipeline

                    "pipelineMap is not an ordered map. " +
                    "Please use " +
                    LinkedHashMap.class.getName() + ".");
        }

        ChannelPipeline pipeline = pipeline();
        for(Map.Entry<String, ChannelHandler> e: pipelineMap.entrySet()) {
            pipeline.addLast(e.getKey(), e.getValue());
        }

        setPipeline(pipeline);
    }
View Full Code Here

Examples of org.jboss.netty.channel.ChannelPipeline

     * Retrieve the channel pipeline factory.
     *
     * @see org.jboss.netty.channel.ChannelPipelineFactory#getPipeline()
     */
    public ChannelPipeline getPipeline() {
        final ChannelPipeline pipeline = pipeline();

        if (config.sslContext() != null) {
            SSLEngine e = config.sslContext().createSSLEngine();
            config.sslContextListener().onPostCreate(e);
            pipeline.addLast("ssl", new SslHandler(e));
        }

        pipeline.addLast("decoder", new HttpRequestDecoder());

        if (config.aggregateRequestBodyInMemory()) {
            pipeline.addLast("aggregator", new HttpChunkAggregator(config.maxChunkContentLength()));
        }

        pipeline.addLast("encoder", new HttpResponseEncoder());

        if (config.supportChunking()) {
            pipeline.addLast("chunkedWriter", new ChunkedWriteHandler());
        }

        for (ChannelUpstreamHandler h: config.channelUpstreamHandlers()) {
            pipeline.addLast(h.getClass().getName(), h);
        }

        pipeline.addLast(BridgeRuntime.class.getName(), bridgeRuntime);

        return pipeline;
    }
View Full Code Here

Examples of org.jboss.netty.channel.ChannelPipeline

    private final Timer timer = new HashedWheelTimer();

    public ChannelPipeline getPipeline() throws Exception {
        // Create a default pipeline implementation.
        ChannelPipeline pipeline = pipeline();
        pipeline.addLast("timeout", new ReadTimeoutHandler(timer, 30));
        pipeline.addLast("decoder", new FlashPolicyServerDecoder());
        pipeline.addLast("handler", new FlashPolicyServerHandler());
        return pipeline;
    }
View Full Code Here

Examples of org.jboss.netty.channel.ChannelPipeline

  }

  private void setupServer(DummyHttpRequestHandler requestHandler)
  {
    _serverBootstrap = new ServerBootstrap(new DefaultLocalServerChannelFactory());
    ChannelPipeline serverPipeline = pipeline();
    serverPipeline.addLast("server logger 1", new LoggingHandler("server logger 1", InternalLogLevel.DEBUG, true));
    serverPipeline.addLast("decoder", new HttpRequestDecoder());
    serverPipeline.addLast("encoder", new HttpResponseEncoder());
    serverPipeline.addLast("server loggger 5", new LoggingHandler("server logger 5", InternalLogLevel.DEBUG, true));
    serverPipeline.addLast("handler", requestHandler);
    _serverBootstrap.setPipeline(serverPipeline);

    _serverAddress = new LocalAddress(1);
    _serverChannel = _serverBootstrap.bind(_serverAddress);
  }
View Full Code Here

Examples of org.jboss.netty.channel.ChannelPipeline

    _clientBootstrap.setPipelineFactory(new ChannelPipelineFactory()
    {
      @Override
      public ChannelPipeline getPipeline() throws Exception
      {
        ChannelPipeline clientPipeline = pipeline();

        clientPipeline.addLast("client logger 1", new LoggingHandler("client logger 1", InternalLogLevel.DEBUG, true));
        clientPipeline.addLast("codec", new HttpClientCodec());
        clientPipeline.addLast("aggregator", new FooterAwareHttpChunkAggregator(1000000));
        _responseHandler = new SimpleHttpResponseHandler();
        clientPipeline.addLast("handler", _responseHandler);
        clientPipeline.addLast("client logger 5", new LoggingHandler("client logger 5", InternalLogLevel.DEBUG, true));
        return clientPipeline;
      }
    });
  }
View Full Code Here

Examples of org.jboss.netty.channel.ChannelPipeline

  }

  @Override
  public ChannelPipeline getPipeline() throws Exception {
      // Create a default pipeline implementation.
      ChannelPipeline pipeline = pipeline();


      if (_channelGroup != null)
        pipeline.addLast("auto group register ",
                         new ConnectionChannelRegistrationHandler(_channelGroup));

      if (Logger.getRootLogger().isTraceEnabled())
      {
        LOG.debug("Adding Netty tracing");
        pipeline.addLast("netty client traffic",
                         new LoggingHandler("netty client traffic", InternalLogLevel.DEBUG, true));
      }

      if (null != _containerStatsCollector)
      {
        pipeline.addLast("inbound statistics collector",
                         new InboundContainerStatisticsCollectingHandler(
                             _containerStatsCollector));
      }


      ExtendedReadTimeoutHandler readTimeoutHandler =
          new ExtendedReadTimeoutHandler("client call ",
                                         _timeoutTimer,
                                         _readTimeoutMs,
                                         true);
      pipeline.addLast(READ_TIMEOUT_HANDLER_NAME, readTimeoutHandler);

      pipeline.addLast("codec", new HttpClientCodec());
      pipeline.addLast("http logger", new HttpRequestLoggingHandler());

      // Remove the following line if you don't want automatic content decompression.
      pipeline.addLast("inflater", new HttpContentDecompressor());

      //pipeline.addLast("handler", new GenericHttpResponseHandler(_responseProcessor, _keepAlive));
      pipeline.addLast("handler", _handler);

      //add a handler to deal with write timeouts
      pipeline.addLast("client request write timeout handler",
                       new ExtendedWriteTimeoutHandler("netty client traffic",
                                                       _timeoutTimer,
                                                       _writeTimeoutMs,
                                                       true));
      return pipeline;
View Full Code Here

Examples of org.jboss.netty.channel.ChannelPipeline

        CallCompletion getPipelineCompletion = nettyStats.isEnabled() ?
            nettyStats.getPipelineFactory_GetPipelineCallTracker().startCall() :
            null;*/

        // Create a default pipeline implementation.
        ChannelPipeline pipeline = pipeline();

        //pipeline.addLast("in traffic",
        //                 new LoggingHandler("in traffic", InternalLogLevel.INFO, true));

        pipeline.addLast("auto group register ",
                         new ConnectionChannelRegistrationHandler(_serverContainer.getHttpChannelGroup()));

        if (Logger.getRootLogger().isTraceEnabled())
        {
          pipeline.addLast("netty server traffic",
                           new LoggingHandler("netty server traffic", InternalLogLevel.DEBUG, true));
        }

        pipeline.addLast("outbound statistics collector",
                         new OutboundContainerStatisticsCollectingHandler(
                             _serverContainer.getContainerStatsCollector()));

        pipeline.addLast("decoder", new HttpRequestDecoder());
        pipeline.addLast("encoder", new HttpResponseEncoder());
        pipeline.addLast("http logger", new HttpRequestLoggingHandler());

        ExtendedReadTimeoutHandler readTimeoutHandler =
            new ExtendedReadTimeoutHandler("server container " + _serverContainer.getContainerStaticConfig().getId(),
                                           _serverContainer.getNetworkTimeoutTimer(),
                                           _serverContainer.getContainerStaticConfig().getReadTimeoutMs(),
                                           true);

        HttpRequestHandler reqHandler = new HttpRequestHandler(_serverContainer, readTimeoutHandler);
        pipeline.addLast("handler", reqHandler);

        if (_serverContainer.getContainerStaticConfig().getEnableHttpCompression())
        {
          pipeline.addLast("deflater", new HttpContentCompressor());
        }
        pipeline.addLast("executionHandler", _serverContainer.getNettyExecHandler());

        DatabusRequestExecutionHandler dbusRequestHandler =
            new DatabusRequestExecutionHandler(_serverContainer);
        pipeline.addLast("databusRequestRunner", dbusRequestHandler);

        //add a handler to deal with write timeouts
        pipeline.addLast("server container write timeout handler",
                         new ExtendedWriteTimeoutHandler("server container " + _serverContainer.getContainerStaticConfig().getId(),
                                                         _serverContainer.getNetworkTimeoutTimer(),
                                                         _serverContainer.getContainerStaticConfig().getWriteTimeoutMs(),
                                                         true));

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.