struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject [04/14] struts git commit: Updates examples
Date Fri, 25 Nov 2016 18:17:59 GMT
Updates examples


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/dca41a39
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/dca41a39
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/dca41a39

Branch: refs/heads/master
Commit: dca41a39bf61917def9288e0436b8ccff410dd31
Parents: 407cd58
Author: Lukasz Lenart <lukaszlenart@apache.org>
Authored: Mon Nov 21 11:05:56 2016 +0100
Committer: Lukasz Lenart <lukaszlenart@apache.org>
Committed: Mon Nov 21 11:05:56 2016 +0100

----------------------------------------------------------------------
 .../struts2/showcase/fileupload/FileUploadAction.java  |  7 ++++---
 .../fileupload/MultipleFileUploadUsingArrayAction.java |  9 +++++----
 .../fileupload/MultipleFileUploadUsingListAction.java  | 13 +++++++------
 3 files changed, 16 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/dca41a39/apps/showcase/src/main/java/org/apache/struts2/showcase/fileupload/FileUploadAction.java
----------------------------------------------------------------------
diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/fileupload/FileUploadAction.java
b/apps/showcase/src/main/java/org/apache/struts2/showcase/fileupload/FileUploadAction.java
index 6005306..0568a51 100644
--- a/apps/showcase/src/main/java/org/apache/struts2/showcase/fileupload/FileUploadAction.java
+++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/fileupload/FileUploadAction.java
@@ -21,6 +21,7 @@
 package org.apache.struts2.showcase.fileupload;
 
 import com.opensymphony.xwork2.ActionSupport;
+import org.apache.struts2.dispatcher.multipart.UploadedFile;
 
 import java.io.File;
 
@@ -32,7 +33,7 @@ public class FileUploadAction extends ActionSupport {
 	private static final long serialVersionUID = 5156288255337069381L;
 
 	private String contentType;
-	private File upload;
+	private UploadedFile upload;
 	private String fileName;
 	private String caption;
 
@@ -68,11 +69,11 @@ public class FileUploadAction extends ActionSupport {
 
 	// since we are using <s:file name="upload" ... /> the File itself will be
 	// obtained through getter/setter of <file-tag-name>
-	public File getUpload() {
+	public UploadedFile getUpload() {
 		return upload;
 	}
 
-	public void setUpload(File upload) {
+	public void setUpload(UploadedFile upload) {
 		this.upload = upload;
 	}
 

http://git-wip-us.apache.org/repos/asf/struts/blob/dca41a39/apps/showcase/src/main/java/org/apache/struts2/showcase/fileupload/MultipleFileUploadUsingArrayAction.java
----------------------------------------------------------------------
diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/fileupload/MultipleFileUploadUsingArrayAction.java
b/apps/showcase/src/main/java/org/apache/struts2/showcase/fileupload/MultipleFileUploadUsingArrayAction.java
index b1a5985..183b2b3 100644
--- a/apps/showcase/src/main/java/org/apache/struts2/showcase/fileupload/MultipleFileUploadUsingArrayAction.java
+++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/fileupload/MultipleFileUploadUsingArrayAction.java
@@ -22,6 +22,7 @@
 package org.apache.struts2.showcase.fileupload;
 
 import com.opensymphony.xwork2.ActionSupport;
+import org.apache.struts2.dispatcher.multipart.UploadedFile;
 
 import java.io.File;
 
@@ -32,7 +33,7 @@ import java.io.File;
  */
 public class MultipleFileUploadUsingArrayAction extends ActionSupport {
 
-	private File[] uploads;
+	private UploadedFile[] uploads;
 	private String[] uploadFileNames;
 	private String[] uploadContentTypes;
 
@@ -40,7 +41,7 @@ public class MultipleFileUploadUsingArrayAction extends ActionSupport {
 	public String upload() throws Exception {
 		System.out.println("\n\n upload2");
 		System.out.println("files:");
-		for (File u : uploads) {
+		for (UploadedFile u : uploads) {
 			System.out.println("*** " + u + "\t" + u.length());
 		}
 		System.out.println("filenames:");
@@ -55,11 +56,11 @@ public class MultipleFileUploadUsingArrayAction extends ActionSupport
{
 		return SUCCESS;
 	}
 
-	public File[] getUpload() {
+	public UploadedFile[] getUpload() {
 		return this.uploads;
 	}
 
-	public void setUpload(File[] upload) {
+	public void setUpload(UploadedFile[] upload) {
 		this.uploads = upload;
 	}
 

http://git-wip-us.apache.org/repos/asf/struts/blob/dca41a39/apps/showcase/src/main/java/org/apache/struts2/showcase/fileupload/MultipleFileUploadUsingListAction.java
----------------------------------------------------------------------
diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/fileupload/MultipleFileUploadUsingListAction.java
b/apps/showcase/src/main/java/org/apache/struts2/showcase/fileupload/MultipleFileUploadUsingListAction.java
index 56e5875..5327ae7 100644
--- a/apps/showcase/src/main/java/org/apache/struts2/showcase/fileupload/MultipleFileUploadUsingListAction.java
+++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/fileupload/MultipleFileUploadUsingListAction.java
@@ -22,6 +22,7 @@
 package org.apache.struts2.showcase.fileupload;
 
 import com.opensymphony.xwork2.ActionSupport;
+import org.apache.struts2.dispatcher.multipart.UploadedFile;
 
 import java.io.File;
 import java.util.ArrayList;
@@ -34,16 +35,16 @@ import java.util.List;
  */
 public class MultipleFileUploadUsingListAction extends ActionSupport {
 
-	private List<File> uploads = new ArrayList<File>();
-	private List<String> uploadFileNames = new ArrayList<String>();
-	private List<String> uploadContentTypes = new ArrayList<String>();
+	private List<UploadedFile> uploads = new ArrayList<>();
+	private List<String> uploadFileNames = new ArrayList<>();
+	private List<String> uploadContentTypes = new ArrayList<>();
 
 
-	public List<File> getUpload() {
+	public List<UploadedFile> getUpload() {
 		return this.uploads;
 	}
 
-	public void setUpload(List<File> uploads) {
+	public void setUpload(List<UploadedFile> uploads) {
 		this.uploads = uploads;
 	}
 
@@ -67,7 +68,7 @@ public class MultipleFileUploadUsingListAction extends ActionSupport {
 
 		System.out.println("\n\n upload1");
 		System.out.println("files:");
-		for (File u : uploads) {
+		for (UploadedFile u : uploads) {
 			System.out.println("*** " + u + "\t" + u.length());
 		}
 		System.out.println("filenames:");


Mime
View raw message