Class ContentDisposition

java.lang.Object
io.helidon.http.ContentDisposition
All Implemented Interfaces:
Value<String>, Header

public class ContentDisposition extends Object implements Header
A generic representation of the Content-Disposition header.

Parameter encoding is not supported, other than URI percent encoding in the filename parameter. See URLDecoder.

See also:
  • Method Details

    • builder

      public static ContentDisposition.Builder builder()
      A new builder to set up content disposition.
      Returns:
      builder
    • parse

      public static ContentDisposition parse(String headerValue)
      Parse a received header value.
      Parameters:
      headerValue - content disposition header value
      Returns:
      a parsed content disposition
    • empty

      public static ContentDisposition empty()
      An empty content disposition.
      Returns:
      empty disposition with empty type
    • name

      public String name()
      Description copied from interface: Header
      Name of the header as configured by user or as received on the wire.
      Specified by:
      name in interface Header
      Specified by:
      name in interface Value<String>
      Returns:
      header name, always lower case for HTTP/2 headers
    • headerName

      public HeaderName headerName()
      Description copied from interface: Header
      Header name for the header.
      Specified by:
      headerName in interface Header
      Returns:
      header name
    • get

      public String get()
      Description copied from interface: Value
      Typed value.
      Specified by:
      get in interface Value<String>
      Returns:
      direct value
    • as

      public <N> Value<N> as(Class<N> type) throws MapperException
      Description copied from interface: Value
      Convert this value to a different type using a mapper.
      Specified by:
      as in interface Value<String>
      Type Parameters:
      N - type we expect
      Parameters:
      type - type to convert to
      Returns:
      converted value
      Throws:
      MapperException - in case the value cannot be converted
    • as

      public <N> Value<N> as(GenericType<N> type) throws MapperException
      Description copied from interface: Value
      Convert this value to a different type using a mapper.
      Specified by:
      as in interface Value<String>
      Type Parameters:
      N - type we expect
      Parameters:
      type - type to convert to
      Returns:
      converted value
      Throws:
      MapperException
    • as

      public <N> Value<N> as(Function<? super String,? extends N> mapper)
      Description copied from interface: Value
      Convert this Value to a different type using a mapper function.
      Specified by:
      as in interface Value<String>
      Type Parameters:
      N - type of the returned Value
      Parameters:
      mapper - mapper to map the type of this Value to a type of the returned Value
      Returns:
      a new value with the new type
    • asOptional

      public Optional<String> asOptional() throws MapperException
      Description copied from interface: Value
      Typed value as Optional. Returns a empty if this value does not have a backing value present. As this class implements all methods of Optional, this is only a utility method if an actual Optional instance is needed (Optional itself is {code final}).
      Specified by:
      asOptional in interface Value<String>
      Returns:
      value as Optional, empty in case the value does not have a direct value
      Throws:
      MapperException - in case the value cannot be converted to the expected type
      See Also:
    • asBoolean

      public Value<Boolean> asBoolean()
      Description copied from interface: Value
      Boolean typed value.
      Specified by:
      asBoolean in interface Value<String>
      Returns:
      typed value
    • asString

      public Value<String> asString()
      Description copied from interface: Value
      String typed value.
      Specified by:
      asString in interface Value<String>
      Returns:
      typed value
    • asInt

      public Value<Integer> asInt()
      Description copied from interface: Value
      Integer typed value.
      Specified by:
      asInt in interface Value<String>
      Returns:
      typed value
    • asLong

      public Value<Long> asLong()
      Description copied from interface: Value
      Long typed value.
      Specified by:
      asLong in interface Value<String>
      Returns:
      typed value
    • asDouble

      public Value<Double> asDouble()
      Description copied from interface: Value
      Double typed value.
      Specified by:
      asDouble in interface Value<String>
      Returns:
      typed value
    • allValues

      public List<String> allValues()
      Description copied from interface: Header
      All values of this header.
      Specified by:
      allValues in interface Header
      Returns:
      all configured values
    • valueCount

      public int valueCount()
      Description copied from interface: Header
      Number of values this header has.
      Specified by:
      valueCount in interface Header
      Returns:
      number of values (minimal number is 1)
    • sensitive

      public boolean sensitive()
      Description copied from interface: Header
      Sensitive headers should not be logged, or indexed (HTTP/2).
      Specified by:
      sensitive in interface Header
      Returns:
      whether this header is sensitive
    • changing

      public boolean changing()
      Description copied from interface: Header
      Changing headers should not be cached, and their value should not be indexed (HTTP/2).
      Specified by:
      changing in interface Header
      Returns:
      whether this header's value is changing often
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • contentName

      public Optional<String> contentName()
      Get the value of the name parameter. In the case of a form-data disposition type the value is the original field name from the form.
      Returns:
      Optional<String>, never null
    • filename

      public Optional<String> filename()
      Get the value of the filename parameter that can be used to suggest a filename to be used if the entity is detached and stored in a separate file.
      Returns:
      Optional<String>, never null
    • creationDate

      public Optional<ZonedDateTime> creationDate()
      Get the value of the creation-date parameter that can be used to indicate the date at which the file was created.
      Returns:
      Optional<ZonedDateTime>, never null
    • modificationDate

      public Optional<ZonedDateTime> modificationDate()
      Get the value of the modification-date parameter that can be used to indicate the date at which the file was last modified.
      Returns:
      Optional<ZonedDateTime>, never null
    • readDate

      public Optional<ZonedDateTime> readDate()
      Get the value of the modification-date parameter that can be used to indicate the date at which the file was last read.
      Returns:
      Optional<ZonedDateTime>, never null
    • size

      public OptionalLong size()
      Get the value of the size parameter that can be used to indicate an approximate size of the file in octets.
      Returns:
      OptionalLong, never null
    • parameters

      public Map<String,String> parameters()
      Get the parameters map.
      Returns:
      map, never null
    • type

      public String type()
      Content disposition type.
      Returns:
      type of this content disposition