[struts] branch WW-5273-servlet-upload created (now f92e3b945)

2022-12-29 Thread lukaszlenart
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


  at f92e3b945 WW-5273 Supports file upload using Servlet API 3.1

This branch includes the following new commits:

 new f92e3b945 WW-5273 Supports file upload using Servlet API 3.1

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.




[struts] 01/01: WW-5273 Supports file upload using Servlet API 3.1

2022-12-29 Thread lukaszlenart
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 f92e3b945dd69d18034c6aa09ad6dcbec128f1fc
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  |   4 +-
 .../dispatcher/filter/FileUploadSupport.java   |  65 ++
 .../dispatcher/filter/StrutsExecuteFilter.java |  17 +-
 .../filter/StrutsPrepareAndExecuteFilter.java  |   7 +-
 .../dispatcher/filter/StrutsPrepareFilter.java |   1 +
 .../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, 597 insertions(+), 65 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..be1dba13c 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
@@ -941,7 +941,7 @@ public class Dispatcher {
  * @return false if disabled
  * @since 2.5.11
  */
-protected boolean isMultipartSupportEnabled(HttpServletRequest request) {
+public boolean isMultipartSupportEnabled(HttpServletRequest request) {
 return multipartSupportEnabled;
 }
 
@@ -952,7 +952,7 @@ public class Dispatcher {
  * @return true if it is a multipart request
  * @since 2.5.11
  */
-protected boolean isMultipartRequest(HttpServletRequest request) {
+public boolean isMultipartRequest(HttpServletRequest request) {
 String httpMethod = request.getMethod();
 String contentType = request.getContentType();
 
diff --git 
a/core/src/main/java/org/apache/struts2/dispatcher/filter/FileUploadSupport.java
 
b/core/src/main/java/org/apache/struts2/dispatcher/filter/FileUploadSupport.java
new file mode 100644
index 0..5c245ace2
--- /dev/null
+++ 
b/core/src/main/java/or

[struts] branch WW-5273-servlet-upload updated (f92e3b945 -> 99e3992ed)

2022-12-29 Thread lukaszlenart
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 f92e3b945 WW-5273 Supports file upload using Servlet API 3.1
 new 99e3992ed 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   (f92e3b945)
\
 N -- N -- N   refs/heads/WW-5273-servlet-upload (99e3992ed)

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:
 .../java/org/apache/struts2/dispatcher/filter/StrutsPrepareFilter.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)



[struts] 01/01: WW-5273 Supports file upload using Servlet API 3.1

2022-12-29 Thread lukaszlenart
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 99e3992ed27bdbb82a902537ae9df07e7d65a9c1
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  |   4 +-
 .../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, 597 insertions(+), 66 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..be1dba13c 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
@@ -941,7 +941,7 @@ public class Dispatcher {
  * @return false if disabled
  * @since 2.5.11
  */
-protected boolean isMultipartSupportEnabled(HttpServletRequest request) {
+public boolean isMultipartSupportEnabled(HttpServletRequest request) {
 return multipartSupportEnabled;
 }
 
@@ -952,7 +952,7 @@ public class Dispatcher {
  * @return true if it is a multipart request
  * @since 2.5.11
  */
-protected boolean isMultipartRequest(HttpServletRequest request) {
+public boolean isMultipartRequest(HttpServletRequest request) {
 String httpMethod = request.getMethod();
 String contentType = request.getContentType();
 
diff --git 
a/core/src/main/java/org/apache/struts2/dispatcher/filter/FileUploadSupport.java
 
b/core/src/main/java/org/apache/struts2/dispatcher/filter/FileUploadSupport.java
new file mode 100644
index 0..5c245ace2
--- /dev/null
+++ 
b/core/src/main/java/o

[struts] branch WW-5272-time updated (df110596c -> 08de24588)

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

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


omit df110596c WW-5272 Extends  to support java.sql.Time
 new 08de24588 WW-5272 Extends  to support java.sql.Time

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   (df110596c)
\
 N -- N -- N   refs/heads/WW-5272-time (08de24588)

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/components/date/SimpleDateFormatAdapter.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



[struts] 01/01: WW-5272 Extends to support java.sql.Time

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

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

commit 08de24588ad5b88ec3554b476c9d3cf0fb47b32c
Author: Lukasz Lenart 
AuthorDate: Wed Dec 28 10:13:04 2022 +0100

WW-5272 Extends  to support java.sql.Time
---
 .../java/org/apache/struts2/components/Date.java   |  5 +++-
 .../components/date/SimpleDateFormatAdapter.java   |  2 +-
 .../org/apache/struts2/components/DateTest.java| 32 --
 3 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/core/src/main/java/org/apache/struts2/components/Date.java 
b/core/src/main/java/org/apache/struts2/components/Date.java
index 7a8cda061..de640cbda 100644
--- a/core/src/main/java/org/apache/struts2/components/Date.java
+++ b/core/src/main/java/org/apache/struts2/components/Date.java
@@ -32,6 +32,7 @@ import java.io.Writer;
 import java.time.Instant;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
+import java.time.LocalTime;
 import java.time.ZoneId;
 import java.time.ZonedDateTime;
 import java.util.ArrayList;
@@ -294,7 +295,9 @@ public class Date extends ContextBean {
 // find the name on the valueStack
 Object dateObject = findValue(name);
 if (dateObject instanceof java.sql.Date) {
-date = ((java.sql.Date) dateObject).toLocalDate().atStartOfDay(tz);
+date = ((java.sql.Date) 
dateObject).toLocalDate().atTime(LocalTime.now(tz)).atZone(tz);
+} else if (dateObject instanceof java.sql.Time) {
+date = ((java.sql.Time) 
dateObject).toLocalTime().atDate(ZonedDateTime.now(tz).toLocalDate()).atZone(tz);
 } else if (dateObject instanceof java.util.Date) {
 date = ((java.util.Date) dateObject).toInstant().atZone(tz);
 } else if (dateObject instanceof Calendar) {
diff --git 
a/core/src/main/java/org/apache/struts2/components/date/SimpleDateFormatAdapter.java
 
b/core/src/main/java/org/apache/struts2/components/date/SimpleDateFormatAdapter.java
index 38f3c5296..b7cf5441a 100644
--- 
a/core/src/main/java/org/apache/struts2/components/date/SimpleDateFormatAdapter.java
+++ 
b/core/src/main/java/org/apache/struts2/components/date/SimpleDateFormatAdapter.java
@@ -34,7 +34,7 @@ public class SimpleDateFormatAdapter implements DateFormatter 
{
 DateFormat df;
 Locale locale = ActionContext.getContext().getLocale();
 if (format == null) {
-df = SimpleDateFormat.getDateInstance(DateFormat.MEDIUM, locale);
+df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, 
DateFormat.MEDIUM, locale);
 } else {
 df = new SimpleDateFormat(format, locale);
 }
diff --git a/core/src/test/java/org/apache/struts2/components/DateTest.java 
b/core/src/test/java/org/apache/struts2/components/DateTest.java
index ffe01a52a..477b128a6 100644
--- a/core/src/test/java/org/apache/struts2/components/DateTest.java
+++ b/core/src/test/java/org/apache/struts2/components/DateTest.java
@@ -66,7 +66,7 @@ public class DateTest extends StrutsInternalTestCase {
 
 java.util.Date now = new java.util.Date();
 
-String expected = SimpleDateFormat.getDateInstance(DateFormat.MEDIUM, 
ActionContext.getContext().getLocale()).format(now);
+String expected = prepareFormat().format(now);
 context.put("myDate", now);
 
 Writer writer = new StringWriter();
@@ -88,7 +88,7 @@ public class DateTest extends StrutsInternalTestCase {
 
 java.sql.Date now = new java.sql.Date(System.currentTimeMillis());
 
-String expected = SimpleDateFormat.getDateInstance(DateFormat.MEDIUM, 
ActionContext.getContext().getLocale()).format(now);
+String expected = prepareFormat().format(now);
 context.put("myDate", now);
 
 Writer writer = new StringWriter();
@@ -103,6 +103,34 @@ public class DateTest extends StrutsInternalTestCase {
 assertEquals(expected, writer.toString());
 }
 
+public void testJavaSqlTime() {
+// given
+Date date = new Date(stack);
+date.setDateFormatter(new SimpleDateFormatAdapter());
+
+java.sql.Time now = new java.sql.Time(System.currentTimeMillis());
+
+String timeFormat = "hh:mm:ss";
+String expected = new SimpleDateFormat(timeFormat, 
ActionContext.getContext().getLocale()).format(now);
+context.put("myDate", now);
+
+Writer writer = new StringWriter();
+
+// when
+date.setName("myDate");
+date.setNice(false);
+date.setFormat(timeFormat);
+date.start(writer);
+date.end(writer, "");
+
+// then
+assertEquals(expected, writer.toString());
+}
+
+private DateFormat prepareFormat() {
+return SimpleDateFormat.getDateTimeInstance(DateFormat.MEDIUM, 
DateFormat.MEDIUM, ActionContext.getContext().getLocale());
+}
+
 @Override
 public void setUp() t