Class HttpPipeline

java.lang.Object
com.azure.core.http.HttpPipeline

public final class HttpPipeline extends Object

The HTTP pipeline through which HTTP requests and responses flow.

This class encapsulates the HTTP pipeline that applies a set of HttpPipelinePolicies to the request before it is sent and on the response as it is being returned.

It provides methods to get the policy at a specific index in the pipeline, get the count of policies in the pipeline, get the associated HttpClient, and send the HTTP request through the pipeline.

This class is useful when you want to send an HTTP request and apply a set of policies to the request and response.

See Also:
  • Method Details

    • getPolicy

      public HttpPipelinePolicy getPolicy(int index)
      Get the policy at the passed index in the pipeline.
      Parameters:
      index - index of the policy to retrieve.
      Returns:
      the policy stored at that index.
    • getPolicyCount

      public int getPolicyCount()
      Get the count of policies in the pipeline.
      Returns:
      count of policies.
    • getHttpClient

      public HttpClient getHttpClient()
      Get the HttpClient associated with the pipeline.
      Returns:
      the HttpClient associated with the pipeline
    • getTracer

      public Tracer getTracer()
      Get the Tracer associated with the pipeline.
      Returns:
      the Tracer associated with the pipeline
    • send

      public Mono<HttpResponse> send(HttpRequest request)
      Wraps the request in a context and sends it through pipeline.
      Parameters:
      request - The HTTP request to send.
      Returns:
      A publisher upon subscription flows the context through policies, sends the request, and emits response upon completion.
    • send

      public Mono<HttpResponse> send(HttpRequest request, Context data)
      Wraps the request in a context with additional metadata and sends it through the pipeline.
      Parameters:
      request - THe HTTP request to send.
      data - Additional metadata to pass along with the request.
      Returns:
      A publisher upon subscription flows the context through policies, sends the request, and emits response upon completion.
    • send

      public Mono<HttpResponse> send(HttpPipelineCallContext context)
      Sends the context (containing an HTTP request) through pipeline.
      Parameters:
      context - The request context.
      Returns:
      A publisher upon subscription flows the context through policies, sends the request and emits response upon completion.
    • sendSync

      public HttpResponse sendSync(HttpRequest request, Context data)
      Wraps the request in a context with additional metadata and sends it through the pipeline.
      Parameters:
      request - THe HTTP request to send.
      data - Additional metadata to pass along with the request.
      Returns:
      A publisher upon subscription flows the context through policies, sends the request, and emits response upon completion.