Class ContentDisposition

java.lang.Object
com.linecorp.armeria.common.ContentDisposition

public final class ContentDisposition extends Object
Representation of the Content-Disposition type and parameters as defined in RFC 6266.
See Also:
  • Method Details

    • builder

      public static ContentDispositionBuilder builder(String type)
      Returns a new ContentDispositionBuilder with the specified type.
      Parameters:
      type - the disposition type like for example inline, attachment, or form-data
    • of

      public static ContentDisposition of(String type)
      Returns a new ContentDisposition with the specified type.
      Parameters:
      type - the disposition type like for example inline, attachment, or form-data
    • of

      public static ContentDisposition of(String type, String name)
      Returns a new ContentDisposition with the specified type and name.
      Parameters:
      type - the disposition type like for example inline, attachment, or form-data
      name - the name parameter
    • of

      public static ContentDisposition of(String type, String name, String filename)
      Returns a new ContentDisposition with the specified type, name and filename.
      Parameters:
      type - the disposition type like for example inline, attachment, or form-data
      name - the name parameter
      filename - the filename parameter that will be formatted as quoted-string, as defined in RFC 2616, section 2.2, and any quote characters within the filename value will be escaped with a backslash, e.g. "foo\"bar.txt" becomes "foo\\\"bar.txt"
    • of

      public static ContentDisposition of()
      Returns an empty ContentDisposition.
    • parse

      public static ContentDisposition parse(String contentDisposition)
      Parses a "content-disposition" header value as defined in RFC 2183.

      Note that only the US-ASCII, UTF-8 and ISO-8859-1 charsets are supported. If other charsets are specified, ISO-8859-1 will be used instead.

      Parameters:
      contentDisposition - the "content-disposition" header value
      Returns:
      the parsed content disposition
      See Also:
    • type

      public String type()
      Returns the disposition type, like for example inline, attachment, form-data.
    • name

      @Nullable public @Nullable String name()
      Returns the value of the name parameter, or null if not defined.
    • filename

      @Nullable public @Nullable String filename()
      Returns the value of the filename parameter (or the value of the filename* one decoded as defined in the RFC 5987), or null if not defined.
    • charset

      @Nullable public @Nullable Charset charset()
      Returns the charset defined in filename* parameter, or null if not defined.
    • equals

      public boolean equals(@Nullable @Nullable Object other)
      Overrides:
      equals in class Object
    • hashCode

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

      public String asHeaderValue()
      Returns the header value for this content disposition as defined in RFC 6266.
      See Also:
    • toString

      public String toString()
      Returns the header value for this content disposition as defined in RFC 6266.
      Overrides:
      toString in class Object