Package org.jboss.netty.buffer

Examples of org.jboss.netty.buffer.ChannelBuffer


      {
        // Default to HTTP_ERROR
        HttpResponse response = (HttpResponse) event.getMessage();
        if(response.getStatus().equals(HttpResponseStatus.OK))
        {
          ChannelBuffer content = response.getContent();
          _pendingEventHeader = response.getHeader(DatabusHttpHeaders.DATABUS_PENDING_EVENT_SIZE);
        }
        else
        {
          LOG.error("Got Http status (" + response.getStatus() + ") from remote address :" + ctx.getChannel().getRemoteAddress());
View Full Code Here


  @Override
  public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception
  {
    if (e.getMessage() instanceof ChannelBuffer)
    {
      ChannelBuffer buf = (ChannelBuffer)e.getMessage();
      _buffer.writeBytes(buf);
    }

    super.messageReceived(ctx, e);
  }
View Full Code Here

  public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception
  {
    Object msgObj = e.getMessage();
    if (msgObj instanceof ChannelBuffer)
    {
      ChannelBuffer msgBuffer = (ChannelBuffer)msgObj;
      _msg = new String(msgBuffer.array());
    }
    super.messageReceived(ctx, e);
  }
View Full Code Here

    @Override
    public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception
    {
      if (e.getMessage() instanceof ChannelBuffer)
      {
        ChannelBuffer buf = (ChannelBuffer)e.getMessage();
        _buffer.writeBytes(buf);
      }

      super.messageReceived(ctx, e);
    }
View Full Code Here

  }

  @Override
  public void sendDownstreamAsBinary(ChannelHandlerContext ctx, ChannelFuture future)
  {
    ChannelBuffer buffer = toBinaryChannelBuffer();
    ctx.sendDownstream(new DownstreamMessageEvent(ctx.getChannel(), future, buffer,
                                                  ctx.getChannel().getRemoteAddress()));
  }
View Full Code Here

  }

  @Override
  public ChannelFuture writeToChannelAsBinary(Channel channel)
  {
    ChannelBuffer buffer = toBinaryChannelBuffer();
    return channel.write(buffer);
  }
View Full Code Here

  @Override
  public void writeToChannelAsBinary(ChannelHandlerContext ctx, ChannelFuture future)
  {
    ChannelFuture realFuture = (null != future) ? future : Channels.future(ctx.getChannel());

    ChannelBuffer serializedResponse = serializeToBinary();
    DownstreamMessageEvent e = new DownstreamMessageEvent(ctx.getChannel(), realFuture,
                                                          serializedResponse,
                                                          ctx.getChannel().getRemoteAddress());
    ctx.sendDownstream(e);
  }
View Full Code Here

    TestAbstractQueue queue = new TestAbstractQueue();
    TestConnectionStateMessage stateMsg = new TestConnectionStateMessage();
    HttpResponse httpResponse = new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK);
    StreamHttpResponseProcessor  processor =
        new StreamHttpResponseProcessor(null, queue, stateMsg, null);
    ChannelBuffer buf = HeapChannelBufferFactory.getInstance().getBuffer(100);
    HttpChunk httpChunk = new DefaultHttpChunk(buf);
    HttpChunkTrailer httpChunkTrailer = new DefaultHttpChunkTrailer();

    processor.startResponse(httpResponse);
    processor.addChunk(httpChunk);
View Full Code Here

    TestAbstractQueue queue = new TestAbstractQueue();
    TestConnectionStateMessage stateMsg = new TestConnectionStateMessage();
    HttpResponse httpResponse = new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK);
    StreamHttpResponseProcessor  processor =
        new StreamHttpResponseProcessor(null, queue, stateMsg, null);
    ChannelBuffer buf = HeapChannelBufferFactory.getInstance().getBuffer(100);
    HttpChunk httpChunk = new DefaultHttpChunk(buf);
    HttpChunkTrailer httpChunkTrailer = new DefaultHttpChunkTrailer();

    processor.channelException(new Exception("dummy exception"));
    processor.startResponse(httpResponse);
View Full Code Here

    TestAbstractQueue queue = new TestAbstractQueue();
    TestConnectionStateMessage stateMsg = new TestConnectionStateMessage();
    HttpResponse httpResponse = new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK);
    StreamHttpResponseProcessor  processor =
        new StreamHttpResponseProcessor(null, queue, stateMsg, null);
    ChannelBuffer buf = HeapChannelBufferFactory.getInstance().getBuffer(100);
    HttpChunk httpChunk = new DefaultHttpChunk(buf);
    HttpChunkTrailer httpChunkTrailer = new DefaultHttpChunkTrailer();

    processor.startResponse(httpResponse);
    processor.channelException(new Exception("dummy exception"));
View Full Code Here

TOP

Related Classes of org.jboss.netty.buffer.ChannelBuffer

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.