throws IOException, ServletException {
if (context == null)
return;
Multipart config = wrapper.getMultipartConfig();
if (config == null) {
return;
}
if (usingInputStream || usingReader)
return;
if (!getMethod().equalsIgnoreCase("POST"))
return;
String contentType = getContentType();
if (contentType == null)
contentType = "";
int semicolon = contentType.indexOf(';');
if (semicolon >= 0) {
contentType = contentType.substring(0, semicolon).trim();
} else {
contentType = contentType.trim();
}
if (!("multipart/form-data".equals(contentType)))
throw new ServletException(sm.getString("coyoteRequest.notMultipart"));
DiskFileItemFactory factory = new DiskFileItemFactory();
if (config.getLocation() != null) {
factory.setRepository(new File(config.getLocation()));
}
if (config.getFileSizeThreshold() > 0) {
factory.setSizeThreshold(config.getFileSizeThreshold());
}
ServletFileUpload upload = new ServletFileUpload();
upload.setFileItemFactory(factory);
upload.setFileSizeMax(config.getMaxFileSize());
upload.setSizeMax(config.getMaxRequestSize());
parts = new HashMap<String, Part>();
try {
for (FileItem fileItem : upload.parseRequest(getRequest())) {
if (fileItem.getName() == null) {