Class Request.Builder

java.lang.Object
com.inrupt.client.Request.Builder
Enclosing class:
Request

public static final class Request.Builder extends Object
A Request builder.
  • Method Details

    • uri

      public Request.Builder uri(URI uri)
      Set the URI for this request.
      Parameters:
      uri - the request URI
      Returns:
      this builder
    • header

      public Request.Builder header(String name, String value)
      Set an individual header for this request.
      Parameters:
      name - the header name
      value - the header value
      Returns:
      this builder
    • setHeader

      public Request.Builder setHeader(String name, String value)
      Set an individual header for this request.

      This method will remove all existing headers defined for the provided name

      Parameters:
      name - the header name
      value - the header value
      Returns:
      this builder
    • method

      public Request.Builder method(String method, Request.BodyPublisher publisher)
      Set the HTTP method for this request.
      Parameters:
      method - the HTTP request method
      publisher - the body publisher
      Returns:
      this builder
    • timeout

      public Request.Builder timeout(Duration timeout)
      Set a timeout value for this request.
      Parameters:
      timeout - the timeout value
      Returns:
      this builder
    • type

      public Request.Builder type(String type)
      A convenience method for setting a Content-Type header.
      Parameters:
      type - the content-type
      Returns:
      this builder
    • GET

      public Request.Builder GET()
      A convenience method for building an HTTP GET request.
      Returns:
      this builder
    • POST

      public Request.Builder POST(Request.BodyPublisher publisher)
      A convenience method for building an HTTP POST request with a body.
      Parameters:
      publisher - the body publisher
      Returns:
      this builder
    • PUT

      public Request.Builder PUT(Request.BodyPublisher publisher)
      A convenience method for building an HTTP PUT request with a body.
      Parameters:
      publisher - the body publisher
      Returns:
      this builder
    • PATCH

      public Request.Builder PATCH(Request.BodyPublisher publisher)
      A convenience method for building an HTTP PATCH request with a body.
      Parameters:
      publisher - the body publisher
      Returns:
      this builder
    • HEAD

      public Request.Builder HEAD()
      A convenience method for building an HTTP HEAD request.
      Returns:
      this builder
    • DELETE

      public Request.Builder DELETE()
      A convenience method for building an HTTP DELETE request.
      Returns:
      this builder
    • build

      public Request build()
      Build the Request.
      Returns:
      the request