Interface FormHttpRequest.Builder

All Superinterfaces:
HttpWebRequest.Builder<FormHttpRequest.Builder>
Enclosing interface:
FormHttpRequest

public static interface FormHttpRequest.Builder extends HttpWebRequest.Builder<FormHttpRequest.Builder>
Builds a FormHttpRequest.
  • Method Details

    • withBodyParam

      FormHttpRequest.Builder withBodyParam(String name, String value)
      Specifies a body parameter. Header defaults to Content-Type: application/x-www-form-urlencoded; charset=utf-8. If header is set to Content-Type: text/plain; charset=utf-8, body param name-value pairs will be encoded. Otherwise, if body encoding is not expected, use withBody(String).
      Parameters:
      name - body param name. Cannot be null or empty.
      value - body param value. Cannot be null.
      Returns:
      this Builder
    • withBody

      Specifies request body as a string. Header defaults to Content-Type: application/x-www-form-urlencoded; charset=utf-8.
      Parameters:
      body - request body. Cannot be null.
      Returns:
      this Builder
    • withBody

      Specifies request body as CSV as returned by CsvData.asString(). Header defaults to Content-Type: text/csv; charset=utf-8.
      Parameters:
      body - request body. Cannot be null.
      Returns:
      this Builder
    • withBody

      Specifies request body as JSON as returned by JsonObject.asString(). Header defaults to Content-Type: application/json; charset=utf-8.
      Parameters:
      body - request body. Cannot be null.
      Returns:
      this Builder
    • withBody

      Specifies request body as JSON as returned by JsonArray.asString(). Header defaults to Content-Type: application/json; charset=utf-8.
      Parameters:
      body - request body. Cannot be null.
      Returns:
      this Builder
    • withBody

      <U extends UserDefinedModel> FormHttpRequest.Builder withBody(U body)
      Specifies request body as the serialized form of the provided UserDefinedModel. To specify a specific content type to serialize the body to, set the Content-Type header (see withContentType(HttpRequestContentType)).

      Note: This method will fail if the Content-Type header has been set to a value that is not supported by UserDefinedModel.

      Header defaults to Content-Type: application/json; charset=utf-8.
      Type Parameters:
      U - type of UserDefinedModel
      Parameters:
      body - request body. Cannot be null.
      Returns:
      this Builder
    • withBody

      <U extends UserDefinedModel> FormHttpRequest.Builder withBody(Collection<U> body)
      Specifies request body as the serialized form of the provided UserDefinedModels. To specify a specific content type to serialize the body to, set the Content-Type header (see withContentType(HttpRequestContentType)).

      Note: This method will fail if the Content-Type header has been set to a value that is not supported by UserDefinedModel.

      Header defaults to Content-Type: application/json; charset=utf-8.
      Type Parameters:
      U - type of UserDefinedModel
      Parameters:
      body - request body. Cannot be null.
      Returns:
      this Builder
    • withContentType

      FormHttpRequest.Builder withContentType(HttpRequestContentType contentType)
      Specifies the Content-Type header for this HTTP request. Calling this method is effectively the same as calling HttpWebRequest.Builder.withHeader(String, String) and passing in "Content-Type" as the header, for example:

      withHeader("Content-Type","application/json")

      Parameters:
      contentType - the content type to serialize this request's body as. Cannot be null.
      Returns:
      this Builder
    • build

      Retrieves the completed FormHttpRequest.
      Returns:
      the completed FormHttpRequest