Author: konstantin.mishin
Date: 2010-12-10 11:37:09 -0500 (Fri, 10 Dec 2010)
New Revision: 20501
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/request/FileParam.java
trunk/ui/input/ui/src/main/java/org/richfaces/request/MultipartRequest.java
Log:
small code cleanup
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/request/FileParam.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/request/FileParam.java 2010-12-10
16:14:34 UTC (rev 20500)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/request/FileParam.java 2010-12-10
16:37:09 UTC (rev 20501)
@@ -29,7 +29,6 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.util.UUID;
import org.richfaces.exception.FileUploadException;
import org.richfaces.log.Logger;
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/request/MultipartRequest.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/request/MultipartRequest.java 2010-12-10
16:14:34 UTC (rev 20500)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/request/MultipartRequest.java 2010-12-10
16:37:09 UTC (rev 20501)
@@ -92,9 +92,9 @@
private String encoding = null;
- private Integer contentLength = 0;
+ private long contentLength = 0;
- private int bytesRead = 0;
+ private long bytesRead = 0;
// we shouldn't allow to stop until request reaches PhaseListener because of
portlets
private volatile boolean canStop = false;
@@ -103,7 +103,7 @@
private Map<String, Object> percentMap = null;
- private Map<String, Integer> requestSizeMap = null;
+ private Map<String, Long> requestSizeMap = null;
private List<String> keys = new ArrayList<String>();
@@ -118,11 +118,13 @@
private HeadersHandler headersHandler = null;
- public MultipartRequest(HttpServletRequest request, boolean createTempFiles, String
tempFilesDirectory, String uid) {
+ public MultipartRequest(HttpServletRequest request, boolean createTempFiles, String
tempFilesDirectory,
+ String uid) {
super(request);
this.createTempFiles = createTempFiles;
this.tempFilesDirectory = tempFilesDirectory;
this.uid = uid;
+ this.contentLength =
Long.parseLong(request.getHeader("Content-Length"));
}
private class ControlledProgressInputStream extends FilterInputStream {
@@ -399,9 +401,9 @@
}
if (requestSizeMap == null) {
- requestSizeMap = (Map<String, Integer>)
sessionMap.get(REQUEST_SIZE_BEAN_NAME);
+ requestSizeMap = (Map<String, Long>)
sessionMap.get(REQUEST_SIZE_BEAN_NAME);
if (requestSizeMap == null) {
- requestSizeMap = new ConcurrentHashMap<String,
Integer>();
+ requestSizeMap = new ConcurrentHashMap<String,
Long>();
sessionMap.put(REQUEST_SIZE_BEAN_NAME,
requestSizeMap);
}
}
@@ -409,7 +411,7 @@
percentMap.put(uploadId, Double.valueOf(0));
- requestSizeMap.put(uploadId, getSize());
+ requestSizeMap.put(uploadId, contentLength);
}
}
}
@@ -507,10 +509,6 @@
return param;
}
- public Integer getSize() {
- return contentLength;
- }
-
@SuppressWarnings("rawtypes")
@Override
public Enumeration getParameterNames() {
@@ -625,8 +623,7 @@
}
public boolean isDone() {
- return !(this.shouldStop && (this.canceled || this.contentLength != null
- && this.contentLength.intValue() != this.bytesRead));
+ return !(this.contentLength != this.bytesRead && this.shouldStop
&& this.canceled);
}
@Override
Show replies by date