Package io.micronaut.http.server
Class HttpServerConfiguration.MultipartConfiguration
- java.lang.Object
-
- io.micronaut.http.server.HttpServerConfiguration.MultipartConfiguration
-
- All Implemented Interfaces:
io.micronaut.core.util.Toggleable
- Enclosing class:
- HttpServerConfiguration
@ConfigurationProperties("multipart") public static class HttpServerConfiguration.MultipartConfiguration extends java.lang.Object implements io.micronaut.core.util.ToggleableConfiguration for multipart handling.
-
-
Field Summary
Fields Modifier and Type Field Description static booleanDEFAULT_DISKThe default disk value.static booleanDEFAULT_ENABLEDThe default enable value.static longDEFAULT_MAX_FILE_SIZEThe default max file size.static booleanDEFAULT_MIXEDThe default mixed value.static longDEFAULT_THRESHOLDThe default threshold value.
-
Constructor Summary
Constructors Constructor Description MultipartConfiguration()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<java.lang.Boolean>getEnabled()The default multipart enabled setting is false for servlets, but effectively true for Netty.java.util.Optional<java.io.File>getLocation()longgetMaxFileSize()longgetThreshold()booleanisDisk()booleanisEnabled()booleanisMixed()voidsetDisk(boolean disk)Sets whether to buffer data to disk or not.voidsetEnabled(boolean enabled)Sets whether multipart processing is enabled.voidsetLocation(java.io.File location)Sets the location to store files.voidsetMaxFileSize(long maxFileSize)Sets the max file size.voidsetMixed(boolean mixed)Sets whether to buffer data to disk if the size is greater than the threshold.voidsetThreshold(long threshold)Sets the amount of data that should be received that will trigger the data to be stored to disk.
-
-
-
Field Detail
-
DEFAULT_ENABLED
public static final boolean DEFAULT_ENABLED
The default enable value.- See Also:
- Constant Field Values
-
DEFAULT_MAX_FILE_SIZE
public static final long DEFAULT_MAX_FILE_SIZE
The default max file size.- See Also:
- Constant Field Values
-
DEFAULT_DISK
public static final boolean DEFAULT_DISK
The default disk value.- See Also:
- Constant Field Values
-
DEFAULT_MIXED
public static final boolean DEFAULT_MIXED
The default mixed value.- See Also:
- Constant Field Values
-
DEFAULT_THRESHOLD
public static final long DEFAULT_THRESHOLD
The default threshold value.- See Also:
- Constant Field Values
-
-
Method Detail
-
getLocation
public java.util.Optional<java.io.File> getLocation()
- Returns:
- The location to store temporary files
-
getMaxFileSize
public long getMaxFileSize()
- Returns:
- The max file size. Defaults to 1MB
-
isEnabled
public boolean isEnabled()
- Specified by:
isEnabledin interfaceio.micronaut.core.util.Toggleable- Returns:
- Whether file uploads are enabled. Defaults to true.
-
getEnabled
@Internal public java.util.Optional<java.lang.Boolean> getEnabled()
The default multipart enabled setting is false for servlets, but effectively true for Netty. This method returns the value only if set by the user.- Returns:
- The enabled setting.
-
isDisk
public boolean isDisk()
- Returns:
- Whether to use disk. Defaults to false.
-
isMixed
public boolean isMixed()
- Returns:
- Whether to use a mixed upload
-
getThreshold
public long getThreshold()
- Returns:
- The threshold to trigger storage to disk
-
setLocation
public void setLocation(java.io.File location)
Sets the location to store files.- Parameters:
location- The location
-
setMaxFileSize
public void setMaxFileSize(@ReadableBytes long maxFileSize)Sets the max file size. Default value (1048576L => 1MB).- Parameters:
maxFileSize- The max file size
-
setEnabled
public void setEnabled(boolean enabled)
Sets whether multipart processing is enabled. Default value (false).- Parameters:
enabled- True if it is enabled
-
setDisk
public void setDisk(boolean disk)
Sets whether to buffer data to disk or not. Default value (false).- Parameters:
disk- True if data should be written to disk
-
setMixed
public void setMixed(boolean mixed)
Sets whether to buffer data to disk if the size is greater than the threshold. Default value (false).- Parameters:
mixed- True if data should be written to disk after a threshold.
-
setThreshold
public void setThreshold(@ReadableBytes long threshold)Sets the amount of data that should be received that will trigger the data to be stored to disk. Default value (10485760L).- Parameters:
threshold- The threshold
-
-