Package io.micronaut.http.server
Class HttpServerConfiguration.MultipartConfiguration
java.lang.Object
io.micronaut.http.server.HttpServerConfiguration.MultipartConfiguration
- All Implemented Interfaces:
Toggleable
- Enclosing class:
- HttpServerConfiguration
@ConfigurationProperties("multipart")
public static class HttpServerConfiguration.MultipartConfiguration
extends Object
implements Toggleable
Configuration for multipart handling.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final boolean
The default disk value.static final boolean
The default enable value.static final long
The default max file size.static final boolean
The default mixed value.static final long
The default threshold value. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionThe default multipart enabled setting is false for servlets, but effectively true for Netty.long
long
boolean
isDisk()
boolean
boolean
isMixed()
void
setDisk
(boolean disk) Sets whether to buffer data to disk or not.void
setEnabled
(boolean enabled) Sets whether multipart processing is enabled.void
setLocation
(File location) Sets the location to store files.void
setMaxFileSize
(long maxFileSize) Sets the max file size.void
setMixed
(boolean mixed) Sets whether to buffer data to disk if the size is greater than the threshold.void
setThreshold
(long threshold) Sets the amount of data that should be received that will trigger the data to be stored to disk.
-
Field Details
-
DEFAULT_ENABLED
public static final boolean DEFAULT_ENABLEDThe default enable value.- See Also:
-
DEFAULT_MAX_FILE_SIZE
public static final long DEFAULT_MAX_FILE_SIZEThe default max file size.- See Also:
-
DEFAULT_DISK
public static final boolean DEFAULT_DISKThe default disk value.- See Also:
-
DEFAULT_MIXED
public static final boolean DEFAULT_MIXEDThe default mixed value.- See Also:
-
DEFAULT_THRESHOLD
public static final long DEFAULT_THRESHOLDThe default threshold value.- See Also:
-
-
Constructor Details
-
MultipartConfiguration
public MultipartConfiguration()
-
-
Method Details
-
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:
isEnabled
in interfaceToggleable
- Returns:
- Whether file uploads are enabled. Defaults to true.
-
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
Sets the location to store files.- Parameters:
location
- The location
-
setMaxFileSize
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
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
-