Package org.springframework.web.multipart

# Class MaxUploadSizeExceededException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.springframework.core.NestedRuntimeException
org.springframework.web.multipart.MultipartException
org.springframework.web.multipart.MaxUploadSizeExceededException

All Implemented Interfaces:
  `Serializable`, `ErrorResponse`

public class MaxUploadSizeExceededException extends MultipartException implements ErrorResponse
MultipartException subclass thrown when an upload exceeds the maximum upload size allowed.

Since:
  1.0.1
Author:
  Juergen Hoeller, Sebastien Deleuze
See Also:
  - Serialized Form

## Nested Class Summary

## Nested classes/interfaces inherited from interface org.springframework.web.ErrorResponse

`ErrorResponse.Builder, ErrorResponse.Interceptor`

## Constructor Summary

Constructors
Constructor
Description
`MaxUploadSizeExceededException(long maxUploadSize)`
Constructor for MaxUploadSizeExceededException.
`MaxUploadSizeExceededException(long maxUploadSize, Throwable ex)`
Constructor for MaxUploadSizeExceededException.

## Method Summary

Modifier and Type
Method
Description
`ProblemDetail`
`getBody()`
Return the body for the response, formatted as an RFC 9457 `ProblemDetail` whose `status` should match the response status.
`long`
`getMaxUploadSize()`
Return the maximum upload size allowed, or -1 if the size limit isn't known.
`HttpStatusCode`
`getStatusCode()`
Return the HTTP status code to use for the response.

### Methods inherited from class org.springframework.core.NestedRuntimeException

`contains, getMostSpecificCause, getRootCause`

### Methods inherited from class java.lang.Throwable

`addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

### Methods inherited from class java.lang.Object

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

### Methods inherited from interface org.springframework.web.ErrorResponse

`getDetailMessageArguments, getDetailMessageArguments, getDetailMessageCode, getHeaders, getTitleMessageCode, getTypeMessageCode, updateAndGetBody`

## Constructor Details

### MaxUploadSizeExceededException

public MaxUploadSizeExceededException(long maxUploadSize)
Constructor for MaxUploadSizeExceededException.

Parameters:
  `maxUploadSize` - the maximum upload size allowed, or -1 if the size limit isn't known

### MaxUploadSizeExceededException

public MaxUploadSizeExceededException(long maxUploadSize, @Nullable Throwable ex)
Constructor for MaxUploadSizeExceededException.

Parameters:
  `maxUploadSize` - the maximum upload size allowed, or -1 if the size limit isn't known
  `ex` - root cause from multipart parsing API in use

## Method Details

### getMaxUploadSize

public long getMaxUploadSize()
Return the maximum upload size allowed, or -1 if the size limit isn't known.

### getStatusCode

public HttpStatusCode getStatusCode()
Description copied from interface: `ErrorResponse`
Return the HTTP status code to use for the response.

Specified by:
  `getStatusCode` in interface `ErrorResponse`

### getBody

public ProblemDetail getBody()
Description copied from interface: `ErrorResponse`
Return the body for the response, formatted as an RFC 9457 `ProblemDetail` whose `status` should match the response status.

Note: The returned `ProblemDetail` may be updated before the response is rendered, for example, via `ErrorResponse.updateAndGetBody(MessageSource, Locale)`. Therefore, implementing methods should use an instance field, and should not re-create the `ProblemDetail` on every call, nor use a static variable.

Specified by:
  `getBody` in interface `ErrorResponse`