Class BinaryTypeConfiguration

java.lang.Object
io.micronaut.function.BinaryTypeConfiguration

@ConfigurationProperties("micronaut.function.binary-types") public class BinaryTypeConfiguration extends Object
Allows checking for MediaTypes that should be considered binary. This is used for example to determine whether to mime encode an AWS lambda response message (where the response body is a String).
Since:
4.0.0
Author:
Tim Yates
  • Constructor Details

    • BinaryTypeConfiguration

      public BinaryTypeConfiguration()
  • Method Details

    • isUseDefaults

      public boolean isUseDefaults()
      If this is false then calls to isMediaTypeBinary(String) will only check the additional types, and ignore the defaults. The defaults are: "application/octet-stream", "image/jpeg", "image/png", "image/gif", "application/zip"
      Returns:
      Whether to use the default binary types
    • setUseDefaults

      public void setUseDefaults(boolean useDefaults)
      Sets whether to use the default binary types.
      Parameters:
      useDefaults - True if they should be used
    • getAdditionalTypes

      public List<String> getAdditionalTypes()
      The additional media types to consider binary.
      Returns:
      A lists of MediaType objects
    • setAdditionalTypes

      public void setAdditionalTypes(@NonNull @NonNull List<String> additionalTypes)
      Sets the additional media types to consider binary.
      Parameters:
      additionalTypes - The media types
    • isMediaTypeBinary

      public boolean isMediaTypeBinary(String mediaType)
      Checks whether the given media type is considered binary.
      Parameters:
      mediaType - The media type
      Returns:
      Whether the media type is considered binary