Class MultipartParser

java.lang.Object
com.pixelservices.flash.components.MultipartParser

public class MultipartParser extends Object
MultipartParser parses HTTP multipart/form-data payloads into fields and files.

Note: This is a simplified implementation and may not handle all edge cases or binary data correctly.

  • Constructor Details

    • MultipartParser

      public MultipartParser(String contentType, String body)
      Constructs a MultipartParser to parse the given content type and body.
      Parameters:
      contentType - the Content-Type header, expected to be "multipart/form-data".
      body - the raw HTTP body to parse.
      Throws:
      IllegalArgumentException - if the Content-Type is invalid or boundary is missing.
  • Method Details

    • getFile

      public MultipartParser.MultipartFile getFile(String fieldName)
      Retrieves a file by field name.
      Parameters:
      fieldName - the name of the field.
      Returns:
      the MultipartFile associated with the field, or null if not found.
    • getField

      public String getField(String fieldName)
      Retrieves a field value by name.
      Parameters:
      fieldName - the name of the field.
      Returns:
      the field value, or null if not found.