Class 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.Toggleable
    Configuration for multipart handling.
    • 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()  
      long getMaxFileSize()  
      long getThreshold()  
      boolean isDisk()  
      boolean isEnabled()  
      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​(java.io.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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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
    • Constructor Detail

      • MultipartConfiguration

        public MultipartConfiguration()
    • 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:
        isEnabled in interface io.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