Package io.micronaut.function
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionThe additional media types to consider binary.boolean
isMediaTypeBinary
(String mediaType) Checks whether the given media type is considered binary.boolean
If this is false then calls toisMediaTypeBinary(String)
will only check the additional types, and ignore the defaults.void
setAdditionalTypes
(@NonNull List<String> additionalTypes) Sets the additional media types to consider binary.void
setUseDefaults
(boolean useDefaults) Sets whether to use the default binary types.
-
Constructor Details
-
BinaryTypeConfiguration
public BinaryTypeConfiguration()
-
-
Method Details
-
isUseDefaults
public boolean isUseDefaults()If this is false then calls toisMediaTypeBinary(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
The additional media types to consider binary.- Returns:
- A lists of
MediaType
objects
-
setAdditionalTypes
Sets the additional media types to consider binary.- Parameters:
additionalTypes
- The media types
-
isMediaTypeBinary
Checks whether the given media type is considered binary.- Parameters:
mediaType
- The media type- Returns:
- Whether the media type is considered binary
-