Class RFC2231

java.lang.Object
org.nuxeo.common.utils.RFC2231

public class RFC2231 extends Object
RFC-2231 specifies how a MIME parameter value, like Content-Disposition's filename, can be encoded to contain arbitrary character sets.
Author:
Florent Guillaume
  • Method Details

    • percentEscape

      @Deprecated(since="2025.18", forRemoval=true) public static void percentEscape(StringBuilder sb, String value)
      Deprecated, for removal: This API element is subject to removal in a future version.
      since 2025.18, not used anymore
    • encodeRFC2231

      protected static void encodeRFC2231(StringBuilder sb, String value)
      Encodes a value per RFC 2231, percent-encoding all non-attr-char bytes of the UTF-8 representation.
      Parameters:
      sb - the buffer to append the encoded value to
      value - the value to encode
    • encodeContentDisposition

      public static String encodeContentDisposition(String filename, boolean inline)
      Encodes a Content-Disposition header following RFC 6266 best practice. When encoding is needed, both filename (raw fallback) and filename* (RFC 2231 encoded) parameters are included.
      Parameters:
      filename - the filename
      inline - true for an inline disposition, false for an attachment
      Returns:
      a full string to set as value of a Content-Disposition header
      Since:
      2025.18
    • encodeContentDisposition

      @Deprecated(since="2025.18", forRemoval=true) public static String encodeContentDisposition(String filename, boolean inline, String userAgent)
      Deprecated, for removal: This API element is subject to removal in a future version.