Author: konstantin.mishin
Date: 2010-12-08 11:16:00 -0500 (Wed, 08 Dec 2010)
New Revision: 20466
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/context/FileUploadPartialViewContextFactory.java
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/context/FileUploadPartialViewContextFactory.java
===================================================================
---
trunk/ui/input/ui/src/main/java/org/richfaces/context/FileUploadPartialViewContextFactory.java 2010-12-08
15:58:09 UTC (rev 20465)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/context/FileUploadPartialViewContextFactory.java 2010-12-08
16:16:00 UTC (rev 20466)
@@ -93,8 +93,8 @@
if (maxRequestSize != 0 && externalContext.getRequestContentLength()
> maxRequestSize) {
printResponse(facesContext, uid, ResponseState.sizeExceeded);
} else {
- MultipartRequest multipartRequest = new MultipartRequest(request,
createTempFiles,
- tempFilesDirectory, maxRequestSize, uid);
+ MultipartRequest multipartRequest = new MultipartRequest(request,
createTempFiles, tempFilesDirectory,
+ uid);
try {
multipartRequest.parseRequest();
if (!multipartRequest.isDone()) {
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-08
15:58:09 UTC (rev 20465)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/request/FileParam.java 2010-12-08
16:16:00 UTC (rev 20466)
@@ -29,7 +29,7 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.rmi.server.UID;
+import java.util.UUID;
import org.richfaces.exception.FileUploadException;
import org.richfaces.log.Logger;
@@ -86,7 +86,7 @@
if (tempFilesDirectory != null) {
dir = new File(tempFilesDirectory);
}
- tempFile = File.createTempFile(new UID().toString().replace(":",
"-"), ".upload", dir);
+ tempFile = File.createTempFile(UUID.randomUUID().toString(),
".upload", dir);
fOut = new FileOutputStream(tempFile);
} catch (IOException ex) {
if (fOut != null) {
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-08
15:58:09 UTC (rev 20465)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/request/MultipartRequest.java 2010-12-08
16:16:00 UTC (rev 20466)
@@ -118,21 +118,11 @@
private HeadersHandler headersHandler = null;
- public MultipartRequest(HttpServletRequest request, boolean createTempFiles, String
tempFilesDirectory,
- int maxRequestSize, String uid) {
+ public MultipartRequest(HttpServletRequest request, boolean createTempFiles, String
tempFilesDirectory, String uid) {
super(request);
this.createTempFiles = createTempFiles;
this.tempFilesDirectory = tempFilesDirectory;
this.uid = uid;
-
- String contentLengthStr = request.getHeader("Content-Length");
- this.contentLength = Integer.parseInt(contentLengthStr);
- if (contentLengthStr != null && maxRequestSize > 0 &&
contentLength > maxRequestSize) {
- // TODO : we should make decision if can generate exception in this
- // place
- // throw new FileUploadException(
- // "Multipart request is larger than allowed size");
- }
}
private class ControlledProgressInputStream extends FilterInputStream {
Show replies by date