Module org.htmlunit

Class ContentDispositionParser

java.lang.Object
org.htmlunit.http.ContentDispositionParser

public final class ContentDispositionParser extends Object
Parser for the Content-Disposition header.
  • RFC 6266 (HTTP) and RFC 2183 (disposition type and parameters)
  • RFC 8187 extended parameters (filename*=UTF-8''...); supported charsets are UTF-8 and ISO-8859-1

The parser is lenient like the browsers are: parameter names are case-insensitive, white space around names and values is ignored, an unterminated quoted string ends at the end of the header. An extended value with a broken percent encoding is ignored (like Firefox does), so the plain parameter can be used as fallback.

Author:
Ronald Brill
  • Method Details

    • parse

      public static ContentDisposition parse(String header)
      Parses the value of a Content-Disposition header.
      Parameters:
      header - the header value
      Returns:
      the parsed header or null if the given value is null