Class MultiPart

java.lang.Object
org.eclipse.jetty.http.MultiPart

public class MultiPart extends Object

Namespace class for interrelated classes that provide support for parsing and generating multipart bytes.

Most applications should make use of MultiPartFormData or MultiPartByteRanges as they provide a simpler API.

Multipart parsing is provided by MultiPart.Parser.

Multipart generation is provided by MultiPart.AbstractContentSource and its subclasses.

A single part of a multipart content is represented by MultiPart.Part and its subclasses.

See Also:
  • Method Details

    • extractBoundary

      public static String extractBoundary(String contentType)

      Extracts the value of the boundary parameter from the Content-Type header value, or returns null if the boundary parameter is missing.

      Parameters:
      contentType - the Content-Type header value
      Returns:
      the value of the boundary parameter, or null if the boundary parameter is missing
    • generateBoundary

      public static String generateBoundary(String prefix, int randomLength)

      Generates a multipart boundary, made of the given optional prefix string and the given number of random characters.

      The total length of the boundary will be trimmed to at most 70 characters, as specified in RFC 2046.

      Parameters:
      prefix - a possibly null prefix
      randomLength - a number of random characters to add after the prefix
      Returns:
      a boundary string