[richfaces-svn-commits] JBoss Rich Faces SVN: r6425 - in trunk/sandbox/samples/fileUploadDemo/src/main: webapp/WEB-INF and 1 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Thu Feb 28 11:25:04 EST 2008


Author: andrei_exadel
Date: 2008-02-28 11:25:03 -0500 (Thu, 28 Feb 2008)
New Revision: 6425

Modified:
   trunk/sandbox/samples/fileUploadDemo/src/main/java/org/richfaces/Bean.java
   trunk/sandbox/samples/fileUploadDemo/src/main/webapp/WEB-INF/web.xml
   trunk/sandbox/samples/fileUploadDemo/src/main/webapp/pages/index.jsp
Log:
update demo after component changes

Modified: trunk/sandbox/samples/fileUploadDemo/src/main/java/org/richfaces/Bean.java
===================================================================
--- trunk/sandbox/samples/fileUploadDemo/src/main/java/org/richfaces/Bean.java	2008-02-28 16:24:32 UTC (rev 6424)
+++ trunk/sandbox/samples/fileUploadDemo/src/main/java/org/richfaces/Bean.java	2008-02-28 16:25:03 UTC (rev 6425)
@@ -21,6 +21,7 @@
 
 package org.richfaces;
 
+import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
@@ -28,6 +29,7 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import org.richfaces.event.UploadEvent;
 
@@ -53,29 +55,25 @@
 		return flag;
 	}
 	
-	public List getFileList() {
-	    if (data != null) {
-		List fileList = new ArrayList();
-		for (Object o : data.keySet()) {
-		    String name = (String)o;
-		    File file = (File)data.get(o);
-		    if (file != null) {
-			fileList.add(new FileData(name));
-		    }
-		}
-		return fileList;
-	    }
-	    return null;
+	public List getFileList () {
+	    return data != null ? new ArrayList(data.keySet()) : null;
 	}
 
+
 	public void setFlag(boolean flag) {
 		this.flag = flag;
 	}
 	
 	public void listener(UploadEvent event) throws IOException{
-	    File file = event.getFile();
-	   System.out.println("File : '" + event.getFileName() + "' was uploaded");
-	   System.out.println("Absolute Path : '" + file.getAbsolutePath() + "'!");
+	    System.out.println("File : '" + event.getFileName() + "' was uploaded");
+	    if (event.isFile()) {
+		File file = event.getFile();
+		System.out.println("Absolute Path : '" + file.getAbsolutePath() + "'!");
+	    }else {
+		ByteArrayOutputStream b = new ByteArrayOutputStream();
+		b.write(event.getData());
+		System.out.println(b.toString());
+	    }
 	}
 
 	/**

Modified: trunk/sandbox/samples/fileUploadDemo/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/sandbox/samples/fileUploadDemo/src/main/webapp/WEB-INF/web.xml	2008-02-28 16:24:32 UTC (rev 6424)
+++ trunk/sandbox/samples/fileUploadDemo/src/main/webapp/WEB-INF/web.xml	2008-02-28 16:25:03 UTC (rev 6425)
@@ -44,7 +44,7 @@
   </init-param>
   <init-param>
   <param-name>maxRequestSize</param-name>
-  <param-value>100000000</param-value>
+  <param-value>20000000</param-value>
   </init-param>
    </filter>
   

Modified: trunk/sandbox/samples/fileUploadDemo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/sandbox/samples/fileUploadDemo/src/main/webapp/pages/index.jsp	2008-02-28 16:24:32 UTC (rev 6424)
+++ trunk/sandbox/samples/fileUploadDemo/src/main/webapp/pages/index.jsp	2008-02-28 16:25:03 UTC (rev 6425)
@@ -59,7 +59,7 @@
 <a4j:commandLink style="font-weight: bold; width: 200px;" value="Show files uploaded:" reRender="files_list"></a4j:commandLink><br/><br/>
 <h:dataTable value="#{bean.fileList}" var="file" id="files_list" style="width: 500px">
 	<h:column>
-	<h:outputText value="#{file.name}"></h:outputText>	
+	<h:outputText value="#{file}"></h:outputText>	
 	</h:column>
 </h:dataTable>
 




More information about the richfaces-svn-commits mailing list