Class HttpRequestBody

    • Field Detail

      • charSet

        private java.nio.charset.Charset charSet
    • Constructor Detail

      • HttpRequestBody

        public HttpRequestBody​(Config config,
                               HttpMethod method,
                               java.lang.String url)
    • Method Detail

      • field

        public MultipartBody field​(java.lang.String name,
                                   java.util.Collection<?> value)
        Description copied from interface: HttpRequestWithBody
        Sets multiple field params on the body each with the same name.
        Specified by:
        field in interface HttpRequestWithBody
        Parameters:
        name - the name of the field
        value - a Collection of values
        Returns:
        this request builder
      • field

        public MultipartBody field​(java.lang.String name,
                                   java.io.File file)
        Description copied from interface: HttpRequestWithBody
        Sets a File on the body.
        Specified by:
        field in interface HttpRequestWithBody
        Parameters:
        name - the name of the file field
        file - the file
        Returns:
        this request builder
      • field

        public MultipartBody field​(java.lang.String name,
                                   java.io.File file,
                                   java.lang.String contentType)
        Description copied from interface: HttpRequestWithBody
        Sets a File on the body with a specified content-type.
        Specified by:
        field in interface HttpRequestWithBody
        Parameters:
        name - the name of the file field
        file - the file
        contentType - contentType (i.e. image/png)
        Returns:
        this request builder
      • field

        public MultipartBody field​(java.lang.String name,
                                   java.lang.Object value)
        Description copied from interface: HttpRequestWithBody
        Sets a field param on the body.
        Specified by:
        field in interface HttpRequestWithBody
        Parameters:
        name - the name of the field
        value - a values
        Returns:
        this request builder
      • field

        public MultipartBody field​(java.lang.String name,
                                   java.lang.Object value,
                                   java.lang.String contentType)
        Description copied from interface: HttpRequestWithBody
        Sets a field param on the body with a specified content-type.
        Specified by:
        field in interface HttpRequestWithBody
        Parameters:
        name - the name of the field
        value - the object
        contentType - contentType (i.e. application/xml)
        Returns:
        this request builder
      • fields

        public MultipartBody fields​(java.util.Map<java.lang.String,​java.lang.Object> parameters)
        Description copied from interface: HttpRequestWithBody
        Sets multiple field params on the body from a map of key/value pairs.
        Specified by:
        fields in interface HttpRequestWithBody
        Parameters:
        parameters - the map of field params
        Returns:
        this request builder
      • field

        public MultipartBody field​(java.lang.String name,
                                   java.io.InputStream stream,
                                   ContentType contentType,
                                   java.lang.String fileName)
        Description copied from interface: HttpRequestWithBody
        Sets a File on the body from a raw InputStream requires a specified content-type and file name.
        Specified by:
        field in interface HttpRequestWithBody
        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
      • field

        public MultipartBody field​(java.lang.String name,
                                   java.io.InputStream stream,
                                   java.lang.String fileName)
        Description copied from interface: HttpRequestWithBody
        Sets a File on the body from a raw InputStream requires a file name.
        Specified by:
        field in interface HttpRequestWithBody
        Parameters:
        name - the name of the file field
        stream - the inputStream
        fileName - the name for the file
        Returns:
        this request builder
      • charset

        public HttpRequestBody charset​(java.nio.charset.Charset charset)
        Description copied from interface: HttpRequestWithBody
        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
        Specified by:
        charset in interface HttpRequestWithBody
        Parameters:
        charset - the charset
        Returns:
        this request builder
      • body

        public RequestBodyEntity body​(java.lang.Object body)
        Description copied from interface: HttpRequestWithBody
        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
        Specified by:
        body in interface HttpRequestWithBody
        Parameters:
        body - the Object
        Returns:
        this request builder