MultipartConfigElement (Servlet 4.0 API Documentation - Apache Tomcat 9.0.111)
Description: declaration: package: javax.servlet, class: MultipartConfigElement

# Class MultipartConfigElement

java.lang.Object
javax.servlet.MultipartConfigElement

public class MultipartConfigElement extends Object
The programmatic equivalent of `MultipartConfig` used to configure multi-part handling for a Servlet when registering a Servlet via code.

Since:
  Servlet 3.0

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MultipartConfigElement(String location)`
  Create a programmatic multi-part configuration with a specific location and defaults for the remaining configuration elements.
  `MultipartConfigElement(String location, long maxFileSize, long maxRequestSize, int fileSizeThreshold)`
  Create a programmatic multi-part configuration from the individual configuration elements.
  `MultipartConfigElement(MultipartConfig annotation)`
  Create a programmatic configuration from an annotation.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `getFileSizeThreshold()`
  Obtain the size above which the file is save in the temporary location rather than retained in memory.
  `String`
  `getLocation()`
  Obtain the location where temporary files should be stored.
  `long`
  `getMaxFileSize()`
  Obtain the maximum permitted size for a single file.
  `long`
  `getMaxRequestSize()`
  Obtain the maximum permitted size for a single request.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### MultipartConfigElement

    public MultipartConfigElement(String location)
    Create a programmatic multi-part configuration with a specific location and defaults for the remaining configuration elements.
    Parameters:
      `location` - The temporary location to store files

  - ### MultipartConfigElement

    public MultipartConfigElement(String location, long maxFileSize, long maxRequestSize, int fileSizeThreshold)
    Create a programmatic multi-part configuration from the individual configuration elements.
    Parameters:
      `location` - The temporary location to store files
      `maxFileSize` - The maximum permitted size for a single file
      `maxRequestSize` - The maximum permitted size for a request
      `fileSizeThreshold` - The size above which the file is save in the temporary location rather than retained in memory.

  - ### MultipartConfigElement

    public MultipartConfigElement(MultipartConfig annotation)
    Create a programmatic configuration from an annotation.
    Parameters:
      `annotation` - The source annotation to copy to create the programmatic equivalent.

- ## Method Details

  - ### getLocation

    public String getLocation()
    Obtain the location where temporary files should be stored.
    Returns:
      the location where temporary files should be stored.

  - ### getMaxFileSize

    public long getMaxFileSize()
    Obtain the maximum permitted size for a single file.
    Returns:
      the maximum permitted size for a single file.

  - ### getMaxRequestSize

    public long getMaxRequestSize()
    Obtain the maximum permitted size for a single request.
    Returns:
      the maximum permitted size for a single request.

  - ### getFileSizeThreshold

    public int getFileSizeThreshold()
    Obtain the size above which the file is save in the temporary location rather than retained in memory.
    Returns:
      the size above which the file is save in the temporary location rather than retained in memory.