[struts] 01/01: WW-5273 Supports file upload using Servlet API 3.1
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch WW-5273-servlet-upload in repository https://gitbox.apache.org/repos/asf/struts.git commit bfa4c090a97f4ad644a4d125e0178dd77fc85d28 Author: Lukasz Lenart AuthorDate: Thu Dec 29 10:36:45 2022 +0100 WW-5273 Supports file upload using Servlet API 3.1 --- apps/showcase/{README.txt => README.md}| 11 +- apps/showcase/pom.xml | 4 - apps/showcase/src/main/webapp/WEB-INF/web.xml | 12 + .../org/apache/struts2/dispatcher/Dispatcher.java | 33 ++- .../dispatcher/filter/FileUploadSupport.java | 65 ++ .../dispatcher/filter/StrutsExecuteFilter.java | 17 +- .../filter/StrutsPrepareAndExecuteFilter.java | 7 +- .../dispatcher/filter/StrutsPrepareFilter.java | 2 +- .../multipart/AbstractMultiPartRequest.java| 6 +- .../multipart/JakartaMultiPartRequest.java | 2 + .../multipart/JakartaStreamMultiPartRequest.java | 2 + .../dispatcher/multipart/MultiPartRequest.java | 8 +- .../multipart/ServletMultiPartRequest.java | 246 + .../dispatcher/servlet/FileUploadServlet.java | 74 +++ .../struts2/interceptor/FileUploadInterceptor.java | 15 +- .../org/apache/struts2/default.properties | 2 +- core/src/main/resources/struts-beans.xml | 2 + ...rutsPrepareAndExecuteFilterIntegrationTest.java | 31 ++- .../dispatcher/TwoFilterIntegrationTest.java | 55 +++-- .../multipart/ServletMultiPartRequestTest.java | 78 +++ .../interceptor/FileUploadInterceptorTest.java | 20 +- 21 files changed, 609 insertions(+), 83 deletions(-) diff --git a/apps/showcase/README.txt b/apps/showcase/README.md similarity index 74% rename from apps/showcase/README.txt rename to apps/showcase/README.md index 8e6cbb03c..a1b828042 100644 --- a/apps/showcase/README.txt +++ b/apps/showcase/README.md @@ -1,14 +1,11 @@ -README.txt - showcase +# Showcase App -Showcase is a collection of examples with code that you might be adopt and -adapt in your own applications. +Showcase is a collection of examples with code that you might be adopted and adapt in your own applications. -For more on getting started with Struts, see +For more on getting started with Struts, see https://struts.apache.org/getting-started/ -* http://cwiki.apache.org/WW/home.html +## I18N -I18N: -= Please note that this project was created with the assumption that it will be run in an environment where the default locale is set to English. This means that the default messages defined in package.properties are in English. If the default diff --git a/apps/showcase/pom.xml b/apps/showcase/pom.xml index cc6d51d5e..9329b7968 100644 --- a/apps/showcase/pom.xml +++ b/apps/showcase/pom.xml @@ -140,10 +140,6 @@ org.directwebremoting dwr - -commons-fileupload -commons-fileupload - junit diff --git a/apps/showcase/src/main/webapp/WEB-INF/web.xml b/apps/showcase/src/main/webapp/WEB-INF/web.xml index 1bcfa4184..63059a08b 100644 --- a/apps/showcase/src/main/webapp/WEB-INF/web.xml +++ b/apps/showcase/src/main/webapp/WEB-INF/web.xml @@ -114,6 +114,12 @@ 1 + +fileUploadServlet + org.apache.struts2.dispatcher.servlet.FileUploadServlet +2 + + strutsServlet org.apache.struts2.dispatcher.servlet.StrutsServlet @@ -142,6 +148,12 @@ 4 + +fileUploadServlet +/fileupload/* +/tags/ui/* + + dwr /dwr/* diff --git a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java index 43794c1c5..cd2aa9572 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java @@ -112,12 +112,12 @@ public class Dispatcher { /** * Provide a thread local instance. */ -private static ThreadLocal instance = new ThreadLocal<>(); +private static final ThreadLocal instance = new ThreadLocal<>(); /** * Store list of DispatcherListeners. */ -private static List dispatcherListeners = new CopyOnWriteArrayList<>(); +private static final List dispatcherListeners = new CopyOnWriteArrayList<>(); /** * Store state of StrutsConstants.STRUTS_DEVMODE setting. @@ -140,7 +140,7 @@ public class Dispatcher { private String defaultLocale; /** - * Store state of StrutsConstants.STRUTS_MULTIPART_SAVEDIR setting. + * Store state of {@link StrutsConstants#STRUTS_MULTIPART_SAVEDIR} setting. */ private String multipartSaveDir; @@ -399,6 +399,7 @@ public class Dispatcher { private void init_FileManager() throws ClassNotFoundException {
[struts] branch WW-5273-servlet-upload updated (99e3992ed -> bfa4c090a)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch WW-5273-servlet-upload in repository https://gitbox.apache.org/repos/asf/struts.git discard 99e3992ed WW-5273 Supports file upload using Servlet API 3.1 new bfa4c090a WW-5273 Supports file upload using Servlet API 3.1 This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (99e3992ed) \ N -- N -- N refs/heads/WW-5273-servlet-upload (bfa4c090a) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. 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: .../org/apache/struts2/dispatcher/Dispatcher.java | 29 +- 1 file changed, 12 insertions(+), 17 deletions(-)
[struts] branch WW-5273-servlet-upload updated (bfa4c090a -> a75934a9f)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch WW-5273-servlet-upload in repository https://gitbox.apache.org/repos/asf/struts.git discard bfa4c090a WW-5273 Supports file upload using Servlet API 3.1 new a75934a9f WW-5273 Supports file upload using Servlet API 3.1 This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (bfa4c090a) \ N -- N -- N refs/heads/WW-5273-servlet-upload (a75934a9f) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. 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: apps/showcase/src/main/resources/struts.xml| 2 ++ .../dispatcher/filter/FileUploadSupport.java | 30 +++--- .../dispatcher/filter/StrutsExecuteFilter.java | 2 +- .../filter/StrutsPrepareAndExecuteFilter.java | 2 +- .../multipart/ServletMultiPartRequest.java | 10 .../dispatcher/servlet/FileUploadServlet.java | 9 ++- .../org/apache/struts2/default.properties | 9 --- 7 files changed, 42 insertions(+), 22 deletions(-)
[struts] 01/01: WW-5273 Supports file upload using Servlet API 3.1
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch WW-5273-servlet-upload in repository https://gitbox.apache.org/repos/asf/struts.git commit a75934a9ff3e589ee382a624a5432981f772cb51 Author: Lukasz Lenart AuthorDate: Thu Dec 29 10:36:45 2022 +0100 WW-5273 Supports file upload using Servlet API 3.1 --- apps/showcase/{README.txt => README.md}| 11 +- apps/showcase/pom.xml | 4 - apps/showcase/src/main/resources/struts.xml| 2 + apps/showcase/src/main/webapp/WEB-INF/web.xml | 12 + .../org/apache/struts2/dispatcher/Dispatcher.java | 33 ++- .../dispatcher/filter/FileUploadSupport.java | 65 ++ .../dispatcher/filter/StrutsExecuteFilter.java | 17 +- .../filter/StrutsPrepareAndExecuteFilter.java | 7 +- .../dispatcher/filter/StrutsPrepareFilter.java | 2 +- .../multipart/AbstractMultiPartRequest.java| 6 +- .../multipart/JakartaMultiPartRequest.java | 2 + .../multipart/JakartaStreamMultiPartRequest.java | 2 + .../dispatcher/multipart/MultiPartRequest.java | 8 +- .../multipart/ServletMultiPartRequest.java | 256 + .../dispatcher/servlet/FileUploadServlet.java | 81 +++ .../struts2/interceptor/FileUploadInterceptor.java | 15 +- .../org/apache/struts2/default.properties | 7 +- core/src/main/resources/struts-beans.xml | 2 + ...rutsPrepareAndExecuteFilterIntegrationTest.java | 31 ++- .../dispatcher/TwoFilterIntegrationTest.java | 55 +++-- .../multipart/ServletMultiPartRequestTest.java | 78 +++ .../interceptor/FileUploadInterceptorTest.java | 20 +- 22 files changed, 631 insertions(+), 85 deletions(-) diff --git a/apps/showcase/README.txt b/apps/showcase/README.md similarity index 74% rename from apps/showcase/README.txt rename to apps/showcase/README.md index 8e6cbb03c..a1b828042 100644 --- a/apps/showcase/README.txt +++ b/apps/showcase/README.md @@ -1,14 +1,11 @@ -README.txt - showcase +# Showcase App -Showcase is a collection of examples with code that you might be adopt and -adapt in your own applications. +Showcase is a collection of examples with code that you might be adopted and adapt in your own applications. -For more on getting started with Struts, see +For more on getting started with Struts, see https://struts.apache.org/getting-started/ -* http://cwiki.apache.org/WW/home.html +## I18N -I18N: -= Please note that this project was created with the assumption that it will be run in an environment where the default locale is set to English. This means that the default messages defined in package.properties are in English. If the default diff --git a/apps/showcase/pom.xml b/apps/showcase/pom.xml index cc6d51d5e..9329b7968 100644 --- a/apps/showcase/pom.xml +++ b/apps/showcase/pom.xml @@ -140,10 +140,6 @@ org.directwebremoting dwr - -commons-fileupload -commons-fileupload - junit diff --git a/apps/showcase/src/main/resources/struts.xml b/apps/showcase/src/main/resources/struts.xml index cb47af8bf..ad71e9fdb 100644 --- a/apps/showcase/src/main/resources/struts.xml +++ b/apps/showcase/src/main/resources/struts.xml @@ -44,6 +44,8 @@ + + diff --git a/apps/showcase/src/main/webapp/WEB-INF/web.xml b/apps/showcase/src/main/webapp/WEB-INF/web.xml index 1bcfa4184..63059a08b 100644 --- a/apps/showcase/src/main/webapp/WEB-INF/web.xml +++ b/apps/showcase/src/main/webapp/WEB-INF/web.xml @@ -114,6 +114,12 @@ 1 + +fileUploadServlet + org.apache.struts2.dispatcher.servlet.FileUploadServlet +2 + + strutsServlet org.apache.struts2.dispatcher.servlet.StrutsServlet @@ -142,6 +148,12 @@ 4 + +fileUploadServlet +/fileupload/* +/tags/ui/* + + dwr /dwr/* diff --git a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java index 43794c1c5..cd2aa9572 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java @@ -112,12 +112,12 @@ public class Dispatcher { /** * Provide a thread local instance. */ -private static ThreadLocal instance = new ThreadLocal<>(); +private static final ThreadLocal instance = new ThreadLocal<>(); /** * Store list of DispatcherListeners. */ -private static List dispatcherListeners = new CopyOnWriteArrayList<>(); +private static final List dispatcherListeners = new CopyOnWriteArrayList<>(); /** * Store state of StrutsConstants.STRUTS_DEVMODE setting. @@ -140,7 +140,7 @@ public class Dispatcher { private Stri