Author: konstantin.mishin
Date: 2010-12-16 14:43:06 -0500 (Thu, 16 Dec 2010)
New Revision: 20626
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/context/FileUploadPartialViewContextFactory.java
Log:
RF-6590
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/context/FileUploadPartialViewContextFactory.java
===================================================================
---
trunk/ui/input/ui/src/main/java/org/richfaces/context/FileUploadPartialViewContextFactory.java 2010-12-16
19:19:06 UTC (rev 20625)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/context/FileUploadPartialViewContextFactory.java 2010-12-16
19:43:06 UTC (rev 20626)
@@ -70,7 +70,7 @@
private String tempFilesDirectory;
/** The maximum size of a file upload request. 0 means no limit. */
- private int maxRequestSize = 0;
+ private long maxRequestSize = 0;
public FileUploadPartialViewContextFactory(PartialViewContextFactory parentFactory)
{
this.parentFactory = parentFactory;
@@ -83,7 +83,7 @@
this.tempFilesDirectory =
context.getInitParameter("org.richfaces.fileUpload.tempFilesDirectory");
param =
context.getInitParameter("org.richfaces.fileUpload.maxRequestSize");
if (param != null) {
- this.maxRequestSize = Integer.parseInt(param);
+ this.maxRequestSize = Long.parseLong(param);
}
}
@@ -95,7 +95,8 @@
Map<String, String> queryParamMap =
parseQueryString(request.getQueryString());
String uid = queryParamMap.get(UID_KEY);
if (uid != null) {
- if (maxRequestSize != 0 && externalContext.getRequestContentLength()
> maxRequestSize) {
+ long contentLength =
Long.parseLong(externalContext.getRequestHeaderMap().get("Content-Length"));
+ if (maxRequestSize != 0 && contentLength > maxRequestSize) {
printResponse(facesContext, uid, ResponseState.sizeExceeded);
} else {
final MultipartRequest multipartRequest = new MultipartRequest(request,
createTempFiles,
Show replies by date