Class Multipart


  • public class Multipart
    extends Request<Multipart>
    Sets up a Multipart request to send multiple text fields as well as upload files.
    Author:
    Igor Polevoy on 5/1/16.
    • Constructor Detail

      • Multipart

        public Multipart​(String url,
                         int connectTimeout,
                         int readTimeout)
        Constructor to make multipart requests
        Parameters:
        url - URL to send request to
        connectTimeout - connection timeout
        readTimeout - read timeout
    • Method Detail

      • field

        public Multipart field​(FormField field)
        Adds a form field to the request
        Parameters:
        field - instance of form field
        Returns:
        self
      • field

        public Multipart field​(String name,
                               String value)
        Convenience method to add a form field to the request.
        Parameters:
        name - name of field
        value - value of field
        Returns:
        self
      • fields

        public Multipart fields​(String... namesAndValues)
        Convenience method to add multiple fields to the request. Names and values alternate: name1, value1, name2, value2, etc.
        Parameters:
        namesAndValues - names/values of multiple fields to be added to the request.
        Returns:
        self
      • file

        public Multipart file​(String fieldName,
                              String filePath)
        Convenience method to add a file fields to the request.
        Parameters:
        fieldName - name of field
        filePath - fully qualified path to a file.
        Returns:
        self.
      • main

        public static void main​(String[] args)