Class ContentDisposition

java.lang.Object
org.springframework.http.ContentDisposition

public final class ContentDisposition extends Object
Representation of the Content-Disposition type and parameters as defined in RFC 6266.
Since:
5.0
Author:
Sebastien Deleuze, Juergen Hoeller, Rossen Stoyanchev, Sergey Tsypanov
See Also:
  • Method Details

    • isAttachment

      public boolean isAttachment()
      Return whether the type is "attachment".
      Since:
      5.3
    • isFormData

      public boolean isFormData()
      Return whether the type is "form-data".
      Since:
      5.3
    • isInline

      public boolean isInline()
      Return whether the type is "inline".
      Since:
      5.3
    • getType

      public @Nullable String getType()
      Return the disposition type.
      See Also:
    • getName

      public @Nullable String getName()
      Return the value of the name parameter, or null if not defined.
    • getFilename

      public @Nullable String getFilename()
      Return the value of the filename parameter, possibly decoded from BASE64 encoding based on RFC 2047, or of the filename* parameter, possibly decoded as defined in the RFC 5987.
    • getCharset

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

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

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

      public String toString()
      Return the header value for this content disposition as defined in RFC 6266.
      Overrides:
      toString in class Object
      See Also:
    • attachment

      public static ContentDisposition.Builder attachment()
      Return a builder for a ContentDisposition of type "attachment".
      Since:
      5.3
    • formData

      public static ContentDisposition.Builder formData()
      Return a builder for a ContentDisposition of type "form-data".
      Since:
      5.3
    • inline

      public static ContentDisposition.Builder inline()
      Return a builder for a ContentDisposition of type "inline".
      Since:
      5.3
    • builder

      public static ContentDisposition.Builder builder(String type)
      Return a builder for a ContentDisposition.
      Parameters:
      type - the disposition type like for example inline, attachment, or form-data
      Returns:
      the builder
    • empty

      public static ContentDisposition empty()
      Return an empty content disposition.
    • parse

      public static ContentDisposition parse(String contentDisposition)
      Parse a Content-Disposition header value as defined in RFC 2183.
      Parameters:
      contentDisposition - the Content-Disposition header value
      Returns:
      the parsed content disposition
      See Also: