Author: nbelaevski
Date: 2009-03-12 12:55:23 -0400 (Thu, 12 Mar 2009)
New Revision: 12939
Modified:
trunk/ui/fileUpload/src/main/java/org/richfaces/component/UIFileUpload.java
trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java
Log:
https://jira.jboss.org/jira/browse/RF-4761
Modified: trunk/ui/fileUpload/src/main/java/org/richfaces/component/UIFileUpload.java
===================================================================
--- trunk/ui/fileUpload/src/main/java/org/richfaces/component/UIFileUpload.java 2009-03-12
16:54:08 UTC (rev 12938)
+++ trunk/ui/fileUpload/src/main/java/org/richfaces/component/UIFileUpload.java 2009-03-12
16:55:23 UTC (rev 12939)
@@ -202,19 +202,21 @@
Map<String, Object> sessionMap = externalContext.getSessionMap();
- Map<String, MultipartRequest> sessions = (Map<String,
MultipartRequest>) sessionMap
- .get(FileUploadConstants.REQUESTS_SESSIONS_BEAN_NAME);
- if (sessions != null) {
- MultipartRequest multipartRequest = sessions.get(uid);
- if (multipartRequest != null) {
- if ("progress".equals(actionString)) {
- setupProgressBarValueExpression(facesContext, uid);
- ajaxContext.setResponseData(multipartRequest.getSize());
- } else if
("richfaces_file_upload_action_stop".equals(actionString)) {
- multipartRequest.stop();
- }
- }
- }
+ if ("progress".equals(actionString)) {
+ setupProgressBarValueExpression(facesContext, uid);
+ Map<String, Integer> requestsSizeMap = (Map<String,
Integer>) sessionMap.get(FileUploadConstants.REQUEST_SIZE_BEAN_NAME);
+
+ if (requestsSizeMap != null) {
+ ajaxContext.setResponseData(requestsSizeMap.get(uid));
+ } else {
+ ajaxContext.setResponseData(null);
+ }
+ } else if (FileUploadConstants.FILE_UPLOAD_ACTION_STOP.equals(actionString))
{
+ MultipartRequest multipartRequest =
MultipartRequest.lookupRequest(facesContext, uid);
+ if (multipartRequest != null) {
+ multipartRequest.stop();
+ }
+ }
}
}
Modified:
trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java
===================================================================
---
trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java 2009-03-12
16:54:08 UTC (rev 12938)
+++
trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java 2009-03-12
16:55:23 UTC (rev 12939)
@@ -133,11 +133,9 @@
String uid = requestParameterMap.get(FileUploadConstants.UPLOAD_FILES_ID);
decreaseFileCounter(context, id);
- Map<String, MultipartRequest> map = (Map<String, MultipartRequest>)
externalContext.getSessionMap()
- .get(FileUploadConstants.REQUESTS_SESSIONS_BEAN_NAME);
-
- MultipartRequest multipartRequest = map.get(uid);
+ MultipartRequest multipartRequest = MultipartRequest.lookupRequest(context, uid);
+
boolean isFlash = (requestParameterMap.get("_richfaces_send_http_error") !=
null);
List<UploadItem> fileList = multipartRequest.getUploadItems();