String uid = queryParamMap.get(FileUploadConstants.UPLOAD_FILES_ID);
if (uid != null) {
if (isMultipartRequest(httpRequest)) {
MultipartRequest multipartRequest = new MultipartRequest(httpRequest, createTempFiles, maxRequestSize, uid);
Object oldAttributeValue = httpRequest.getAttribute(FileUploadConstants.FILE_UPLOAD_REQUEST_ATTRIBUTE_NAME);
httpRequest.setAttribute(FileUploadConstants.FILE_UPLOAD_REQUEST_ATTRIBUTE_NAME, multipartRequest);
try {
if (isFileSizeRestricted(request, maxRequestSize)) {
boolean sendError = Boolean.parseBoolean(queryParamMap.get(SEND_HTTP_ERROR));
if (sendError) {
response.sendError(HttpServletResponse.SC_REQUEST_ENTITY_TOO_LARGE);
System.err.println("ERROR " + HttpServletResponse.SC_REQUEST_ENTITY_TOO_LARGE + "request entity is larger than the server is willing or able to process.");
return;
} else {
printResponse(response, "<html id=\"_richfaces_file_upload_size_restricted\"></html>");
}
} else if (!checkFileCount(httpRequest, queryParamMap.get("id"))) {
printResponse(response, "<html id=\"_richfaces_file_upload_forbidden\"></html>");
} else {
handleRequest(multipartRequest, multipartRequest.isFormUpload() ? response :
new HttpServletResponseWrapper((HttpServletResponse) response){
@Override
public void setContentType(String type) {
super.setContentType(BaseXMLFilter.TEXT_HTML + ";charset=UTF-8");
}
}, chain);
if (!multipartRequest.isDone()) {
printResponse(response, "<html id=\"_richfaces_file_upload_stopped\"></html>");
}
}
} finally {
httpRequest.setAttribute(FileUploadConstants.FILE_UPLOAD_REQUEST_ATTRIBUTE_NAME, oldAttributeValue);
multipartRequest.clearRequestData();
}
} else {
handleRequest(request, response, chain);
}
} else {