コード例 #1
0
  @Override
  public boolean content(ByteBuffer buffer) {
    if (updateState(State.RECEIVE, State.RECEIVE)) {
      HttpExchange exchange = connection.getExchange();
      // The exchange may be null if it failed concurrently
      if (exchange != null) {
        HttpConversation conversation = exchange.getConversation();
        HttpResponse response = exchange.getResponse();
        LOG.debug("Content {}: {} bytes", response, buffer.remaining());

        ContentDecoder decoder = this.decoder;
        if (decoder != null) {
          buffer = decoder.decode(buffer);
          LOG.debug("{} {}: {} bytes", decoder, response, buffer.remaining());
        }

        ResponseNotifier notifier = connection.getDestination().getResponseNotifier();
        notifier.notifyContent(conversation.getResponseListeners(), response, buffer);
      }
    }
    return false;
  }
コード例 #2
0
 @Override
 public int read(final ByteBuffer dst) throws IOException {
   return decoder.read(dst);
 }