Class MultiFormRequestHelper

java.lang.Object
backtraceio.library.common.MultiFormRequestHelper

public class MultiFormRequestHelper extends Object
Helper class for building multipart/form-data request
  • Constructor Details

    • MultiFormRequestHelper

      public MultiFormRequestHelper()
  • Method Details

    • getContentType

      public static String getContentType()
      Get Content-Type of request
      Returns:
      string with content type and information about boundary
    • addEndOfRequest

      public static void addEndOfRequest(OutputStream outputStream) throws IOException
      Write to output data stream string which ending the request
      Parameters:
      outputStream - output data stream
      Throws:
      IOException
    • addJson

      public static void addJson(OutputStream outputStream, String json) throws IOException
      Write JSON string to output data steam
      Parameters:
      outputStream - output data stream
      json - JSON string with BacktraceData object
      Throws:
      IOException
    • addFiles

      public static void addFiles(OutputStream outputStream, List<String> attachments) throws IOException
      Write files data to outputStream
      Parameters:
      outputStream - output data stream
      attachments - list of paths to files
      Throws:
      IOException
    • streamFile

      public static void streamFile(OutputStream outputStream, String absolutePath) throws IOException
      Write file content to output data stream
      Parameters:
      outputStream - output data stream
      absolutePath - absolute path to file
      Throws:
      IOException