+

Search Tips   |   Advanced Search

Web container behavior notes

Learn about behavior notes for the web container.


Access multipart/form-data

Define a servlet to process multipart/form data by including a @MultipartConfig annotation in the servlet, or by specifying a multipart-config element for the servlet in the application web.xml file. An annotation might look like the following example:

@MultipartConfig(fileSizeThreshold=1000000, location="temp", maxFileSize=5000000, maxRequestSize=5000000)

If a servlet is not defined to process multipart/form data, or the include file is not within the limits that are set by the configuration data, the following behavior is observed in response to a request containing multipart/form data:

ServletRequest.getParameter() will return null for a request to obtain a form field.
HttpServletRequest.getPart() or HttpServletRequest.getParts() will throw an 
appropriate exception.  The exception message is an indication of the cause of the exception.

  • Web container properties