org.springframework.boot.web.servlet

Class MultipartConfigFactory



  • public class MultipartConfigFactory
    extends Object
    Factory that can be used to create a MultipartConfigElement. Size values can be set using traditional long values which are set in bytes or using more readable String variants that accept KB or MB suffixes, for example:
     factory.setMaxFileSize("10MB");
     factory.setMaxRequestSize("100KB");
     
    Since:
    1.4.0
    Author:
    Phillip Webb
    • Constructor Detail

      • MultipartConfigFactory

        public MultipartConfigFactory()
    • Method Detail

      • setLocation

        public void setLocation(String location)
        Sets the directory location where files will be stored.
        Parameters:
        location - the location
      • setMaxFileSize

        public void setMaxFileSize(long maxFileSize)
        Sets the maximum size in bytes allowed for uploaded files.
        Parameters:
        maxFileSize - the maximum file size
        See Also:
        setMaxFileSize(String)
      • setMaxFileSize

        public void setMaxFileSize(String maxFileSize)
        Sets the maximum size allowed for uploaded files. Values can use the suffixed "MB" or "KB" to indicate a Megabyte or Kilobyte size.
        Parameters:
        maxFileSize - the maximum file size
        See Also:
        setMaxFileSize(long)
      • setMaxRequestSize

        public void setMaxRequestSize(long maxRequestSize)
        Sets the maximum size allowed in bytes for multipart/form-data requests.
        Parameters:
        maxRequestSize - the maximum request size
        See Also:
        setMaxRequestSize(String)
      • setMaxRequestSize

        public void setMaxRequestSize(String maxRequestSize)
        Sets the maximum size allowed for multipart/form-data requests. Values can use the suffixed "MB" or "KB" to indicate a Megabyte or Kilobyte size.
        Parameters:
        maxRequestSize - the maximum request size
        See Also:
        setMaxRequestSize(long)
      • setFileSizeThreshold

        public void setFileSizeThreshold(int fileSizeThreshold)
        Sets the size threshold in bytes after which files will be written to disk.
        Parameters:
        fileSizeThreshold - the file size threshold
        See Also:
        setFileSizeThreshold(String)
      • setFileSizeThreshold

        public void setFileSizeThreshold(String fileSizeThreshold)
        Sets the size threshold after which files will be written to disk. Values can use the suffixed "MB" or "KB" to indicate a Megabyte or Kilobyte size.
        Parameters:
        fileSizeThreshold - the file size threshold
        See Also:
        setFileSizeThreshold(int)
      • createMultipartConfig

        public javax.servlet.MultipartConfigElement createMultipartConfig()
        Create a new MultipartConfigElement instance.
        Returns:
        the multipart config element

Copyright © 2019 Pivotal Software, Inc.. All rights reserved.