Interface HttpRequestWithBody

All Superinterfaces:
HttpRequest<HttpRequestWithBody>
All Known Implementing Classes:
HttpRequestBody

public interface HttpRequestWithBody extends HttpRequest<HttpRequestWithBody>
A request Builder for POST and PUT operations with a body. will switch to a MultipartBody once http form variables are introduced. or to a RequestBodyEntity
  • Method Details

    • multiPartContent

      MultipartBody multiPartContent()
      Forces the request to send as multipart even if all params are simple
      Returns:
      The same MultipartBody
    • field

      MultipartBody field(String name, Object value)
      Sets a field param on the body.
      Parameters:
      name - the name of the field
      value - a values
      Returns:
      this request builder
    • field

      MultipartBody field(String name, Collection<?> value)
      Sets multiple field params on the body each with the same name.
      Parameters:
      name - the name of the field
      value - a Collection of values
      Returns:
      this request builder
    • field

      MultipartBody field(String name, Object value, String contentType)
      Sets a field param on the body with a specified content-type.
      Parameters:
      name - the name of the field
      value - the object
      contentType - contentType (i.e. application/xml)
      Returns:
      this request builder
    • fields

      MultipartBody fields(Map<String,Object> parameters)
      Sets multiple field params on the body from a map of key/value pairs.
      Parameters:
      parameters - the map of field params
      Returns:
      this request builder
    • field

      MultipartBody field(String name, File file)
      Sets a File on the body.
      Parameters:
      name - the name of the file field
      file - the file
      Returns:
      this request builder
    • field

      MultipartBody field(String name, File file, String contentType)
      Sets a File on the body with a specified content-type.
      Parameters:
      name - the name of the file field
      file - the file
      contentType - contentType (i.e. image/png)
      Returns:
      this request builder
    • field

      MultipartBody field(String name, InputStream stream, String fileName)
      Sets a File on the body from a raw InputStream requires a file name.
      Parameters:
      name - the name of the file field
      stream - the inputStream
      fileName - the name for the file
      Returns:
      this request builder
    • field

      MultipartBody field(String name, InputStream stream, ContentType contentType, String fileName)
      Sets a File on the body from a raw InputStream requires a specified content-type and file name.
      Parameters:
      name - the name of the file field
      stream - the inputStream
      contentType - contentType (i.e. image/png)
      fileName - the name for the file
      Returns:
      this request builder
    • charset

      HttpRequestWithBody charset(Charset charset)
      Set the Charset encoding for the Content-Type. This is appended to the Content-Type Header (e.g. application/x-www-form-urlencoded; charset=US-ASCII) Default is UTF-8
      Parameters:
      charset - the charset
      Returns:
      this request builder
    • noCharset

      default HttpRequestWithBody noCharset()
      Removes any Charset for the Content-Type for when servers cannot process it. (e.g. application/x-www-form-urlencoded)
      Returns:
      this request builder
    • body

      Set a String as the body of the request
      Parameters:
      body - the String
      Returns:
      this request builder
    • body

      Set a InputStream as the body
      Parameters:
      body - the Object
      Returns:
      this request builder
    • body

      Set a Object as the body of the request. This will be serialized with one of the following methods: - Strings are native - JSONElements use their native toString - Everything else will pass through the supplied ObjectMapper
      Parameters:
      body - the Object
      Returns:
      this request builder
    • body

      RequestBodyEntity body(byte[] body)
      Set a byte array as the body of the request
      Parameters:
      body - the byte[]
      Returns:
      this request builder
    • body

      Set JSON on the body
      Parameters:
      body - the JsonNode
      Returns:
      this request builder
    • body

      Set JSON on the body
      Parameters:
      body - the JSONElement
      Returns:
      this request builder
    • getCharset

      Charset getCharset()
      get the current default charset
      Returns:
      the Charset
    • contentType

      default HttpRequestWithBody contentType(ContentType type)
      Parameters:
      type - The content mime type
      Returns:
      this request builder
    • contentType

      HttpRequestWithBody contentType(String type)
      Parameters:
      type - The content mime type
      Returns:
      this request builder