Class Request.RequestBuilder

java.lang.Object
com.akamai.edgegrid.signer.Request.RequestBuilder
Enclosing class:
Request

public static class Request.RequestBuilder extends Object
Creates an instance of Request.builder(). The returned builder is equivalent to the builder generated by Request.builder().
  • Constructor Details

    • RequestBuilder

      public RequestBuilder()
  • Method Details

    • body

      public Request.RequestBuilder body(byte[] requestBody)
      Sets a content of HTTP request body. If not set, body is empty by default.
      Parameters:
      requestBody - a request body, in bytes
      Returns:
      reference back to this builder instance
    • header

      public Request.RequestBuilder header(String headerName, String value)

      Adds a single header for an HTTP request. This can be called multiple times to add as many headers as needed.

      NOTE: All header names are lower-cased for storage. In HTTP, header names are case-insensitive anyway, and EdgeGrid does not support multiple headers with the same name. Forcing to lowercase here improves our chance of detecting bad requests early.

      Parameters:
      headerName - a header name
      value - a header value
      Returns:
      reference back to this builder instance
      Throws:
      IllegalArgumentException - if a duplicate header name is encountered
    • headers

      public Request.RequestBuilder headers(Map<String,String> headers)

      Sets headers of HTTP request. The headers parameter is copied so that changes to the original Map will not impact the stored reference.

      NOTE: All header names are lower-cased for storage. In HTTP, header names are case-insensitive anyway, and EdgeGrid does not support multiple headers with the same name. Forcing to lowercase here improves our chance of detecting bad requests early.

      Parameters:
      headers - a Map of headers
      Returns:
      reference back to this builder instance
      Throws:
      IllegalArgumentException - if a duplicate header name is encountered
    • method

      public Request.RequestBuilder method(String method)
      Sets HTTP method: GET, PUT, POST, DELETE. Mandatory to set.
      Parameters:
      method - an HTTP method
      Returns:
      reference back to this builder instance
    • uri

      public Request.RequestBuilder uri(String uri)

      Sets the URI of the HTTP request. This URI MUST have the correct path and query segments set. Scheme is assumed to be "HTTPS" for the purpose of this library. Host is actually taken from a ClientCredential as signing time; any value in this URI is discarded. Fragments are not signed.

      A path and/or query string is required.

      Parameters:
      uri - a URI
      Returns:
      reference back to this builder instance
    • uri

      public Request.RequestBuilder uri(URI uri)

      Sets the URI of the HTTP request. This URI MUST have the correct path and query segments set. Scheme is assumed to be "HTTPS" for the purpose of this library. Host is actually taken from a ClientCredential as signing time; any value in this URI is discarded. Fragments are not signed.

      A path and/or query string is required.

      Parameters:
      uri - a URI
      Returns:
      reference back to this builder instance
    • build

      public Request build()
      Returns a newly-created immutable HTTP request.
      Returns:
      new HTTP request Request