* Parse multipart.
*/
protected void parseMultipart()
throws IOException, ServletException {
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"));
DiskFileUpload fu = new DiskFileUpload();
fu.setRepositoryPath(config.getLocation());
if (config.getFileSizeThreshold() > 0) {
fu.setSizeThreshold(config.getFileSizeThreshold());
}
if (config.getMaxRequestSize() > 0) {
fu.setSizeMax(config.getMaxRequestSize());
}
if (config.getMaxFileSize() > 0) {
fu.setFileSizeMax(config.getMaxFileSize());
}
parts = new HashMap<String, Part>();
try {
for (FileItem fileItem : fu.parseRequest(getRequest())) {