(struts-site) 01/01: Merge pull request #223 from apache/feature/WW-5371-modern-upload

2024-01-12 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/struts-site.git

commit 435c0ab18f085f2ab7b322c4cd908ff6dc4cd45c
Merge: 94cb2fc55 22ec7b89c
Author: Lukasz Lenart 
AuthorDate: Fri Jan 12 13:24:03 2024 +0100

Merge pull request #223 from apache/feature/WW-5371-modern-upload

[WW-5371] Documents new Action File Upload Interceptor

 ...ceptor.md => action-file-upload-interceptor.md} |  71 -
 source/core-developers/file-upload-interceptor.md  |   4 +-
 source/core-developers/file-upload.md  |  50 ++-
 source/core-developers/interceptors.md | 163 -
 source/download.html   |   2 +-
 5 files changed, 167 insertions(+), 123 deletions(-)



(struts-site) branch master updated (94cb2fc55 -> 435c0ab18)

2024-01-12 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/struts-site.git


from 94cb2fc55 Merge pull request #222 from 
apache/WW-5378-WW-5381-context-ext
 add 0e928cf9a WW-5371 Documents new Action File Upload Interceptor
 add 5f6ecdf1d WW-5371 Fixes example code
 add 22ec7b89c WW-5371 Addresses a typo and rephrases it
 new 435c0ab18 Merge pull request #223 from 
apache/feature/WW-5371-modern-upload

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 ...ceptor.md => action-file-upload-interceptor.md} |  71 -
 source/core-developers/file-upload-interceptor.md  |   4 +-
 source/core-developers/file-upload.md  |  50 ++-
 source/core-developers/interceptors.md | 163 -
 source/download.html   |   2 +-
 5 files changed, 167 insertions(+), 123 deletions(-)
 copy source/core-developers/{file-upload-interceptor.md => 
action-file-upload-interceptor.md} (68%)



(struts-site) branch feature/WW-5371-modern-upload deleted (was 22ec7b89c)

2024-01-12 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a change to branch feature/WW-5371-modern-upload
in repository https://gitbox.apache.org/repos/asf/struts-site.git


 was 22ec7b89c WW-5371 Addresses a typo and rephrases it

The revisions that were on this branch are still contained in
other references; therefore, this change does not discard any commits
from the repository.



(struts-site) branch asf-site updated: Automatic Site Publish by Buildbot

2024-01-12 Thread git-site-role
This is an automated email from the ASF dual-hosted git repository.

git-site-role pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/struts-site.git


The following commit(s) were added to refs/heads/asf-site by this push:
 new a8af3573b Automatic Site Publish by Buildbot
a8af3573b is described below

commit a8af3573b7e5e95eb9f0c40cdf6ab45d6b36594d
Author: buildbot 
AuthorDate: Fri Jan 12 12:24:37 2024 +

Automatic Site Publish by Buildbot
---
 ...or.html => action-file-upload-interceptor.html} |  77 
 .../core-developers/file-upload-interceptor.html   |   6 +-
 output/core-developers/file-upload.html|  48 -
 output/core-developers/interceptors.html   | 194 +++--
 output/download.html   |   2 +-
 5 files changed, 182 insertions(+), 145 deletions(-)

diff --git a/output/core-developers/file-upload-interceptor.html 
b/output/core-developers/action-file-upload-interceptor.html
similarity index 77%
copy from output/core-developers/file-upload-interceptor.html
copy to output/core-developers/action-file-upload-interceptor.html
index 800fd990d..310dffc9d 100644
--- a/output/core-developers/file-upload-interceptor.html
+++ b/output/core-developers/action-file-upload-interceptor.html
@@ -7,7 +7,7 @@
   
   
 
-  File Upload Interceptor
+  Action File Upload Interceptor
 
   
   
@@ -146,25 +146,21 @@
 
 
   
-https://github.com/apache/struts-site/edit/master/source/core-developers/file-upload-interceptor.md";
 title="Edit this page on GitHub">Edit on GitHub
+https://github.com/apache/struts-site/edit/master/source/core-developers/action-file-upload-interceptor.md";
 title="Edit this page on GitHub">Edit on GitHub
 
-<< back to 
Interceptors
+<< back to 
Interceptors
 
-File Upload Interceptor
+Action File Upload Interceptor
+
+
+  Available since Struts 6.4.0 as replacement for File Upload Interceptor
+
 
 See this page for more examples and advanced 
configuration.
 
 Interceptor that is based off of MultiPartRequestWrapper, which is automatically 
applied for any request that includes 
-a file. It adds the following parameters, where  is the 
name given to the file uploaded by the HTML form:
-
-
-  : File 
- the actual File
-  ContentType: String - the content type of the file
-  FileName: String - the actual name of the file uploaded (not 
the HTML name)
-
-
-You can get access to these files by merely providing setters in your 
action that correspond to any of the three patterns 
-above, such as setDocument(File document), setDocumentContentType(String 
contentType), etc.
+a file. If an action implements org.apache.struts2.action.UploadedFilesAware 
interface, the interceptor will pass
+information and content of uploaded files using the callback method withUploadedFiles(List).
 
 See the example code section.
 
@@ -203,7 +199,7 @@ and which are not.
 Example action mapping:
 
  
- 
+ 
  
  good_result.jsp
  
@@ -225,34 +221,27 @@ and which are not.
 
 Example Action class:
 
-package com.example;
-
-import java.io.File;
-import com.opensymphony.xwork2.ActionSupport;
-
-public UploadAction extends ActionSupport {
-   private File file;
-   private String contentType;
-   private String filename;
-
-   public void setUpload(File 
file) {
-  this.file = file;
-   }
-
-   public void setUploadContentType(String contentType) {
-  this.contentType = contentType;
-   }
-
-   public void setUploadFileName(String filename) {
-  this.filename = filename;
-   }
-
-   public String execute() {
-  //...
-  return SUCCESS;
-   }
-  }
-
+public class UploadAction extends ActionSupport implements UploadedFilesAware {
+   private UploadedFile uploadedFile;
+   private String contentType;
+   private String fileName;
+   private String originalName;
+
+   @Override
+   public void withUploadedFiles(List uploadedFiles) {
+  if (!uploadedFiles.isEmpty()) {
+ this.uploadedFile = uploadedFiles.get(0);
+ this.fileName = uploadedFile.getName();
+ this.contentType = uploadedFile.getContentType();
+ this.originalName = uploadedFile.getOriginalName();
+  }
+   }
+
+   public String execute() {
+  //do something with the file
+  return SUCCESS;
+   }
+}
 
 
 Setting parameters example:
@@ -264,7 +253,7 @@ and which are not.
 
 
 
-This part is optional and would be done in place of the  line in the action mapping 
+This part is optional and would be done in place of the 

(struts-site) branch asf-staging updated: Updates stage by Jenkins

2024-01-12 Thread git-site-role
This is an automated email from the ASF dual-hosted git repository.

git-site-role pushed a commit to branch asf-staging
in repository https://gitbox.apache.org/repos/asf/struts-site.git


The following commit(s) were added to refs/heads/asf-staging by this push:
 new f7ec55ec6 Updates stage by Jenkins
f7ec55ec6 is described below

commit f7ec55ec6fcf3ccf7177a8dbc643625a40165740
Author: jenkins 
AuthorDate: Fri Jan 12 12:27:40 2024 +

Updates stage by Jenkins