Class MultipartProcessor

java.lang.Object
au.id.villar.web.mfd.MultipartProcessor

public final class MultipartProcessor extends Object
Utility class to read a multipart body from and HTTP request.
  • Method Details

    • process

      public static void process(String boundary, InputStream input, MultipartProcessorListener listener) throws IOException
      Runs the process of reading multipart body. For each part in the multipart request, the provided listener will be called.
      Parameters:
      boundary - The boundary field as specified in the Content-Type header.
      input - The InputStream representing the http body.
      listener - The MultipartProcessorListener to be invoked on each part.
      Throws:
      IOException - If the provided InputStream throws this exception, or if it is detected that the body is not actually multipart type.
    • extractBoundary

      public static String extractBoundary(String contentTypeValue)
      Extracts the boundary value from a Content-Type value.
      Parameters:
      contentTypeValue - the value of a content-type header, of type multipart.
      Returns:
      The boundary value, or null if it was not found