Package org.jboss.netty.channel

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


  }

  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

    _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

  }

  @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

        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

        }
      }

      void onConnected()
      {
        ChannelPipeline channelPipeline = _channel.getPipeline();
        _readTimeOutHandler = (ExtendedReadTimeoutHandler)channelPipeline.get(GenericHttpClientPipelineFactory.READ_TIMEOUT_HANDLER_NAME);
        _readTimeOutHandler.start(channelPipeline.getContext(_readTimeOutHandler));

        TestHttpResponseProcessor testResponseProcessor =
            new TestHttpResponseProcessor(_msgList,_readTimeOutHandler);

            String uriString = "/test";
View Full Code Here

    {
      @Override
      public ChannelPipeline getPipeline() throws Exception
      {
        // Create a default pipeline implementation.
        ChannelPipeline pipeline = new DefaultChannelPipeline();
        pipeline.addLast("decoder", new HttpRequestDecoder());
        pipeline.addLast("encoder", new HttpResponseEncoder());
        pipeline.addLast("deflater", new HttpContentCompressor());
        pipeline.addLast("handler", new HttpRequestHandler());
        return pipeline;
      }
View Full Code Here

  void onTargetScnConnectSuccess()
  {
    _curState = State.TARGET_SCN_REQUEST_WRITE;

    ChannelPipeline channelPipeline = _channel.getPipeline();
    _readTimeOutHandler = (ExtendedReadTimeoutHandler)channelPipeline.get(GenericHttpClientPipelineFactory.READ_TIMEOUT_HANDLER_NAME);
    _readTimeOutHandler.start(channelPipeline.getContext(_readTimeOutHandler));

    BootstrapTargetScnHttpResponseProcessor targetResponseProcessor =
        new BootstrapTargetScnHttpResponseProcessor(this, _callback, _callbackStateReuse,
                                                    _checkpoint,
                                                    _remoteExceptionHandler, _readTimeOutHandler);
View Full Code Here

  void onStartScnConnectSuccess()
  {
    _curState = State.START_SCN_REQUEST_WRITE;

    ChannelPipeline channelPipeline = _channel.getPipeline();
    _readTimeOutHandler = (ExtendedReadTimeoutHandler)channelPipeline.get(GenericHttpClientPipelineFactory.READ_TIMEOUT_HANDLER_NAME);
    _readTimeOutHandler.start(channelPipeline.getContext(_readTimeOutHandler));

    BootstrapStartScnHttpResponseProcessor sourcesResponseProcessor =
        new BootstrapStartScnHttpResponseProcessor(this, _callback, _callbackStateReuse,
                                                   _checkpoint,
                                                   _remoteExceptionHandler,
View Full Code Here

  void onStreamConnectSuccess()
  {
    _curState = State.STREAM_REQUEST_WRITE;

    ChannelPipeline channelPipeline = _channel.getPipeline();
    _readTimeOutHandler = (ExtendedReadTimeoutHandler)channelPipeline.get(GenericHttpClientPipelineFactory.READ_TIMEOUT_HANDLER_NAME);
    _readTimeOutHandler.start(channelPipeline.getContext(_readTimeOutHandler));

    StreamHttpResponseProcessor streamResponseProcessor =
        new StreamHttpResponseProcessor(this, _callback, _callbackStateReuse, _readTimeOutHandler);

    StringBuilder uriString = new StringBuilder(10240);
View Full Code Here

TOP

Related Classes of org.jboss.netty.channel.ChannelPipeline

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.