Class WebFormPart

java.lang.Object
io.fluxzero.sdk.web.WebFormPart

public final class WebFormPart extends Object
Represents a single multipart/form-data part.

Text fields and file uploads are exposed through the same type. Use isFile() to distinguish file parts, asString() for text content, and getContent() or getInputStream() for raw bytes.

  • Constructor Details

  • Method Details

    • getName

      public String getName()
      Returns the form field name associated with this part.
    • getFileName

      public String getFileName()
      Returns the uploaded file name, or null for a part without a file name.
    • getContentType

      public String getContentType()
      Returns the part's content type, if supplied.
    • getHeaders

      public Map<String, List<String>> getHeaders()
      Returns the part's headers grouped by name.
    • getHeaders

      public List<String> getHeaders(String name)
      Returns all values for a header, or an empty list if absent.
    • getHeader

      public Optional<String> getHeader(String name)
      Returns the first value of a header, or an empty optional if absent.
    • getContent

      public byte[] getContent()
      Returns a defensive copy of the part's content bytes.
    • getInputStream

      public InputStream getInputStream()
      Returns a new input stream over the part's content, with an independent read position.
    • isFile

      public boolean isFile()
      Returns whether this part carries a file name, including an empty file name.
    • asString

      public String asString()
      Decodes the content using the charset in the Content-Type header, defaulting to UTF-8 when that charset is absent or unsupported.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object