All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.pincette.netty.http.RequestHandler Maven / Gradle / Ivy

The newest version!
package net.pincette.netty.http;

import io.netty.buffer.ByteBuf;
import io.netty.handler.codec.http.HttpRequest;
import io.netty.handler.codec.http.HttpResponse;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.Flow.Publisher;

/**
 * The interface for handling requests.
 *
 * @author Werner Donné
 * @since 1.0
 */
@FunctionalInterface
public interface RequestHandler {
  /**
   * An implementation should return a publisher for the response body. It should not block.
   *
   * @param request the request received from the server.
   * @param requestBody the publisher through which request body chunks are emitted. The buffers are
   *     released as soon as the onNext method of the subscriber returns. If you still
   *     need them later, you have to make a copy.
   * @param response the response the server will send back.
   * @return The publisher through which the response body chunks are emitted. If the publisher is
   *     null then nothing is emitted.
   * @since 1.0
   */
  CompletionStage> apply(
      HttpRequest request, Publisher requestBody, HttpResponse response);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy