public void send(@NotNull final FastCgiRequest fastCgiRequest, @NotNull ByteBuf content) {
    final ByteBuf notEmptyContent;
    if (content.isReadable()) {
      content.retain();
      notEmptyContent = content;
      notEmptyContent.touch();
    } else {
      notEmptyContent = null;
    }

    try {
      if (processHandler.has()) {
        fastCgiRequest.writeToServerChannel(notEmptyContent, processChannel);
      } else {
        processHandler
            .get()
            .done(
                new Consumer<OSProcessHandler>() {
                  @Override
                  public void consume(OSProcessHandler osProcessHandler) {
                    fastCgiRequest.writeToServerChannel(notEmptyContent, processChannel);
                  }
                })
            .rejected(
                new Consumer<Throwable>() {
                  @Override
                  public void consume(Throwable error) {
                    LOG.error(error);
                    handleError(fastCgiRequest, notEmptyContent);
                  }
                });
      }
    } catch (Throwable e) {
      LOG.error(e);
      handleError(fastCgiRequest, notEmptyContent);
    }
  }
Пример #2
0
 @Override
 public FullHttpMessage touch() {
   content.touch();
   return this;
 }
Пример #3
0
 @Override
 public FullHttpMessage touch(Object hint) {
   content.touch(hint);
   return this;
 }