Interface SdkHttpRequest

All Superinterfaces:
SdkHttpHeaders, ToCopyableBuilder<SdkHttpRequest.Builder,SdkHttpRequest>
All Known Subinterfaces:
SdkHttpFullRequest

An immutable HTTP request without access to the request body. SdkHttpFullRequest should be used when access to a request body stream is required.
  • Method Details

    • builder

      static SdkHttpRequest.Builder builder()
      Returns:
      Builder instance to construct a DefaultSdkHttpFullRequest.
    • protocol

      String protocol()
      Returns the protocol that should be used for HTTP communication.

      This will always be "https" or "http" (lowercase).

      Returns:
      Either "http" or "https" depending on which protocol should be used.
    • host

      String host()
      Returns the host that should be communicated with.

      This will never be null.

      Returns:
      The host to which the request should be sent.
    • port

      int port()
      The port that should be used for HTTP communication. If this was not configured when the request was created, it will be derived from the protocol. For "http" it would be 80, and for "https" it would be 443.

      Important Note: AWS signing DOES NOT include the port when the request is signed if the default port for the protocol is being used. When sending requests via http over port 80 or via https over port 443, the URI or host header MUST NOT include the port or a signature error will be raised from the service for signed requests. HTTP plugin implementers are encouraged to use the getUri() method for generating the URI to use for communicating with AWS to ensure the URI used in the request matches the URI used during signing.

      Returns:
      The port that should be used for HTTP communication.
    • encodedPath

      String encodedPath()
      Returns the URL-encoded path that should be used in the HTTP request.

      If a path is configured, the path will always start with '/' and may or may not end with '/', depending on what the service might expect. If a path is not configured, this will always return empty-string (ie. ""). Note that '/' is also a valid path.

      Returns:
      The path to the resource being requested.
    • rawQueryParameters

      Map<String,List<String>> rawQueryParameters()
      Returns a map of all non-URL encoded parameters in this request. HTTP plugins can use SdkHttpUtils.encodeQueryParameters(Map) to encode parameters into map-form, or SdkHttpUtils.encodeAndFlattenQueryParameters(Map) to encode the parameters into uri-formatted string form.

      This will never be null. If there are no parameters an empty map is returned.

      Returns:
      An unmodifiable map of all non-encoded parameters in this request.
    • firstMatchingRawQueryParameter

      default Optional<String> firstMatchingRawQueryParameter(String key)
    • firstMatchingRawQueryParameter

      default Optional<String> firstMatchingRawQueryParameter(Collection<String> keys)
    • firstMatchingRawQueryParameters

      default List<String> firstMatchingRawQueryParameters(String key)
    • forEachRawQueryParameter

      default void forEachRawQueryParameter(BiConsumer<? super String,? super List<String>> consumer)
    • numRawQueryParameters

      default int numRawQueryParameters()
    • encodedQueryParameters

      default Optional<String> encodedQueryParameters()
    • encodedQueryParametersAsFormData

      default Optional<String> encodedQueryParametersAsFormData()
    • getUri

      default URI getUri()
      Convert this HTTP request's protocol, host, port, path and query string into a properly-encoded URI string that matches the URI string used for AWS request signing.

      The URI's port will be missing (-1) when the port() is the default port for the protocol(). (80 for http and 443 for https). This is to reflect the fact that request signature does not include the port.

      Returns:
      The URI for this request, formatted in the same way the AWS HTTP request signer uses the URI in the signature.
    • method

      SdkHttpMethod method()
      Returns the HTTP method (GET, POST, etc) to use when sending this request.

      This will never be null.

      Returns:
      The HTTP method to use when sending this request.