Package org.springframework.http

# 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:
  - RFC 6266

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static interface`
`ContentDisposition.Builder`
A mutable builder for `ContentDisposition`.

## Method Summary

Modifier and Type
Method
Description
`static ContentDisposition.Builder`
`attachment()`
Return a builder for a `ContentDisposition` of type "attachment".
`static ContentDisposition.Builder`
`builder(String type)`
Return a builder for a `ContentDisposition`.
`static ContentDisposition`
`empty()`
Return an empty content disposition.
`boolean`
`equals(Object other)`
`static ContentDisposition.Builder`
`formData()`
Return a builder for a `ContentDisposition` of type "form-data".
`Charset`
`getCharset()`
Return the charset defined in filename* parameter, or `null` if not defined.
`ZonedDateTime`
`getCreationDate()`
Deprecated.
since 5.2.3 as per RFC 6266, Appendix B, to be removed in a future release.
`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.
`ZonedDateTime`
`getModificationDate()`
Deprecated.
since 5.2.3 as per RFC 6266, Appendix B, to be removed in a future release.
`String`
`getName()`
Return the value of the name parameter, or `null` if not defined.
`ZonedDateTime`
`getReadDate()`
Deprecated.
since 5.2.3 as per RFC 6266, Appendix B, to be removed in a future release.
`Long`
`getSize()`
Deprecated.
since 5.2.3 as per RFC 6266, Appendix B, to be removed in a future release.
`String`
`getType()`
Return the disposition type.
`int`
`hashCode()`
`static ContentDisposition.Builder`
`inline()`
Return a builder for a `ContentDisposition` of type "inline".
`boolean`
`isAttachment()`
Return whether the `type` is "attachment".
`boolean`
`isFormData()`
Return whether the `type` is "form-data".
`boolean`
`isInline()`
Return whether the `type` is "inline".
`static ContentDisposition`
`parse(String contentDisposition)`
Parse a Content-Disposition header value as defined in RFC 2183.
`String`
`toString()`
Return the header value for this content disposition as defined in RFC 6266.

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

## 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

@Nullable public String getType()
Return the disposition type.

See Also:
  - `isAttachment()`
  - `isFormData()`
  - `isInline()`

### getName

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

### getFilename

@Nullable public 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

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

### getSize

@Deprecated @Nullable public Long getSize()
Deprecated.
since 5.2.3 as per RFC 6266, Appendix B, to be removed in a future release.
Return the value of the size parameter, or `null` if not defined.

### getCreationDate

@Deprecated @Nullable public ZonedDateTime getCreationDate()
Deprecated.
since 5.2.3 as per RFC 6266, Appendix B, to be removed in a future release.
Return the value of the creation-date parameter, or `null` if not defined.

### getModificationDate

@Deprecated @Nullable public ZonedDateTime getModificationDate()
Deprecated.
since 5.2.3 as per RFC 6266, Appendix B, to be removed in a future release.
Return the value of the modification-date parameter, or `null` if not defined.

### getReadDate

@Deprecated @Nullable public ZonedDateTime getReadDate()
Deprecated.
since 5.2.3 as per RFC 6266, Appendix B, to be removed in a future release.
Return the value of the read-date 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:
  - `parse(String)`

### 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:
  - `toString()`