Class HttpServer.Part

java.lang.Object
com.codename1.backend.HttpServer.Part
Enclosing class:
HttpServer

public static final class HttpServer.Part extends Object
One part of a multipart/form-data request body: a form field, or an uploaded file when it has a filename.
  • Method Details

    • getName

      public String getName()
      The field name from its Content-Disposition, or null.
    • getFilename

      public String getFilename()
      The uploaded file's name as the client gave it, or null for a plain field. Never use it as a path: it is whatever the client sent.
    • getContentType

      public String getContentType()
      The part's Content-Type, or null when it declared none.
    • getHeader

      public String getHeader(String headerName)
      One of the part's own headers, by a name in any case; or null.
    • getSize

      public int getSize()
      The part's content length in bytes.
    • getBytes

      public byte[] getBytes()
      The part's content. The array is the part's; copy it to change it.
    • getText

      public String getText()
      The part's content as UTF-8 text. Throws IllegalStateException when it is not valid UTF-8 -- a binary upload -- rather than returning replacement characters the client never sent.