Package org.jboss.netty.buffer

Examples of org.jboss.netty.buffer.ChannelBuffer.toByteBuffer()


    ChannelBuffer buffer = this.getBuffer();
    // Write the response.
    channel.write(buffer);
    if (ConnectionLogger.isEnabledFull()) {
      ConnectionLogger.logWriteBuffer(this.getClass().getSimpleName(), ((InetSocketAddress) this.channel.getRemoteAddress())
          .getHostName(), ((InetSocketAddress) this.channel.getRemoteAddress()).getPort(), buffer.toByteBuffer().array(),
          0, buffer.toByteBuffer().array().length);
    }
  }
}
View Full Code Here


    // Write the response.
    channel.write(buffer);
    if (ConnectionLogger.isEnabledFull()) {
      ConnectionLogger.logWriteBuffer(this.getClass().getSimpleName(), ((InetSocketAddress) this.channel.getRemoteAddress())
          .getHostName(), ((InetSocketAddress) this.channel.getRemoteAddress()).getPort(), buffer.toByteBuffer().array(),
          0, buffer.toByteBuffer().array().length);
    }
  }
}
View Full Code Here

    httpResponse.setHeader(HttpHeaders.Names.CONTENT_LENGTH, String.valueOf(buffer.readableBytes()));
    // Write the response.
    channel.write(httpResponse);
    if (ConnectionLogger.isEnabledFull()) {
      ConnectionLogger.logWriteBuffer(this.getClass().getSimpleName(), ((InetSocketAddress) this.channel.getRemoteAddress())
          .getHostName(), ((InetSocketAddress) this.channel.getRemoteAddress()).getPort(), buffer.toByteBuffer().array(),
          0, buffer.toByteBuffer().array().length);
    }
  }
}
View Full Code Here

    // Write the response.
    channel.write(httpResponse);
    if (ConnectionLogger.isEnabledFull()) {
      ConnectionLogger.logWriteBuffer(this.getClass().getSimpleName(), ((InetSocketAddress) this.channel.getRemoteAddress())
          .getHostName(), ((InetSocketAddress) this.channel.getRemoteAddress()).getPort(), buffer.toByteBuffer().array(),
          0, buffer.toByteBuffer().array().length);
    }
  }
}
View Full Code Here

        }

        // Otherwise, all messages are encrypted.
        ChannelBuffer msg = (ChannelBuffer) e.getMessage();
        PendingWrite pendingWrite =
            new PendingWrite(evt.getFuture(), msg.toByteBuffer(msg.readerIndex(), msg.readableBytes()));
        synchronized (pendingUnencryptedWrites) {
            boolean offered = pendingUnencryptedWrites.offer(pendingWrite);
            assert offered;
        }
View Full Code Here

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

        Response response = handler.onLine(session, buf.toByteBuffer());
        if (response != null) {
            // TODO: This kind of sucks but I was not able to come up with something more elegant here
            ((ProtocolSessionImpl)session).getProtocolTransport().writeResponse(response, session);
        }
    }
View Full Code Here

       
            ChannelBuffer buf = (ChannelBuffer) e.getMessage();     
           
            LineHandler lHandler=  (LineHandler) lineHandlers.getLast();
            long start = System.currentTimeMillis();           
            Response response = lHandler.onLine(pSession,buf.toByteBuffer());
            long executionTime = System.currentTimeMillis() - start;

            for (int i = 0; i < resultHandlers.size(); i++) {
                // Disable till PROTOCOLS-37 is implemented
                if (response instanceof FutureResponse) {
View Full Code Here

        }

        // Otherwise, all messages are encrypted.
        ChannelBuffer msg = (ChannelBuffer) e.getMessage();
        PendingWrite pendingWrite =
            new PendingWrite(evt.getFuture(), msg.toByteBuffer(msg.readerIndex(), msg.readableBytes()));
        synchronized (pendingUnencryptedWrites) {
            pendingUnencryptedWrites.offer(pendingWrite);
        }

        wrap(context, evt.getChannel());
View Full Code Here

        }

        // Otherwise, all messages are encrypted.
        ChannelBuffer msg = (ChannelBuffer) e.getMessage();
        PendingWrite pendingWrite =
            new PendingWrite(evt.getFuture(), msg.toByteBuffer(msg.readerIndex(), msg.readableBytes()));
        synchronized (pendingUnencryptedWrites) {
            pendingUnencryptedWrites.offer(pendingWrite);
        }

        wrap(context, evt.getChannel());
View Full Code Here

        // Otherwise, all messages are encrypted.
        ChannelBuffer msg = (ChannelBuffer) e.getMessage();
        PendingWrite pendingWrite;

        if (msg.readable()) {
            pendingWrite = new PendingWrite(evt.getFuture(), msg.toByteBuffer(msg.readerIndex(), msg.readableBytes()));
        } else {
            pendingWrite = new PendingWrite(evt.getFuture(), null);
        }

        pendingUnencryptedWritesLock.lock();
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.