Class TransportRequest

java.lang.Object
codes.grow.packages.skywalking.core.TransportRequest

public final class TransportRequest extends Object
One logical HTTP call executed by HttpTransport (with retries). Immutable.
  • Method Details

    • builder

      public static TransportRequest.Builder builder(String method, String path)
      Starts a request.
      Parameters:
      method - HTTP method
      path - path relative to the base URL (leading slash optional)
      Returns:
      a new builder
    • get

      public static TransportRequest.Builder get(String path)
      Starts a GET request.
      Parameters:
      path - path relative to the base URL
      Returns:
      a new builder
    • post

      public static TransportRequest.Builder post(String path)
      Starts a POST request.
      Parameters:
      path - path relative to the base URL
      Returns:
      a new builder
    • put

      public static TransportRequest.Builder put(String path)
      Starts a PUT request.
      Parameters:
      path - path relative to the base URL
      Returns:
      a new builder
    • delete

      public static TransportRequest.Builder delete(String path)
      Starts a DELETE request.
      Parameters:
      path - path relative to the base URL
      Returns:
      a new builder
    • method

      public String method()
      Returns the HTTP method.
      Returns:
      upper-case method
    • path

      public String path()
      Returns the path.
      Returns:
      the path
    • query

      public Map<String,List<String>> query()
      Returns the query parameters in insertion order.
      Returns:
      immutable map
    • headers

      public Map<String,String> headers()
      Returns the request headers.
      Returns:
      immutable map
    • body

      public Optional<byte[]> body()
      Returns a copy of the body.
      Returns:
      the body, or empty
    • contentType

      public Optional<String> contentType()
      Returns the body content type.
      Returns:
      the content type, or empty
    • idempotent

      public boolean idempotent()
      Returns whether the request may be replayed after an uncertain send.
      Returns:
      explicit flag, or true for GET, HEAD, OPTIONS, PUT and DELETE
    • operation

      public String operation()
      Returns the operation name used in error messages.
      Returns:
      e.g. kv.read secret/app, or <METHOD> <path>
    • accepts

      public boolean accepts(int status)
      Returns whether a non-2xx status is returned to the caller instead of raising an error.
      Parameters:
      status - HTTP status
      Returns:
      true when accepted
    • maxRetries

      public Optional<Integer> maxRetries()
      Returns the retry limit override.
      Returns:
      retries, or empty for the policy default
    • timeout

      public Optional<Duration> timeout()
      Returns the per-attempt timeout override.
      Returns:
      timeout, or empty for the config default