Compare commits

..

169 Commits

Author SHA1 Message Date
Lukasz Lenart 4acb0d16da [maven-release-plugin] prepare release STRUTS_7_0_0_M5 2024-04-19 20:59:51 +02:00
Lukasz Lenart ce7671568b Fixes after merge assembly issue 2024-04-19 20:52:19 +02:00
Lukasz Lenart 8b9173469c [maven-release-plugin] prepare for next development iteration 2024-04-19 08:38:28 +02:00
Lukasz Lenart aca2eb07ef [maven-release-plugin] prepare release STRUTS_7_0_0_M4 2024-04-19 08:38:19 +02:00
Lukasz Lenart 964590c9a9 Merge pull request #904 from apache/merge/master-to-7xx-2024-04-07
[2024-04-07] Merge master branch into 7.x.x
2024-04-19 08:24:10 +02:00
Lukasz Lenart e5e6145c36 Merge remote-tracking branch 'origin/master' into merge/master-to-7xx-2024-04-07
# Conflicts:
#	pom.xml
2024-04-07 07:58:50 +02:00
Lukasz Lenart 4939d3cef8 Merge pull request #893 from gregh3269/fix-STRUTS_7_0_0_M3-upload-file-name
Fix original file upload to use actual file name rather than uploadxxx.tmp
2024-03-08 09:05:41 +01:00
Greg Huber ca5e82309c Fix file upload to use actual file name rather than uploadxxx.tmp 2024-03-07 06:08:31 +00:00
Lukasz Lenart d3727070b8 [maven-release-plugin] prepare for next development iteration 2024-02-24 09:22:43 +01:00
Lukasz Lenart a35cfebf5a [maven-release-plugin] prepare release STRUTS_7_0_0_M3 2024-02-24 09:22:32 +01:00
Lukasz Lenart c5d760ce58 Merge pull request #877 from apache/merge-master-to-7xx-2024-02-16
Merge master to 7-x-x 2024-02-16
2024-02-21 08:05:18 +01:00
Lukasz Lenart 45b06dd69c Merge remote-tracking branch 'origin/master' into merge-master-to-7xx-2024-02-16
# Conflicts:
#	plugins/osgi/src/main/java/org/apache/struts2/osgi/OsgiConfigurationProvider.java
#	plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletVelocityResult.java
#	plugins/sitemesh/src/main/java/org/apache/struts2/sitemesh/OldDecorator2NewStrutsVelocityDecorator.java
#	plugins/sitemesh/src/main/java/org/apache/struts2/sitemesh/VelocityDecoratorServlet.java
#	plugins/sitemesh/src/main/java/org/apache/struts2/sitemesh/VelocityPageFilter.java
#	pom.xml
2024-02-16 09:27:16 +01:00
Lukasz Lenart 7edcac886b Merge pull request #873 from apache/fix/WW-5388-fileupload
[WW-5388] Fixes a few issues in Servlet 6 file upload usage
2024-02-14 17:09:07 +01:00
Lukasz Lenart f913c407e9 WW-5388 Fixes a few issues in Servlet 6 file upload usage
- removes duplicated validation messages where both interceptors have been used
- defines a proper error message on a general file upload exception
- removes generic definition in tests
2024-02-11 11:21:29 +01:00
Lukasz Lenart d384c824bd Merge pull request #870 from sepe81/feature/update-log42j-for-java-version-after-8
[WW-5384] Update log4j2 to 2.22.1 and [WW-5393] caffeine to 3.1.8 including error_prone_annotations > 2.10.0 which depends on Java 11
2024-02-09 07:14:46 +01:00
Sebastian Peters d1413b01c0 Override version of error_prone_annotations
until caffeine updates from 2.10.0 to 2.23.0
2024-02-08 22:16:29 +01:00
Sebastian Peters f8fcdbde50 [WW-5393] Update caffeine to 3.1.8 2024-02-08 22:16:11 +01:00
Sebastian Peters ade8af3772 [WW-5384] Update log4j2 to 2.22.1
and error_prone_annotations > 2.10.0 which depends on Java 11
2024-02-05 11:28:36 +01:00
Sebastian Peters caa34a4972 Update log4j2 to 2.21.1
(cherry picked from commit fd2cf91601)
2024-02-05 11:26:30 +01:00
Lukasz Lenart e6d1f59de7 Merge pull request #869 from apache/fix/temp-folder
Fixes problem with failing file upload tests
2024-02-05 08:55:54 +01:00
Lukasz Lenart 9afb24bdac Ensures if temp folder is writable 2024-02-05 08:06:58 +01:00
Lukasz Lenart f0db577e99 Merge pull request #868 from apache/fix/WW-5390-assembly
[WW-5390] Fixes generating assemblies during release process
2024-02-05 07:09:33 +01:00
Lukasz Lenart 245eb90aa8 WW-5390 Fixes generating assemblies during release process 2024-02-03 18:09:36 +01:00
Lukasz Lenart 737542a031 [maven-release-plugin] prepare for next development iteration 2024-02-01 10:39:59 +01:00
Lukasz Lenart 6db4c5150e [maven-release-plugin] prepare release STRUTS_7_0_0_M2 2024-02-01 10:39:50 +01:00
Lukasz Lenart 9a30a9f955 Merge pull request #866 from apache/merge-master-to-7xx-2024-02-01
Merge master into 7-0-x branch - 2024-02-01
2024-02-01 10:24:30 +01:00
Lukasz Lenart 11d84a26c3 Merge remote-tracking branch 'origin/master' into merge-master-to-7xx-2024-02-01
# Conflicts:
#	Jenkinsfile
#	core/src/main/java/org/apache/struts2/views/jsp/ComponentTagSupport.java
#	core/src/test/java/org/apache/struts2/views/jsp/IteratorTagTest.java
#	pom.xml
2024-02-01 10:02:43 +01:00
Lukasz Lenart 84d350dace Merge pull request #861 from apache/feature/WW-5388-upload-servlet6
[WW-5388] Uses the latest JakartaEE FileUpload Servlet 6 package
2024-02-01 09:23:26 +01:00
Lukasz Lenart e9e3c0a252 WW-5388 Adds dedicated integration test to cover max size upload 2024-01-31 09:45:22 +01:00
Lukasz Lenart d024ccdd5f WW-5388 Extracts method to read charset 2024-01-30 09:53:51 +01:00
Lukasz Lenart e2215c852d WW-5388 Introduces new constant to allow control max number of files 2024-01-29 19:08:56 +01:00
Lukasz Lenart e635b5973a WW-5388 Test multi-files and fields 2024-01-28 10:00:21 +01:00
Lukasz Lenart 51bf8de716 WW-5388 Uses temp directory to avoid problems on Jenkins 2024-01-28 09:47:23 +01:00
Lukasz Lenart d07792a40a WW-5388 Drops unused defaultLocale 2024-01-28 07:36:59 +01:00
Lukasz Lenart 3294ed08d1 WW-5388 Adds tests per each Jakarta parser 2024-01-27 11:20:30 +01:00
Lukasz Lenart c37a6edb62 WW-5388 Avoids unconditional invocations of method in logs 2024-01-25 06:42:02 +01:00
Lukasz Lenart ac9b9ad89d WW-5388 Simplifies code 2024-01-24 21:40:15 +01:00
Lukasz Lenart b68b6ab7c6 WW-5388 Updates tests to match new logic 2024-01-24 21:20:18 +01:00
Lukasz Lenart 8c161f431d WW-5388 Uses the latest JakartaEE FileUpload Servlet 6 package
Also refactors the Jakarta based parsers as they have a lot in common
2024-01-24 09:09:56 +01:00
Lukasz Lenart 77acd665ef Merge pull request #851 from sepe81/feature/upgrade-maven-to-3.9.6
Upgrade maven to 3.9.6 and wrapper to 3.2.0
2024-01-21 07:45:24 +01:00
Sebastian Peters 54a7c7094f Upgrade maven to 3.9.6 and wrapper to 3.2.0
* `mvn wrapper:wrapper -Dmaven=3.9.6`
* remove outdated MavenWrapperDownloader from takari
* remove duplicate definition for maven-wrapper-plugin
  b/c it is already defined under pluginManagement
2024-01-20 23:25:52 +01:00
Lukasz Lenart 00533db153 [maven-release-plugin] prepare for next development iteration 2024-01-20 11:39:08 +01:00
Lukasz Lenart cd3389ab35 [maven-release-plugin] prepare release STRUTS_7_0_0_M1 2024-01-20 11:38:59 +01:00
Lukasz Lenart 7c375cd0b5 Configures source-release assembly
https://maven.apache.org/apache-resource-bundles/source-release/
2024-01-20 11:33:33 +01:00
Lukasz Lenart bfc5ddba22 Cleans up assembly definitions 2024-01-20 11:23:38 +01:00
Lukasz Lenart e7259ba001 Configure assembly plugin to use proper folders 2024-01-20 11:23:23 +01:00
Lukasz Lenart f055f4f67f Fixes wrong version in BOM 2024-01-20 10:53:57 +01:00
Lukasz Lenart 95ba165ffd Merge pull request #850 from apache/merge-master-to-7xx-2024-01-20
[Struts-7] Merge master to 7xx 2024-01-20
2024-01-20 09:39:51 +01:00
Lukasz Lenart 13bf91bf31 Merge remote-tracking branch 'origin/master' into merge-master-to-7xx-2024-01-20
# Conflicts:
#	Jenkinsfile
#	core/src/main/java/org/apache/struts2/dispatcher/MockDispatcher.java
#	core/src/main/java/org/apache/struts2/util/StrutsTestCaseHelper.java
#	core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java
#	plugins/dwr/src/main/java/org/apache/struts2/validators/DWRValidator.java
#	plugins/portlet/src/main/java/org/apache/struts2/portlet/PortletApplicationMap.java
#	plugins/portlet/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java
#	plugins/portlet/src/test/java/org/apache/struts2/StrutsTestCasePortletTests.java
#	plugins/sitemesh/src/main/java/org/apache/struts2/sitemesh/OldDecorator2NewStrutsDecorator.java
2024-01-20 09:29:05 +01:00
Lukasz Lenart 273eb1f6a9 Merge pull request #833 from apache/merge-master-to-7xx-2024-01-04
[Struts 7] Merge master to 7xx
2024-01-05 07:20:45 +01:00
Lukasz Lenart d8090ef9d8 Merge remote-tracking branch 'origin/master' into merge-master-to-7xx-2024-01-04
# Conflicts:
#	Jenkinsfile
#	bundles/admin/src/main/resources/osgi/admin/shell.ftl
#	bundles/admin/src/main/resources/osgi/admin/viewBundle.ftl
#	bundles/admin/src/main/resources/osgi/admin/viewBundles.ftl
#	plugins/velocity/src/main/java/org/apache/struts2/views/velocity/components/AbstractDirective.java
2024-01-04 10:21:52 +01:00
Lukasz Lenart 3af5818559 Merge pull request #827 from apache/feature/upgrade-mockito
Upgrades Mockito to ver 5.8.0
2024-01-02 10:39:31 +01:00
Kusal Kithul-Godage 89a4580f82 Upgrade Maven Surefire version 2024-01-02 19:39:42 +11:00
Kusal Kithul-Godage 59992ba015 Alphabetise dependency version props 2024-01-02 19:39:20 +11:00
Kusal Kithul-Godage 91fd7d0f20 Dependency manage byte-buddy 2024-01-02 18:19:02 +11:00
Lukasz Lenart 2246ea06cd Upgrades Mockito to ver 5.8.0 2024-01-01 10:53:38 +01:00
Lukasz Lenart 5d414d4a76 Merge pull request #810 from apache/feature/jakarta-modules
JakartaEE modules
2024-01-01 10:40:35 +01:00
Lukasz Lenart daf5b5055d Fixes typo in pom 2023-12-30 10:50:31 +01:00
Lukasz Lenart 26bb35e6c5 Moves JakartaEE related modules into dedicate subdirectory 2023-12-17 15:42:17 +01:00
Lukasz Lenart cd2bfee2d7 Merge pull request #809 from apache/fix/after-rebase
Rebase struts-7-0-x branch
2023-12-17 15:39:54 +01:00
Lukasz Lenart 660f5376e0 Fixes pipeline to properly handle transformed artifacts 2023-12-16 18:35:30 +01:00
Lukasz Lenart 51a173aa26 Upgrades Maven wrapper 2023-12-16 18:34:58 +01:00
Lukasz Lenart 576c064695 Replaces empty file upload test with simple one 2023-12-16 16:48:51 +01:00
Lukasz Lenart 938f8eadb9 Adds missing import 2023-12-16 16:22:15 +01:00
Kusal Kithul-Godage b087006a41 WW-5339 Add option to block custom OGNL maps 2023-12-16 16:14:08 +01:00
Lukasz Lenart 83874c3318 WW-5364 fixes automatically populated OGNL allowlist 2023-12-16 16:12:46 +01:00
Lukasz Lenart 31a582eee5 WW-5371 Migrates modern upload change to JakartaEE 2023-12-16 16:11:37 +01:00
Lukasz Lenart 19642a5e69 WW-5371 Migrates modern upload change to JakartaEE 2023-12-16 13:58:52 +01:00
Lukasz Lenart e0f77c11b5 WW-5370 Simplifies error handling logic 2023-12-16 11:23:45 +01:00
Lukasz Lenart 2009e58924 WW-5371 Document how to use the new file upload logic 2023-12-16 11:22:15 +01:00
Lukasz Lenart 7f4c37b86a WW-5371 Simplifies file upload logic and extracts constants 2023-12-16 11:21:59 +01:00
Lukasz Lenart 86d4a52017 WW-5371 Uses the new upload mechanism in Showcase app 2023-12-16 11:20:50 +01:00
Lukasz Lenart 94a4f559e9 WW-5371 Implements action based file upload 2023-12-16 11:18:45 +01:00
jdyer1 5e187ad12e WN-5141
- fix formatting issues, spurious comments, etc
- RuntimeException > UncheckedIOException
2023-12-16 11:12:00 +01:00
Lukasz Lenart 6ce1e9ea3e Upgrades Htmlunit to version 3.6.0 2023-12-16 11:11:56 +01:00
jdyer1 8b8de96b49 WN-5141 fix whitespace issues 2023-12-16 11:10:00 +01:00
Kusal Kithul-Godage 97dbdc1c90 Delete remaining deprecated plugins 2023-12-16 11:09:25 +01:00
Kusal Kithul-Godage a20d26fc3d Delete unused files missed in previous PR 2023-12-16 11:06:30 +01:00
James Dyer 0fa8cdd3e2 [WW-5141] Removes deprecated plugins (#798)
* WW-5141

- remove portlet

* WW-5141

- remove "pell multipart plugin"

* WW-5141

- remove code for "pell multipart plugin"

* WW-5141

-  remove dwr plugin

* WW-5141

- remove dwr plugin code

* WW-5141

- remove "dwr" from "struts-showcase"

* WW-5141

- remove references to "oval plugin" (removed)

* WW-5141

- remove dwr from struts-showcase
2023-12-16 11:05:57 +01:00
Lukasz Lenart e6e0577995 WW-5335 Reverts adding release/struts-7-0-x branch to scorecards analysis
Only the main branch is supported by this action
2023-12-16 11:04:23 +01:00
Lukasz Lenart 60794037dd WW-5335 Prepares for Java 17 & Struts 7.x 2023-12-16 11:04:19 +01:00
James Dyer 6f35c02fbf [WW-5141] Removes deprecated plugins (#798)
* WW-5141

- remove portlet

* WW-5141

- remove "pell multipart plugin"

* WW-5141

- remove code for "pell multipart plugin"

* WW-5141

-  remove dwr plugin

* WW-5141

- remove dwr plugin code

* WW-5141

- remove "dwr" from "struts-showcase"

* WW-5141

- remove references to "oval plugin" (removed)

* WW-5141

- remove dwr from struts-showcase
2023-12-16 11:03:47 +01:00
jdyer1 bed0db3470 WN-5141
- TODO: Ignore the "struts showcase file upload" test for now
2023-12-16 10:59:19 +01:00
jdyer1 b372ac9e9a WN-5141
- velocity and struts showcase
2023-12-16 10:59:19 +01:00
jdyer1 8cd0dc9cc1 Revert "WN-5141"
This reverts commit 4f9febb54d.
2023-12-16 10:59:19 +01:00
jdyer1 3f2b8c526b WN-5141
- fix formatting
2023-12-16 10:59:19 +01:00
jdyer1 e95a07fcf1 WN-5141
- velocity with showcase
2023-12-16 10:59:19 +01:00
jdyer1 c59ba68e11 WN-5141
- fix formatting tabs>spaces
2023-12-16 10:59:19 +01:00
jdyer1 eb4387521e Revert "WN-5141"
This reverts commit 1fc70af56b.
2023-12-16 10:59:18 +01:00
jdyer1 0e6d31729c WN-5141
- use eclipse transformer for Velocity Tools View and Velocity Tools View Jsp
2023-12-16 10:59:18 +01:00
jdyer1 94c166f228 Revert "WN-5141"
This reverts commit def5254a57.
2023-12-16 10:59:18 +01:00
jdyer1 147f0ca8a5 Revert "WN-5141"
This reverts commit 1c66e692cc.
2023-12-16 10:59:18 +01:00
jdyer1 71c2fe0ef9 Revert "WN-5141"
This reverts commit d5e766e43a.
2023-12-16 10:59:18 +01:00
jdyer1 1295c59456 WN-5141
- struts showcase fixes (still 1 test failure)
2023-12-16 10:59:18 +01:00
jdyer1 519b8bd98a WN-5141
- upgrade to latest jetty-maven plugin
- remove spurious jetty dependencies from parent pom
2023-12-16 10:59:18 +01:00
jdyer1 7d835bfa44 WN-5141
- fix license header
2023-12-16 10:59:17 +01:00
Lukasz Lenart 8c906f3c81 WW-5335 Reverts adding release/struts-7-0-x branch to scorecards analysis
Only the main branch is supported by this action
2023-12-16 10:59:17 +01:00
Lukasz Lenart 2fe7a91bdd WW-5335 Prepares for Java 17 & Struts 7.x 2023-12-16 10:59:12 +01:00
jdyer1 df56821abb WN-5141
- fix things broken with rebase
2023-12-16 10:57:08 +01:00
jdyer1 baddd368c4 WN-5141
- use 10.x version of tomcat jars
2023-12-16 10:57:07 +01:00
jdyer1 8b501aa212 WN-5141
- initial attempt to update references javax>jakarta and get things to compile
2023-12-16 10:57:07 +01:00
Lukasz Lenart b8d07f422b WW-5335 Reverts adding release/struts-7-0-x branch to scorecards analysis
Only the main branch is supported by this action
2023-12-16 10:57:07 +01:00
jdyer1 79138e1853 WW-5335 Prepares for Java 17 & Struts 7.x 2023-12-16 10:57:07 +01:00
jdyer1 d20972c13f WW-5141 fix formatting problems 2023-12-16 10:56:57 +01:00
jdyer1 6e76a3abc8 WN-5141
- use eclipse transformer on sitemesh2
2023-12-16 10:55:52 +01:00
jdyer1 72d07f838d WN-5141
- fix for IncludeTagTest
2023-12-16 10:55:52 +01:00
jdyer1 712fa7fba2 Revert "WN-5141"
This reverts commit deebfc3469.
2023-12-16 10:55:52 +01:00
jdyer1 e9c6ce0199 WN-5141
- try shade plugin
2023-12-16 10:55:51 +01:00
jdyer1 48b8a3b54f WN-5141
- pom corrections (compiles ok, however, eclipse IDE does not work)
2023-12-16 10:55:51 +01:00
jdyer1 38c51d255e WN-5141
- eclipse transformer for freemarker
2023-12-16 10:55:51 +01:00
jdyer1 d36a76c950 WN-5141
- update freemarker tests
2023-12-16 10:55:51 +01:00
jdyer1 730e5829d0 Revert "WN-5141"
This reverts commit cdb0820e63.
2023-12-16 10:55:51 +01:00
jdyer1 ec6c96e16c Revert "WN-5141"
This reverts commit b8b9f8aa37.
2023-12-16 10:55:51 +01:00
jdyer1 a9edf74798 Revert "WN-5141"
This reverts commit 8d3880a670.
2023-12-16 10:55:50 +01:00
jdyer1 bafcccc3bf Revert "WN-5141"
This reverts commit 8d465c66a8.
2023-12-16 10:55:50 +01:00
jdyer1 0b9ca66f50 Revert "WN-5141"
This reverts commit 1c43fd1dc7.
2023-12-16 10:55:50 +01:00
jdyer1 b52f18ced4 Revert "WN-5141"
This reverts commit 908d064839.
2023-12-16 10:55:50 +01:00
jdyer1 b365b58e36 WN-5141
- remove github check for Java 8 and Java 11
2023-12-16 10:55:50 +01:00
jdyer1 bd6f347dbf WN-5141
- remove references to "oval plugin" (removed)
2023-12-16 10:55:50 +01:00
jdyer1 06228a7297 WN-5141
- removal of "embedded jsp" plugin (deprecated)
2023-12-16 10:55:49 +01:00
Timothy Pace 2e0ba0873d WW-5141 conversion to fileupload2 2023-12-16 10:55:25 +01:00
jdyer1 72e1ff74fd WN-5141
- fix build to make assembly project happy with "releasability"
2023-12-16 10:49:51 +01:00
jdyer1 dba63742ab WN-5141
- remove "illegal-access=permit"; not available option with Java 17
2023-12-16 10:49:51 +01:00
jdyer1 ec8ac50b6f WN-5141
- REMOVE OVAL Plugin (deprecated) - requires javax.persistence, no newer relase of net.sf.oval avaiable
2023-12-16 10:49:51 +01:00
jdyer1 63828c0e8d WN-5141
- TODO:  TEMPORARY ignore "embedded jsp" test.  Classpath/tld issues?  Might be going away/
2023-12-16 10:49:51 +01:00
jdyer1 6c0a97cfa2 WN-5141
- fixes for "embedded jsp plugin"
2023-12-16 10:49:51 +01:00
jdyer1 7dd2e817e7 WN-5141
- TODO:  TEMP ignore test, depends on freemarker
2023-12-16 10:49:51 +01:00
jdyer1 8fecaa2c30 WN-5141
- CDI:  update beans.xml for Jakarta EE 9
- use "annotated=all" as "FooService.java" does not have a CDI annotation
2023-12-16 10:49:50 +01:00
jdyer1 143be3f173 WN-5141
- fix one more test
- remove mockobjects-http from core
2023-12-16 10:49:50 +01:00
jdyer1 92cc4f8597 WN-5141
- fix expected message text from library
2023-12-16 10:49:50 +01:00
jdyer1 b21be75703 WW-5141 temp IGNORE test require commons-upload upgrade 2023-12-16 10:49:41 +01:00
jdyer1 792357e6f5 WN-5141
- TODO:  temp IGNORE test require commons-upload upgrade
2023-12-16 10:47:47 +01:00
jdyer1 0802707a39 WW-5141 fix security test 2023-12-16 10:47:38 +01:00
jdyer1 85529bf0af WN-5141
- TODO:  temporary ignore freemarker test
2023-12-16 10:46:58 +01:00
jdyer1 a7618112f3 WN-5141
- TODO:  temporary ignore freemarker test
2023-12-16 10:46:58 +01:00
jdyer1 14ecd5c7f2 IPAGE-5141
- all core tests compile
2023-12-16 10:46:58 +01:00
jdyer1 2e6d912acf WN-5141
- more tests compile
2023-12-16 10:46:58 +01:00
jdyer1 54564c9aad WN-5141
- begin make ui tests compile
2023-12-16 10:46:58 +01:00
jdyer1 07792bd0e0 WN-5141
- add back in "mockobjects" where they can be used
2023-12-16 10:46:58 +01:00
jdyer1 6ad0ad512d WN-5141
- fix visibility of el api
- remove mockobjects from pom (needs to be migrated to ?spring web mocks?)
2023-12-16 10:46:57 +01:00
jdyer1 459fd74dc6 WN-5141
- begin work to get tests to compile
2023-12-16 10:46:57 +01:00
jdyer1 7525978325 WN-5141
- use 10.x version of tomcat jars
2023-12-16 10:46:57 +01:00
jdyer1 bbdeb2d459 Revert "WN-5141"
This reverts commit 5d1aa6edcf.
2023-12-16 10:46:57 +01:00
jdyer1 380b157bef WN-5141
- use servlet api mocks from Spring instead of MockObjects
2023-12-16 10:46:57 +01:00
jdyer1 416dd7e22b WN-5141
- remove el method deprecarted/removed from api
2023-12-16 10:46:57 +01:00
jdyer1 37e1794678 WN-5141
- TODO:  TEMPORARY remove sitemesh plugin from build
2023-12-16 10:46:56 +01:00
jdyer1 0cee06f5ab WN-5141
- TODO:  TEMPARARY comment-out velocity-tools code
2023-12-16 10:46:56 +01:00
jdyer1 54a9ef85e7 WN-5141
- TODO:  TEMPORARY comment-out freemarker code
2023-12-16 10:46:56 +01:00
jdyer1 fed840b6ac WN-5141
- TODO:  TEMPORARY comment-out velocity
2023-12-16 10:46:56 +01:00
jdyer1 0566cc58c6 WN-5141
- TODO:  temporary comment-out velocity dependencies
2023-12-16 10:46:56 +01:00
jdyer1 8726288bd5 WN-5141
- TODO:  temporary comment out velocity tools (requires javax)
2023-12-16 10:46:56 +01:00
jdyer1 42fed67a85 WW-5141 TODO: TEMPORARY comment-out incomaptible commons-upload old version code 2023-12-16 10:46:44 +01:00
jdyer1 09feb9bf06 Revert "WN-5141"
This reverts commit d132c43865.
2023-12-16 10:40:36 +01:00
jdyer1 2e528eb66a WN-5141
- TODO:  TEMPORARY comment-out problematic Freemarker code
2023-12-16 10:40:36 +01:00
jdyer1 697e18553b WN-5141
- upgrade sitemesh (TODO: maybe not necessary??)
2023-12-16 10:40:36 +01:00
jdyer1 11284a0423 WN-5141
- update commons-upload to jakarta-compatible version
2023-12-16 10:40:36 +01:00
jdyer1 5341424744 WN-5141
- update mocks to jakarta
2023-12-16 10:40:35 +01:00
jdyer1 841313ec1f WN-5141
- more portlet removals
2023-12-16 10:40:35 +01:00
jdyer1 a5c139114c WN-5141
- more removals for "pell multipart"
2023-12-16 10:40:35 +01:00
jdyer1 08c6693200 WN-5141
- remove "dwr" from "struts-showcase"
2023-12-16 10:40:35 +01:00
jdyer1 857c36c3c5 WN-5141
- fix apparent copy/paste bug in jasper reports README.md
2023-12-16 10:40:35 +01:00
jdyer1 6dc2cba329 WN-5141
- remove dwr plugin code
2023-12-16 10:40:35 +01:00
jdyer1 20eb2ebbf5 WN-5141
-  remove dwr plugin
2023-12-16 10:40:34 +01:00
jdyer1 7eda1745a4 WW-5141 remove code for "pell multipart plugin" 2023-12-16 10:40:24 +01:00
jdyer1 3a73c2ab2b WN-5141
- remove "pell multipart plugin"
2023-12-16 10:40:12 +01:00
jdyer1 0c35a6bf88 IPAGE-5141
- s/javax.servlet/jakarta.servlet/g - to fix runtime usages: attribute names, etc, messaging.  Also changes code comments
2023-12-16 10:40:12 +01:00
jdyer1 eac1e0efa7 WW-5141
- delete portlet code
2023-12-16 10:40:04 +01:00
jdyer1 6d2eb2e020 WN-5141
- remove portlet
2023-12-16 10:39:39 +01:00
jdyer1 2202e5fbbb WW-5141
- initial attempt to update references javax>jakarta and get things to compile
2023-12-16 10:39:28 +01:00
1450 changed files with 8401 additions and 111569 deletions
+5 -27
View File
@@ -11,37 +11,15 @@ notifications:
jira_options: link label worklog
github:
description: "Apache Struts is a free, open-source, MVC framework for creating elegant, modern Java web applications"
homepage: https://struts.apache.org/
del_branch_on_merge: true
protected_branches:
main:
master:
# contexts are the names of checks that must pass.
required_status_checks:
contexts:
- "Build and Test (JDK 17)"
contexts:
- build
required_pull_request_reviews:
# it does not work because our github teams are private/secret, see INFRA-25666
require_code_owner_reviews: false
required_approving_review_count: 0
support/struts-6-x-x:
# contexts are the names of checks that must pass.
required_status_checks:
contexts:
- "Build and Test (8)"
required_pull_request_reviews:
# it does not work because our github teams are private/secret, see INFRA-25666
require_code_owner_reviews: false
required_approving_review_count: 0
release/struts-6-*:
# contexts are the names of checks that must pass.
required_status_checks:
contexts:
- "Build and Test (8)"
required_pull_request_reviews:
# it does not work because our github teams are private/secret, see INFRA-25666
require_code_owner_reviews: false
required_approving_review_count: 0
require_code_owner_reviews: true
required_approving_review_count: 1
autolink_jira:
- WW
dependabot_alerts: true
+20 -20
View File
@@ -18,8 +18,8 @@ name: "CodeQL"
on:
push:
branches:
- 'support/struts-6-x-x'
- 'release/*'
- master
- release/struts-7-0-x
pull_request:
permissions:
@@ -43,21 +43,21 @@ jobs:
matrix:
language: [ 'java' ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Java JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: 'maven'
- name: Initialize CodeQL
uses: github/codeql-action/init@v3.28.8
with:
languages: ${{ matrix.language }}
- name: Autobuild
uses: github/codeql-action/autobuild@v3.28.8
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3.28.8
with:
category: "/language:${{matrix.language}}"
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Java JDK
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
cache: 'maven'
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
- name: Autobuild
uses: github/codeql-action/autobuild@v3
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
+3 -3
View File
@@ -19,8 +19,8 @@ on:
pull_request:
push:
branches:
- 'support/struts-6-x-x'
- 'release/*'
- master
- release/struts-7-0-x
permissions: read-all
@@ -34,7 +34,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '8', '11', '17', '21' ]
java: [ '17', '21' ]
steps:
- name: Checkout code
uses: actions/checkout@v4
+4 -4
View File
@@ -21,7 +21,7 @@ on:
- cron: "30 1 * * 6" # Weekly on Saturdays
push:
branches:
- 'main' # only default branch is supported
- master
permissions: read-all
@@ -46,7 +46,7 @@ jobs:
persist-credentials: false
- name: "Run analysis"
uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # 2.4.0
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # 2.3.1
with:
results_file: results.sarif
results_format: sarif
@@ -58,13 +58,13 @@ jobs:
publish_results: true
- name: "Upload artifact"
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # 4.4.3
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # 4.3.1
with:
name: SARIF file
path: results.sarif
retention-days: 5
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@acb9cb18eec7e3a113ef83cff0be91e75cfd9526 # 2.22.11
uses: github/codeql-action/upload-sarif@03e7845b7bfcd5e7fb63d1ae8c61b0e791134fab # 2.22.11
with:
sarif_file: results.sarif
+6 -6
View File
@@ -19,8 +19,8 @@ on:
pull_request:
push:
branches:
- 'support/struts-6-x-x'
- 'release/*'
- master
- release/struts-7-0-x
permissions: read-all
@@ -32,12 +32,12 @@ jobs:
sonarcloud:
name: Scan
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.base.repo.fork && !github.event.pull_request.head.repo.fork && github.actor != 'dependabot[bot]' }}
if: ${{ !github.event.pull_request.head.repo.fork }}
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v5
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
@@ -45,4 +45,4 @@ jobs:
- env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
run: ./mvnw -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Pcoverage -DskipAssembly
run: mvn -B -V -Pcoverage -DskipAssembly verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar --no-transfer-progress
+4 -10
View File
@@ -1,5 +1,5 @@
# IDEA
.idea/
.idea
*.iml
*.ipr
*.iws
@@ -38,17 +38,11 @@ buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar
plugins/testng/test-output/
test-output/
plugins/testng/test-output
test-output
# Sonar
.sonar/
/.sonar/
# Tidelift CLI scanner
.tidelift
# Claude Code specific local settings
.claude/
.metals/
.bloop/
.vscode/
-37
View File
@@ -1,37 +0,0 @@
# CLAUDE.md
## Build Commands
```bash
# Build without tests (fastest)
./mvnw clean install -DskipTests -DskipAssembly
# Test a single module
./mvnw -pl core clean test
./mvnw -pl plugins/spring clean test
# Full build with tests
./mvnw clean install
# Integration tests
./mvnw clean verify -DskipAssembly
# Coverage report
./mvnw clean verify -Pcoverage -DskipAssembly
```
## Project-Specific Rules
- This is the **6.x.x** branch (`release/struts-6-8-x`).
- Uses **javax.servlet** (Java EE), not Jakarta EE. Verify imports use `javax.servlet` namespace.
- Test pattern: `**/*Test.java`. Test classes use JUnit 4 with `@Test` annotations.
- OGNL expressions have strict security via `SecurityMemberAccess` — test any new OGNL usage against the security sandbox.
- Each plugin has its own `struts-plugin.xml` descriptor — register new beans there, not in core config.
- Run `./mvnw clean prepare-package` before committing to verify Apache RAT license headers pass.
## Module Layout
- `core/` — framework core
- `plugins/` — 20+ plugin modules (spring, json, tiles, velocity, etc.)
- `apps/showcase/` — feature demo app
- `apps/rest-showcase/` — REST examples
Vendored
+16 -62
View File
@@ -1,22 +1,4 @@
#!groovy
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
pipeline {
agent none
@@ -87,7 +69,7 @@ pipeline {
stages {
stage('Test & Coverage') {
steps {
sh './mvnw -B verify -Pcoverage -DskipAssembly'
sh './mvnw -B verify -Pcoverage -DskipAssembly --no-transfer-progress'
}
post {
always {
@@ -99,77 +81,49 @@ pipeline {
stage('Code Quality') {
when {
anyOf {
branch 'support/struts-6-x-x'
branch 'master'; branch 'release/struts-7-0-x'
}
}
steps {
withCredentials([string(credentialsId: 'asf-struts-sonarcloud', variable: 'SONARCLOUD_TOKEN')]) {
sh './mvnw -B -Pcoverage -DskipAssembly -Dsonar.login=${SONARCLOUD_TOKEN} verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar'
}
}
}
}
post {
always {
cleanWs deleteDirs: true, patterns: [[pattern: '**/target/**', type: 'INCLUDE']]
}
}
}
stage('JDK 8') {
agent {
label 'ubuntu'
}
tools {
jdk 'jdk_1.8_latest'
maven 'maven_3_latest'
}
environment {
MAVEN_OPTS = "-Xmx1024m"
}
stages {
stage('Build') {
steps {
sh './mvnw -B clean install -DskipTests -DskipAssembly'
}
}
stage('Test') {
steps {
sh './mvnw -B verify -DskipAssembly'
}
post {
always {
junit(testResults: '**/surefire-reports/*.xml', allowEmptyResults: true)
junit(testResults: '**/failsafe-reports/*.xml', allowEmptyResults: true)
sh './mvnw -B -Pcoverage -DskipAssembly -Dsonar.login=${SONARCLOUD_TOKEN} verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar --no-transfer-progress'
}
}
}
stage('Build Source & JavaDoc') {
when {
branch 'support/struts-x-x-x'
anyOf {
branch 'master'; branch 'release/struts-7-0-x'
}
}
steps {
dir("local-snapshots-dir/") {
deleteDir()
}
sh './mvnw -B source:jar javadoc:jar -DskipTests -DskipAssembly'
sh './mvnw -B source:jar javadoc:jar -DskipTests -DskipAssembly --no-transfer-progress'
}
}
stage('Deploy Snapshot') {
when {
branch 'support/struts-6-x-x'
anyOf {
branch 'master'; branch 'release/struts-7-0-x'
}
}
steps {
withCredentials([file(credentialsId: 'lukaszlenart-repository-access-token', variable: 'CUSTOM_SETTINGS')]) {
sh './mvnw -s \${CUSTOM_SETTINGS} deploy -DskipTests -DskipAssembly'
sh './mvnw -s \${CUSTOM_SETTINGS} deploy -DskipTests -DskipAssembly --no-transfer-progress'
}
}
}
stage('Upload nightlies') {
when {
branch 'support/struts-6-x-x'
anyOf {
branch 'master'
branch 'release/struts-7-0-x'
}
}
steps {
sh './mvnw -B package -DskipTests'
sh './mvnw -B package -DskipTests --no-transfer-progress'
sshPublisher(publishers: [
sshPublisherDesc(
configName: 'Nightlies',
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>6.11.0-SNAPSHOT</version>
<version>7.0.0-M5</version>
</parent>
<artifactId>struts2-apps</artifactId>
<packaging>pom</packaging>
+4 -4
View File
@@ -24,12 +24,12 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>6.11.0-SNAPSHOT</version>
<version>7.0.0-M5</version>
</parent>
<artifactId>struts2-rest-showcase</artifactId>
<packaging>war</packaging>
<version>6.11.0-SNAPSHOT</version>
<version>7.0.0-M5</version>
<name>Struts 2 Rest Showcase Webapp</name>
<description>Struts 2 Rest Showcase Example</description>
@@ -76,7 +76,7 @@
</dependency>
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<groupId>org.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<scope>test</scope>
</dependency>
@@ -107,7 +107,7 @@
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.46.v20220331</version>
<version>11.0.18</version>
<configuration>
<stopKey>CTRL+C</stopKey>
<stopPort>8999</stopPort>
@@ -18,30 +18,30 @@
*/
package org.demo.rest.example;
import java.util.Collection;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.rest.DefaultHttpHeaders;
import org.apache.struts2.rest.HttpHeaders;
import org.apache.struts2.convention.annotation.Results;
import org.apache.struts2.convention.annotation.Result;
import com.opensymphony.xwork2.ModelDriven;
import com.opensymphony.xwork2.Validateable;
import com.opensymphony.xwork2.ValidationAwareSupport;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import org.apache.struts2.rest.DefaultHttpHeaders;
import org.apache.struts2.rest.HttpHeaders;
import java.util.Collection;
@Results({
@Result(name="success", type="redirectAction", params = {"actionName" , "orders"})
})
public class OrdersController extends ValidationAwareSupport implements ModelDriven<Object>, Validateable {
public class OrdersController extends ValidationAwareSupport implements ModelDriven<Object>, Validateable{
private static final Logger log = LogManager.getLogger(OrdersController.class);
private Order model = new Order();
private String id;
private Collection<Order> list;
private final OrdersService ordersService = new OrdersService();
private OrdersService ordersService = new OrdersService();
// GET /orders/1
public HttpHeaders show() {
@@ -54,7 +54,7 @@ public class OrdersController extends ValidationAwareSupport implements ModelDri
return new DefaultHttpHeaders("index")
.disableCaching();
}
// GET /orders/1/edit
public String edit() {
return "edit";
@@ -101,15 +101,13 @@ public class OrdersController extends ValidationAwareSupport implements ModelDri
}
}
@StrutsParameter
public void setId(String id) {
if (id != null) {
this.model = ordersService.get(id);
}
this.id = id;
}
@Override
public Object getModel() {
return (list != null ? list : model);
}
@@ -18,14 +18,11 @@
*/
package org.demo.rest.example;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
public class OrdersService {
private static final Map<String,Order> orders = new HashMap<>();
private static Map<String,Order> orders = new HashMap<String,Order>();
private static int nextId = 6;
static {
orders.put("3", new Order("3", "Bob", 33));
@@ -18,31 +18,41 @@
*/
package it.org.apache.struts2.rest.example;
import net.sourceforge.jwebunit.junit.WebTestCase;
import org.junit.Before;
import org.junit.Test;
public class GetOrdersTest extends WebTestCase {
import static net.sourceforge.jwebunit.junit.JWebUnit.assertTextNotPresent;
import static net.sourceforge.jwebunit.junit.JWebUnit.assertTextPresent;
import static net.sourceforge.jwebunit.junit.JWebUnit.beginAt;
import static net.sourceforge.jwebunit.junit.JWebUnit.getTestContext;
public class GetOrdersTest {
@Before
public void setUp() throws Exception {
getTestContext().setBaseUrl(ParameterUtils.getBaseUrl());
}
@Test
public void testGetOrders() {
beginAt("/orders/3");
assertTextPresent("Bob");
assertTextNotPresent("Sarah");
}
@Test
public void testGetOrdersInHtml() {
beginAt("/orders/3.xhtml");
assertTextPresent("Bob");
}
@Test
public void testGetOrdersInXml() {
beginAt("/orders/3.xml");
assertTextPresent("<clientName>Bob");
}
@Test
public void testGetOrdersInJson() {
beginAt("/orders/3.json");
assertTextPresent("\"clientName\":\"Bob\"");
@@ -18,15 +18,21 @@
*/
package it.org.apache.struts2.rest.example;
import net.sourceforge.jwebunit.junit.WebTestCase;
import org.junit.Before;
import org.junit.Test;
public class ListOrdersTest extends WebTestCase {
import static net.sourceforge.jwebunit.junit.JWebUnit.assertTextPresent;
import static net.sourceforge.jwebunit.junit.JWebUnit.beginAt;
import static net.sourceforge.jwebunit.junit.JWebUnit.getTestContext;
public class ListOrdersTest {
@Before
public void setUp() throws Exception {
getTestContext().setBaseUrl(ParameterUtils.getBaseUrl());
}
@Test
public void testListOrders() {
beginAt("/orders");
assertTextPresent("Bob");
@@ -34,6 +40,7 @@ public class ListOrdersTest extends WebTestCase {
assertTextPresent("Jim");
}
@Test
public void testListOrdersInHtml() {
beginAt("/orders.xhtml");
assertTextPresent("Bob");
@@ -41,6 +48,7 @@ public class ListOrdersTest extends WebTestCase {
assertTextPresent("Jim");
}
@Test
public void testListOrdersInXml() {
beginAt("/orders.xml");
assertTextPresent("<clientName>Bob");
@@ -48,6 +56,7 @@ public class ListOrdersTest extends WebTestCase {
assertTextPresent("<clientName>Jim");
}
@Test
public void testListOrdersInJson() {
beginAt("/orders.json");
assertTextPresent("\"clientName\":\"Bob\"");
@@ -18,23 +18,37 @@
*/
package it.org.apache.struts2.rest.example;
import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
import net.sourceforge.jwebunit.junit.WebTestCase;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.htmlunit.FailingHttpStatusCodeException;
import org.junit.Before;
import org.junit.Test;
import java.io.IOException;
public class PostOrderTest extends WebTestCase {
import static net.sourceforge.jwebunit.junit.JWebUnit.assertLinkNotPresentWithText;
import static net.sourceforge.jwebunit.junit.JWebUnit.assertTextFieldEquals;
import static net.sourceforge.jwebunit.junit.JWebUnit.assertTextPresent;
import static net.sourceforge.jwebunit.junit.JWebUnit.beginAt;
import static net.sourceforge.jwebunit.junit.JWebUnit.getTestContext;
import static net.sourceforge.jwebunit.junit.JWebUnit.setTextField;
import static net.sourceforge.jwebunit.junit.JWebUnit.setWorkingForm;
import static net.sourceforge.jwebunit.junit.JWebUnit.submit;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
public class PostOrderTest {
@Before
public void setUp() throws Exception {
getTestContext().setBaseUrl(ParameterUtils.getBaseUrl());
}
@Test
public void testPostOrder() {
beginAt("/orders/new");
setWorkingForm(0);
@@ -45,6 +59,7 @@ public class PostOrderTest extends WebTestCase {
assertLinkNotPresentWithText("Back to Orders");
}
@Test
public void testPostOrderWithErrors() {
beginAt("/orders/new");
setWorkingForm(0);
@@ -58,6 +73,7 @@ public class PostOrderTest extends WebTestCase {
assertTextFieldEquals("amount", "321");
}
@Test
public void testPostOrderInHtml() {
beginAt("/orders/new.xhtml");
setWorkingForm(0);
@@ -72,6 +88,7 @@ public class PostOrderTest extends WebTestCase {
assertLinkNotPresentWithText("Back to Orders");
}
@Test
public void testPostOrderInXml() throws IOException {
CloseableHttpClient client = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(ParameterUtils.getBaseUrl() + "/orders.xml");
@@ -85,6 +102,7 @@ public class PostOrderTest extends WebTestCase {
client.close();
}
@Test
public void testPostOrderInXmlWithBadData() throws IOException {
CloseableHttpClient client = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(ParameterUtils.getBaseUrl() + "/orders.xml");
@@ -98,6 +116,7 @@ public class PostOrderTest extends WebTestCase {
client.close();
}
@Test
public void testPostOrderInJson() throws IOException {
CloseableHttpClient client = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(ParameterUtils.getBaseUrl() + "/orders.json");
@@ -108,6 +127,7 @@ public class PostOrderTest extends WebTestCase {
client.close();
}
@Test
public void testPostOrderInJsonWithBadData() throws IOException {
CloseableHttpClient client = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(ParameterUtils.getBaseUrl() + "/orders.json");
+70 -34
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>6.11.0-SNAPSHOT</version>
<version>7.0.0-M5</version>
</parent>
<artifactId>struts2-showcase</artifactId>
@@ -58,11 +58,6 @@
<artifactId>struts2-tiles-plugin</artifactId>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-dwr-plugin</artifactId>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-json-plugin</artifactId>
@@ -99,8 +94,8 @@
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
@@ -121,18 +116,11 @@
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-web</artifactId>
</dependency>
<dependency>
<groupId>opensymphony</groupId>
<artifactId>sitemesh</artifactId>
</dependency>
<dependency>
<groupId>org.directwebremoting</groupId>
<artifactId>dwr</artifactId>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-sitemesh2-jakarta</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
@@ -141,17 +129,17 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<scope>test</scope>
</dependency>
<groupId>org.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<scope>test</scope>
</dependency>
<!-- BeanValidation Example -->
<dependency>
@@ -164,10 +152,52 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<?m2e ignore?>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/extraclasspath</outputDirectory>
<artifactItems>
<artifactItem>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-freemarker-jakarta</artifactId>
<destFileName>struts2-freemarker-jakarta.jar</destFileName>
</artifactItem>
<artifactItem>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-sitemesh2-jakarta</artifactId>
<destFileName>struts2-sitemesh2-jakarta.jar</destFileName>
</artifactItem>
<artifactItem>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-velocity-tools-view-jakarta</artifactId>
<destFileName>struts2-velocity-tools-view-jakarta.jar</destFileName>
</artifactItem>
<artifactItem>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-velocity-tools-jsp-jakarta</artifactId>
<destFileName>struts2-velocity-tools-jsp-jakarta.jar</destFileName>
</artifactItem>
</artifactItems>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.5.6</version>
<version>3.0.0-M6</version>
<configuration>
<includes>
<include>it.org.apache.struts2.showcase.*Test</include>
@@ -194,7 +224,7 @@
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.46.v20220331</version>
<version>11.0.18</version>
<configuration>
<stopKey>CTRL+C</stopKey>
<stopPort>8999</stopPort>
@@ -207,12 +237,18 @@
<httpConnector>
<port>8090</port>
</httpConnector>
<scanIntervalSeconds>10</scanIntervalSeconds>
<scan>10</scan>
<webAppSourceDirectory>${basedir}/src/main/webapp/</webAppSourceDirectory>
<webAppConfig>
<contextPath>/struts2-showcase</contextPath>
<descriptor>${basedir}/src/main/webapp/WEB-INF/web.xml</descriptor>
</webAppConfig>
<webApp>
<extraClasspath>
${project.build.directory}/extraclasspath/struts2-freemarker-jakarta.jar,
${project.build.directory}/extraclasspath/struts2-sitemesh2-jakarta.jar,
${project.build.directory}/extraclasspath/struts2-velocity-tools-view-jakarta.jar,
${project.build.directory}/extraclasspath/struts2-velocity-tools-jsp-jakarta
</extraClasspath>
<contextPath>/struts2-showcase</contextPath>
<descriptor>${basedir}/src/main/webapp/WEB-INF/web.xml</descriptor>
</webApp>
</configuration>
<executions>
<execution>
@@ -21,7 +21,6 @@
package org.apache.struts2.showcase;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import org.apache.struts2.showcase.ajax.tree.Category;
//START SNIPPET: treeExampleDynamicJavaSelected
@@ -31,7 +30,7 @@ public class DynamicTreeSelectAction extends ActionSupport {
private long nodeId;
private Category currentCategory;
@StrutsParameter
public void setNodeId(long nodeId) {
this.nodeId = nodeId;
}
@@ -21,7 +21,6 @@
package org.apache.struts2.showcase;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import java.util.ArrayList;
import java.util.LinkedHashMap;
@@ -75,7 +74,6 @@ public class LotsOfOptiontransferselectAction extends ActionSupport {
return _favouriteCartoonCharactersKeys;
}
@StrutsParameter
public void setFavouriteCartoonCharacters(List favouriteCartoonCharacters) {
_favouriteCartoonCharactersKeys = favouriteCartoonCharacters;
}
@@ -84,7 +82,6 @@ public class LotsOfOptiontransferselectAction extends ActionSupport {
return _notFavouriteCartoonCharactersKeys;
}
@StrutsParameter
public void setNotFavouriteCartoonCharacters(List notFavouriteCartoonCharacters) {
_notFavouriteCartoonCharactersKeys = notFavouriteCartoonCharacters;
}
@@ -111,7 +108,6 @@ public class LotsOfOptiontransferselectAction extends ActionSupport {
return _favouriteCarsKeys;
}
@StrutsParameter
public void setFavouriteCars(List favouriteCars) {
_favouriteCarsKeys = favouriteCars;
}
@@ -120,7 +116,6 @@ public class LotsOfOptiontransferselectAction extends ActionSupport {
return _notFavouriteCarsKeys;
}
@StrutsParameter
public void setNotFavouriteCars(List notFavouriteCars) {
_notFavouriteCarsKeys = notFavouriteCars;
}
@@ -147,7 +142,6 @@ public class LotsOfOptiontransferselectAction extends ActionSupport {
return _favouriteMotorcyclesKeys;
}
@StrutsParameter
public void setFavouriteMotorcycles(List favouriteMotorcycles) {
_favouriteMotorcyclesKeys = favouriteMotorcycles;
}
@@ -156,7 +150,6 @@ public class LotsOfOptiontransferselectAction extends ActionSupport {
return _notFavouriteMotorcyclesKeys;
}
@StrutsParameter
public void setNotFavouriteMotorcycles(List notFavouriteMotorcycles) {
_notFavouriteMotorcyclesKeys = notFavouriteMotorcycles;
}
@@ -183,7 +176,6 @@ public class LotsOfOptiontransferselectAction extends ActionSupport {
return _favouriteCountriesKeys;
}
@StrutsParameter
public void setFavouriteCountries(List favouriteCountries) {
_favouriteCountriesKeys = favouriteCountries;
}
@@ -192,7 +184,6 @@ public class LotsOfOptiontransferselectAction extends ActionSupport {
return _notFavouriteCountriesKeys;
}
@StrutsParameter
public void setNotFavouriteCountries(List notFavouriteCountries) {
_notFavouriteCountriesKeys = notFavouriteCountries;
}
@@ -214,7 +205,6 @@ public class LotsOfOptiontransferselectAction extends ActionSupport {
return _favouriteSportsKeys;
}
@StrutsParameter
public void setFavouriteSports(List favouriteSportsKeys) {
this._favouriteSportsKeys = favouriteSportsKeys;
}
@@ -223,7 +213,6 @@ public class LotsOfOptiontransferselectAction extends ActionSupport {
return _nonFavouriteSportsKeys;
}
@StrutsParameter
public void setNonFavouriteSports(List notFavouriteSportsKeys) {
this._nonFavouriteSportsKeys = notFavouriteSportsKeys;
}
@@ -233,7 +222,6 @@ public class LotsOfOptiontransferselectAction extends ActionSupport {
return _prioritisedFavouriteCartoonCharacters;
}
@StrutsParameter
public void setPrioritisedFavouriteCartoonCharacters(List prioritisedFavouriteCartoonCharacters) {
_prioritisedFavouriteCartoonCharacters = prioritisedFavouriteCartoonCharacters;
}
@@ -242,7 +230,6 @@ public class LotsOfOptiontransferselectAction extends ActionSupport {
return _prioritisedFavouriteCars;
}
@StrutsParameter
public void setPrioritisedFavouriteCars(List prioritisedFavouriteCars) {
_prioritisedFavouriteCars = prioritisedFavouriteCars;
}
@@ -252,7 +239,6 @@ public class LotsOfOptiontransferselectAction extends ActionSupport {
return _prioritisedFavouriteCountries;
}
@StrutsParameter
public void setPrioritisedFavouriteCountries(List prioritisedFavouriteCountries) {
_prioritisedFavouriteCountries = prioritisedFavouriteCountries;
}
@@ -278,13 +264,12 @@ public class LotsOfOptiontransferselectAction extends ActionSupport {
return _favouriteCities;
}
@StrutsParameter
public void setFavouriteCities(List favouriteCities) {
this._favouriteCities = favouriteCities;
}
// actions
@Override
public String input() throws Exception {
return SUCCESS;
}
@@ -21,7 +21,6 @@
package org.apache.struts2.showcase;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
/**
*
@@ -37,7 +36,6 @@ public class LotsOfRichtexteditorAction extends ActionSupport {
return this.description1;
}
@StrutsParameter
public void setDescription1(String description1) {
this.description1 = description1;
}
@@ -47,7 +45,6 @@ public class LotsOfRichtexteditorAction extends ActionSupport {
return this.description2;
}
@StrutsParameter
public void setDescription2(String description2) {
this.description2 = description2;
}
@@ -57,7 +54,6 @@ public class LotsOfRichtexteditorAction extends ActionSupport {
return this.description3;
}
@StrutsParameter
public void setDescription3(String description3) {
this.description3 = description3;
}
@@ -67,12 +63,11 @@ public class LotsOfRichtexteditorAction extends ActionSupport {
return this.description4;
}
@StrutsParameter
public void setDescription4(String description4) {
this.description4 = description4;
}
@Override
public String input() throws Exception {
return SUCCESS;
}
@@ -21,7 +21,6 @@
package org.apache.struts2.showcase;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import java.util.ArrayList;
import java.util.LinkedHashMap;
@@ -76,11 +75,11 @@ public class MoreSelectsAction extends ActionSupport {
return list;
}
public List getPrioritisedFavouriteCartoonCharacters() {
return _prioritisedFavouriteCartoonCharacters;
}
@StrutsParameter
public void setPrioritisedFavouriteCartoonCharacters(List prioritisedFavouriteCartoonCharacters) {
_prioritisedFavouriteCartoonCharacters = prioritisedFavouriteCartoonCharacters;
}
@@ -89,16 +88,15 @@ public class MoreSelectsAction extends ActionSupport {
return _prioritisedFavouriteCars;
}
@StrutsParameter
public void setPrioritisedFavouriteCars(List prioritisedFavouriteCars) {
_prioritisedFavouriteCars = prioritisedFavouriteCars;
}
public List getPrioritisedFavouriteCountries() {
return _prioritisedFavouriteCountries;
}
@StrutsParameter
public void setPrioritisedFavouriteCountries(List prioritisedFavouriteCountries) {
_prioritisedFavouriteCountries = prioritisedFavouriteCountries;
}
@@ -107,7 +105,6 @@ public class MoreSelectsAction extends ActionSupport {
return favouriteNumbers;
}
@StrutsParameter
public void setFavouriteNumbers(List favouriteNumbers) {
this.favouriteNumbers = favouriteNumbers;
}
@@ -132,13 +129,12 @@ public class MoreSelectsAction extends ActionSupport {
return favouriteCities;
}
@StrutsParameter
public void setFavouriteCities(List favouriteCities) {
this.favouriteCities = favouriteCities;
}
// actions
@Override
public String input() throws Exception {
return SUCCESS;
}
@@ -21,7 +21,6 @@
package org.apache.struts2.showcase;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import org.apache.struts2.showcase.ajax.tree.Category;
public class ShowAjaxDynamicTreeAction extends ActionSupport {
@@ -35,7 +34,6 @@ public class ShowAjaxDynamicTreeAction extends ActionSupport {
return nodeId;
}
@StrutsParameter
public void setNodeId(int nodeId) {
this.nodeId = nodeId;
}
@@ -200,7 +200,6 @@ public class UITagExample extends ActionSupport implements Validateable {
return bestFriend;
}
@StrutsParameter
public void setBestFriend(String bestFriend) {
this.bestFriend = bestFriend;
}
@@ -232,7 +231,6 @@ public class UITagExample extends ActionSupport implements Validateable {
this.region = region;
}
@StrutsParameter
public void setPicture(File picture) {
this.picture = picture;
}
@@ -241,12 +239,10 @@ public class UITagExample extends ActionSupport implements Validateable {
return this.picture;
}
@StrutsParameter
public void setPictureContentType(String pictureContentType) {
this.pictureContentType = pictureContentType;
}
@StrutsParameter
public void setPictureFileName(String pictureFileName) {
this.pictureFileName = pictureFileName;
}
@@ -327,7 +323,6 @@ public class UITagExample extends ActionSupport implements Validateable {
return this.description;
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof VehicalType)) {
return false;
@@ -336,7 +331,6 @@ public class UITagExample extends ActionSupport implements Validateable {
}
}
@Override
public int hashCode() {
return key.hashCode();
}
@@ -360,7 +354,6 @@ public class UITagExample extends ActionSupport implements Validateable {
return this.description;
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof VehicalSpecific)) {
return false;
@@ -369,7 +362,6 @@ public class UITagExample extends ActionSupport implements Validateable {
}
}
@Override
public int hashCode() {
return key.hashCode();
}
@@ -21,7 +21,6 @@ package org.apache.struts2.showcase.action;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import org.apache.struts2.showcase.dao.Dao;
import org.apache.struts2.showcase.model.IdEntity;
@@ -34,62 +33,62 @@ import java.util.Collection;
public abstract class AbstractCRUDAction extends ActionSupport {
private static final Logger log = LogManager.getLogger(AbstractCRUDAction.class);
private static final Logger log = LogManager.getLogger(AbstractCRUDAction.class);
private Collection availableItems;
private String[] toDelete;
private Collection availableItems;
private String[] toDelete;
protected abstract Dao getDao();
protected abstract Dao getDao();
public Collection getAvailableItems() {
return availableItems;
}
public String[] getToDelete() {
return toDelete;
}
public Collection getAvailableItems() {
return availableItems;
}
@StrutsParameter
public void setToDelete(String[] toDelete) {
this.toDelete = toDelete;
}
public String[] getToDelete() {
return toDelete;
}
public String list() throws Exception {
this.availableItems = getDao().findAll();
if (log.isDebugEnabled()) {
log.debug("AbstractCRUDAction - [list]: " + (availableItems != null ? "" + availableItems.size() : "no") + " items found");
}
return execute();
}
public void setToDelete(String[] toDelete) {
this.toDelete = toDelete;
}
public String delete() throws Exception {
if (toDelete != null) {
int count = 0;
for (String s : toDelete) {
count = count + getDao().delete(s);
}
if (log.isDebugEnabled()) {
log.debug("AbstractCRUDAction - [delete]: {} items deleted.", count);
}
}
return SUCCESS;
}
public String list() throws Exception {
this.availableItems = getDao().findAll();
if (log.isDebugEnabled()) {
log.debug("AbstractCRUDAction - [list]: " + (availableItems != null ? "" + availableItems.size() : "no") + " items found");
}
return execute();
}
/**
* Utility method for fetching already persistent object from storage for usage in params-prepare-params cycle.
*
* @param tryId The id to try to get persistent object for
* @param tryObject The object, induced by first params invocation, possibly containing id to try to get persistent
* object for
* @return The persistent object, if found. <tt>null</tt> otherwise.
*/
protected IdEntity fetch(Serializable tryId, IdEntity tryObject) {
IdEntity result = null;
if (tryId != null) {
result = getDao().get(tryId);
} else if (tryObject != null) {
result = getDao().get(tryObject.getId());
}
return result;
}
public String delete() throws Exception {
if (toDelete != null) {
int count = 0;
for (int i = 0, j = toDelete.length; i < j; i++) {
count = count + getDao().delete(toDelete[i]);
}
if (log.isDebugEnabled()) {
log.debug("AbstractCRUDAction - [delete]: " + count + " items deleted.");
}
}
return SUCCESS;
}
/**
* Utility method for fetching already persistent object from storage for usage in params-prepare-params cycle.
*
* @param tryId The id to try to get persistent object for
* @param tryObject The object, induced by first params invocation, possibly containing id to try to get persistent
* object for
* @return The persistent object, if found. <tt>null</tt> otherwise.
*/
protected IdEntity fetch(Serializable tryId, IdEntity tryObject) {
IdEntity result = null;
if (tryId != null) {
result = getDao().get(tryId);
} else if (tryObject != null) {
result = getDao().get(tryObject.getId());
}
return result;
}
}
@@ -21,7 +21,6 @@ package org.apache.struts2.showcase.action;
import com.opensymphony.xwork2.Preparable;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import org.apache.struts2.showcase.application.TestDataProvider;
import org.apache.struts2.showcase.dao.Dao;
import org.apache.struts2.showcase.dao.EmployeeDao;
@@ -53,7 +52,7 @@ public class EmployeeAction extends AbstractCRUDAction implements Preparable {
public String execute() throws Exception {
if (getCurrentEmployee() != null && getCurrentEmployee().getOtherSkills() != null) {
setSelectedSkills(new ArrayList<>());
setSelectedSkills(new ArrayList<String>());
Iterator it = getCurrentEmployee().getOtherSkills().iterator();
while (it.hasNext()) {
getSelectedSkills().add(((Skill) it.next()).getName());
@@ -74,12 +73,10 @@ public class EmployeeAction extends AbstractCRUDAction implements Preparable {
return empId;
}
@StrutsParameter
public void setEmpId(Long empId) {
this.empId = empId;
}
@StrutsParameter(depth = 2)
public Employee getCurrentEmployee() {
return currentEmployee;
}
@@ -20,11 +20,7 @@ package org.apache.struts2.showcase.action;
import com.opensymphony.xwork2.ActionSupport;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
public class ExampleAction extends ActionSupport {
public static final String CONSTANT = "Struts Rocks!";
@@ -50,7 +46,7 @@ public class ExampleAction extends ActionSupport {
}
public Map<String, Book> getBooks() {
Map<String, Book> books = new HashMap<>();
Map<String, Book> books = new HashMap<String, Book>();
books.put("Iliad", new Book("Iliad", "Homer"));
books.put("The Republic", new Book("The Replublic", "Plato"));
books.put("Thus Spake Zarathustra", new Book("Thus Spake Zarathustra",
@@ -83,4 +79,4 @@ class Book {
public void setAuthor(String author) {
this.author = author;
}
}
}
@@ -21,13 +21,8 @@ package org.apache.struts2.showcase.action;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.interceptor.annotations.After;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.*;
import java.net.URL;
/**
@@ -67,7 +62,6 @@ public class JSPEvalAction extends ExampleAction {
}
}
@StrutsParameter
public void setJsp(String jsp) {
this.jsp = jsp;
}
@@ -46,7 +46,6 @@ public class SkillAction extends AbstractCRUDAction implements Preparable {
*
* @throws Exception thrown if a system level exception occurs.
*/
@Override
public void prepare() throws Exception {
Skill preFetched = (Skill) fetch(getSkillName(), getCurrentSkill());
if (preFetched != null) {
@@ -65,7 +64,6 @@ public class SkillAction extends AbstractCRUDAction implements Preparable {
return skillName;
}
@StrutsParameter
public void setSkillName(String skillName) {
this.skillName = skillName;
}
@@ -19,7 +19,6 @@
package org.apache.struts2.showcase.actionchaining;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
public class ActionChain1 extends ActionSupport {
@@ -27,7 +26,6 @@ public class ActionChain1 extends ActionSupport {
private String actionChain1Property1 = "Property Set In Action Chain 1";
@Override
public String input() throws Exception {
return SUCCESS;
}
@@ -36,7 +34,6 @@ public class ActionChain1 extends ActionSupport {
return actionChain1Property1;
}
@StrutsParameter
public void setActionChain1Property1(String actionChain1Property1) {
this.actionChain1Property1 = actionChain1Property1;
}
@@ -19,7 +19,6 @@
package org.apache.struts2.showcase.actionchaining;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
public class ActionChain2 extends ActionSupport {
@@ -28,7 +27,6 @@ public class ActionChain2 extends ActionSupport {
private String actionChain1Property1;
private String actionChain2Property1 = "Property Set in Action Chain 2";
@Override
public String execute() throws Exception {
return SUCCESS;
}
@@ -37,16 +35,15 @@ public class ActionChain2 extends ActionSupport {
return actionChain1Property1;
}
@StrutsParameter
public void setActionChain1Property1(String actionChain1Property1) {
this.actionChain1Property1 = actionChain1Property1;
}
public String getActionChain2Property1() {
return actionChain2Property1;
}
@StrutsParameter
public void setActionChain2Property1(String actionChain2Property1) {
this.actionChain2Property1 = actionChain2Property1;
}
@@ -19,7 +19,6 @@
package org.apache.struts2.showcase.actionchaining;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
public class ActionChain3 extends ActionSupport {
@@ -29,7 +28,7 @@ public class ActionChain3 extends ActionSupport {
private String actionChain2Property1;
private String actionChain3Property1 = "Property set in Action Chain 3";
@Override
public String execute() throws Exception {
return SUCCESS;
}
@@ -38,25 +37,24 @@ public class ActionChain3 extends ActionSupport {
return actionChain1Property1;
}
@StrutsParameter
public void setActionChain1Property1(String actionChain1Property1) {
this.actionChain1Property1 = actionChain1Property1;
}
public String getActionChain2Property1() {
return actionChain2Property1;
}
@StrutsParameter
public void setActionChain2Property1(String actionChain2Property1) {
this.actionChain2Property1 = actionChain2Property1;
}
public String getActionChain3Property1() {
return actionChain3Property1;
}
@StrutsParameter
public void setActionChain3Property1(String actionChain3Property1) {
this.actionChain3Property1 = actionChain3Property1;
}
@@ -21,10 +21,10 @@
package org.apache.struts2.showcase.ajax;
import com.opensymphony.xwork2.Action;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import java.io.Serializable;
public class AjaxTestAction implements Action, Serializable {
private static int counter = 0;
@@ -46,7 +46,6 @@ public class AjaxTestAction implements Action, Serializable {
return data;
}
@StrutsParameter
public void setData(String data) {
this.data = data;
}
@@ -21,18 +21,16 @@
package org.apache.struts2.showcase.ajax;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import java.util.ArrayList;
import java.util.List;
public class AutocompleterExampleAction extends ActionSupport {
private String select;
private final List<String> options = new ArrayList<>();
private List<String> options = new ArrayList<String>();
private static final long serialVersionUID = -8481638176160014396L;
@Override
public String execute() throws Exception {
if ("fruits".equals(select)) {
options.add("apple");
@@ -51,7 +49,6 @@ public class AutocompleterExampleAction extends ActionSupport {
return select;
}
@StrutsParameter
public void setSelect(String select) {
this.select = select;
}
@@ -21,7 +21,6 @@
package org.apache.struts2.showcase.ajax;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import java.text.SimpleDateFormat;
import java.util.Date;
@@ -52,7 +51,6 @@ public class Example4ShowPanelAction extends ActionSupport {
return gender;
}
@StrutsParameter
public void setGender(String gender) {
this.gender = gender;
}
@@ -61,7 +59,6 @@ public class Example4ShowPanelAction extends ActionSupport {
return name;
}
@StrutsParameter
public void setName(String name) {
this.name = name;
}
@@ -21,7 +21,6 @@
package org.apache.struts2.showcase.ajax;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
public class Example5Action extends ActionSupport {
@@ -38,7 +37,6 @@ public class Example5Action extends ActionSupport {
return name;
}
@StrutsParameter
public void setName(String name) {
this.name = name;
}
@@ -47,7 +45,6 @@ public class Example5Action extends ActionSupport {
return age;
}
@StrutsParameter
public void setAge(Integer age) {
this.age = age;
}
@@ -46,8 +46,7 @@ public class Category {
new Category(15, "Dojo"),
new Category(16, "Prototype"),
new Category(17, "Scriptaculous"),
new Category(18, "OpenRico"),
new Category(19, "DWR")));
new Category(18, "OpenRico")));
}
public static Category getById(long id) {
@@ -21,7 +21,6 @@
package org.apache.struts2.showcase.ajax.tree;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
/**
*/
@@ -29,7 +28,6 @@ public class GetCategory extends ActionSupport {
private long catId;
private Category category;
@Override
public String execute() throws Exception {
if (catId < 1) {
// force the root
@@ -41,7 +39,6 @@ public class GetCategory extends ActionSupport {
return SUCCESS;
}
@StrutsParameter
public void setCatId(long catId) {
this.catId = catId;
}
@@ -24,8 +24,6 @@ package org.apache.struts2.showcase.ajax.tree;
/**
*/
public class Toggle extends GetCategory {
@Override
public String execute() throws Exception {
super.execute();
@@ -18,13 +18,13 @@
*/
package org.apache.struts2.showcase.async;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.Filter;
import jakarta.servlet.FilterChain;
import jakarta.servlet.FilterConfig;
import jakarta.servlet.ServletException;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;
import jakarta.servlet.http.HttpServletRequest;
import java.io.IOException;
/**
@@ -50,12 +50,15 @@ public class ChatRoomAction extends ActionSupport {
}
public Callable<String> receiveNewMessages() throws Exception {
return () -> {
while (lastIndex >= messages.size()) {
Thread.sleep(3000);
return new Callable<String>() {
@Override
public String call() throws Exception {
while (lastIndex >= messages.size()) {
Thread.sleep(3000);
}
newMessages = messages.subList(lastIndex, messages.size());
return SUCCESS;
}
newMessages = messages.subList(lastIndex, messages.size());
return SUCCESS;
};
}
@@ -21,11 +21,11 @@
package org.apache.struts2.showcase.chat;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.action.SessionAware;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import java.util.Map;
import org.apache.struts2.action.SessionAware;
public class ChatLoginAction extends ActionSupport implements SessionAware {
private static final long serialVersionUID = 1L;
@@ -43,7 +43,6 @@ public class ChatLoginAction extends ActionSupport implements SessionAware {
return this.name;
}
@StrutsParameter
public void setName(String name) {
this.name = name;
}
@@ -25,9 +25,9 @@ import org.apache.logging.log4j.LogManager;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
import jakarta.servlet.http.HttpSession;
import jakarta.servlet.http.HttpSessionEvent;
import jakarta.servlet.http.HttpSessionListener;
public class ChatSessionListener implements HttpSessionListener {
@@ -21,7 +21,6 @@
package org.apache.struts2.showcase.chat;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
public class CrudRoomAction extends ActionSupport {
@@ -37,7 +36,6 @@ public class CrudRoomAction extends ActionSupport {
return description;
}
@StrutsParameter
public void setDescription(String description) {
this.description = description;
}
@@ -46,7 +44,6 @@ public class CrudRoomAction extends ActionSupport {
return name;
}
@StrutsParameter
public void setName(String name) {
this.name = name;
}
@@ -21,11 +21,11 @@
package org.apache.struts2.showcase.chat;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.action.SessionAware;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import java.util.Map;
import org.apache.struts2.action.SessionAware;
public class EnterRoomAction extends ActionSupport implements SessionAware {
private static final long serialVersionUID = 1L;
@@ -38,7 +38,6 @@ public class EnterRoomAction extends ActionSupport implements SessionAware {
return this.roomName;
}
@StrutsParameter
public void setRoomName(String roomName) {
this.roomName = roomName;
}
@@ -21,11 +21,11 @@
package org.apache.struts2.showcase.chat;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.action.SessionAware;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import java.util.Map;
import org.apache.struts2.action.SessionAware;
public class ExitRoomAction extends ActionSupport implements SessionAware {
private static final long serialVersionUID = 1L;
@@ -38,7 +38,6 @@ public class ExitRoomAction extends ActionSupport implements SessionAware {
return roomName;
}
@StrutsParameter
public void setRoomName(String roomName) {
this.roomName = roomName;
}
@@ -21,7 +21,6 @@
package org.apache.struts2.showcase.chat;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import java.util.ArrayList;
import java.util.List;
@@ -31,14 +30,13 @@ public class MessagesAvailableInRoomAction extends ActionSupport {
private static final long serialVersionUID = 1L;
private String roomName;
private final ChatService chatService;
private List<ChatMessage> messagesAvailableInRoom = new ArrayList<>();
private ChatService chatService;
private List<ChatMessage> messagesAvailableInRoom = new ArrayList<ChatMessage>();
public String getRoomName() {
return this.roomName;
}
@StrutsParameter
public void setRoomName(String roomName) {
this.roomName = roomName;
}
@@ -21,16 +21,16 @@
package org.apache.struts2.showcase.chat;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.action.SessionAware;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import java.util.Map;
import org.apache.struts2.action.SessionAware;
public class SendMessageToRoomAction extends ActionSupport implements SessionAware {
private static final long serialVersionUID = 1L;
private final ChatService chatService;
private ChatService chatService;
private String roomName;
private String message;
@@ -45,7 +45,6 @@ public class SendMessageToRoomAction extends ActionSupport implements SessionAwa
return this.roomName;
}
@StrutsParameter
public void setRoomName(String roomName) {
this.roomName = roomName;
}
@@ -54,12 +53,11 @@ public class SendMessageToRoomAction extends ActionSupport implements SessionAwa
return this.message;
}
@StrutsParameter
public void setMessage(String message) {
this.message = message;
}
@Override
public String execute() throws Exception {
User user = (User) session.get(ChatAuthenticationInterceptor.USER_SESSION_KEY);
try {
@@ -21,7 +21,6 @@
package org.apache.struts2.showcase.chat;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import java.util.ArrayList;
import java.util.List;
@@ -30,8 +29,8 @@ public class UsersAvailableInRoomAction extends ActionSupport {
private static final long serialVersionUID = 1L;
private final ChatService chatService;
private List<User> usersAvailableInRoom = new ArrayList<>();
private ChatService chatService;
private List<User> usersAvailableInRoom = new ArrayList<User>();
private String roomName;
@@ -44,7 +43,6 @@ public class UsersAvailableInRoomAction extends ActionSupport {
return this.roomName;
}
@StrutsParameter
public void setRoomName(String roomName) {
this.roomName = roomName;
}
@@ -53,7 +51,6 @@ public class UsersAvailableInRoomAction extends ActionSupport {
return usersAvailableInRoom;
}
@Override
public String execute() throws Exception {
try {
usersAvailableInRoom = chatService.getUsersAvailableInRoom(roomName);
@@ -34,7 +34,7 @@ public class OperationsEnumAction extends ActionSupport {
private static final long serialVersionUID = -2229489704988870318L;
private List<OperationsEnum> selectedOperations = new LinkedList<>();
private List<OperationsEnum> selectedOperations = new LinkedList<OperationsEnum>();
public String input() throws Exception {
return SUCCESS;
@@ -53,6 +53,7 @@ public class OperationsEnumAction extends ActionSupport {
this.selectedOperations = selectedOperations;
}
public List<OperationsEnum> getAvailableOperations() {
return Arrays.asList(OperationsEnum.values());
}
@@ -37,7 +37,6 @@ public class FileUploadAction extends ActionSupport implements UploadedFilesAwar
private String fileName;
private String caption;
private String originalName;
private String inputName;
public String input() throws Exception {
return SUCCESS;
@@ -59,10 +58,6 @@ public class FileUploadAction extends ActionSupport implements UploadedFilesAwar
return originalName;
}
public String getInputName() {
return inputName;
}
public Object getUploadedFile() {
return uploadedFile.getContent();
}
@@ -90,6 +85,5 @@ public class FileUploadAction extends ActionSupport implements UploadedFilesAwar
this.fileName = uploadedFile.getName();
this.contentType = uploadedFile.getContentType();
this.originalName = uploadedFile.getOriginalName();
this.inputName = uploadedFile.getInputName();
}
}
@@ -28,16 +28,12 @@ import org.apache.struts2.dispatcher.multipart.UploadedFile;
import java.util.List;
/**
* Showcase action - multiple file upload using array.
* Showcase action - mutiple file upload using array.
*/
public class MultipleFileUploadUsingArrayAction extends ActionSupport implements UploadedFilesAware {
private List<UploadedFile> uploadedFiles;
public List<UploadedFile> getUpload() {
return this.uploadedFiles;
}
public String upload() throws Exception {
System.out.println("\n\n upload2");
System.out.println("files:");
@@ -24,8 +24,8 @@ import com.opensymphony.xwork2.util.ValueStack;
import org.apache.struts2.views.freemarker.FreemarkerManager;
import org.apache.struts2.views.freemarker.ScopesHashModel;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
/**
* <p>
@@ -22,7 +22,6 @@ package org.apache.struts2.showcase.freemarker;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.Preparable;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import java.text.DateFormatSymbols;
@@ -35,7 +34,6 @@ public class StandardTagsAction extends ActionSupport implements Preparable {
private String[] gender;
private String[] months;
@Override
public void prepare() {
months = new DateFormatSymbols().getMonths();
name = StandardTagsAction.class.getName().substring(StandardTagsAction.class.getName().lastIndexOf(".") + 1);
@@ -46,7 +44,6 @@ public class StandardTagsAction extends ActionSupport implements Preparable {
return name;
}
@StrutsParameter
public void setName(String name) {
this.name = name;
}
@@ -55,16 +52,15 @@ public class StandardTagsAction extends ActionSupport implements Preparable {
return months;
}
@StrutsParameter
public void setMonths(String[] months) {
this.months = months;
}
public String[] getGender() {
return gender;
}
@StrutsParameter
public void setGender(String[] gender) {
this.gender = gender;
}
@@ -21,11 +21,11 @@
package org.apache.struts2.showcase.hangman;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.action.SessionAware;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import java.util.Map;
import org.apache.struts2.action.SessionAware;
public class GuessCharacterAction extends ActionSupport implements SessionAware {
private static final long serialVersionUID = 9050915577007590674L;
@@ -34,7 +34,6 @@ public class GuessCharacterAction extends ActionSupport implements SessionAware
private Character character;
private Hangman hangman;
@Override
public String execute() throws Exception {
hangman = (Hangman) session.get(HangmanConstants.HANGMAN_SESSION_KEY);
hangman.guess(character);
@@ -46,7 +45,6 @@ public class GuessCharacterAction extends ActionSupport implements SessionAware
return hangman;
}
@StrutsParameter
public void setCharacter(Character character) {
this.character = character;
}
@@ -18,7 +18,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.struts2.showcase.modelDriven.model;
package org.apache.struts2.showcase.modelDriven;
import java.io.Serializable;
@@ -22,7 +22,6 @@ package org.apache.struts2.showcase.modelDriven;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import org.apache.struts2.showcase.modelDriven.model.Gangster;
/**
* Action to demonstrate simple model-driven feature of the framework.
@@ -31,18 +30,15 @@ public class ModelDrivenAction extends ActionSupport implements ModelDriven {
private static final long serialVersionUID = 1271130427666936592L;
@Override
public String input() throws Exception {
return SUCCESS;
}
@Override
public String execute() throws Exception {
return SUCCESS;
}
@Override
public Gangster getModel() {
public Object getModel() {
return new Gangster();
}
}
@@ -23,10 +23,10 @@ package org.apache.struts2.showcase.person;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
@@ -42,14 +42,13 @@ public class EditPersonAction extends ActionSupport {
@Autowired
private PersonManager personManager;
private List<Person> persons = new ArrayList<>();
private List<Person> persons = new ArrayList<Person>();
/**
* A default implementation that does nothing an returns "success".
*
* @return {@link #INPUT}
*/
@Override
public String execute() throws Exception {
persons.addAll(personManager.getPeople());
return INPUT;
@@ -69,7 +68,6 @@ public class EditPersonAction extends ActionSupport {
return "list";
}
@StrutsParameter(depth = 2)
public List<Person> getPersons() {
return persons;
}
@@ -35,9 +35,8 @@ public class ListPeopleAction extends ActionSupport {
@Autowired
private PersonManager personManager;
private final List<Person> people = new ArrayList<>();
private List<Person> people = new ArrayList<Person>();
@Override
public String execute() {
people.addAll(personManager.getPeople());
@@ -23,7 +23,6 @@ package org.apache.struts2.showcase.person;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import org.springframework.beans.factory.annotation.Autowired;
@@ -39,14 +38,12 @@ public class NewPersonAction extends ActionSupport {
private PersonManager personManager;
private Person person;
@Override
public String execute() {
personManager.createPerson(person);
return "list";
}
@StrutsParameter(depth = 1)
public Person getPerson() {
return person;
}
@@ -20,10 +20,10 @@
*/
package org.apache.struts2.showcase.servlet;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
public class TestServlet extends HttpServlet {
@@ -23,9 +23,8 @@ package org.apache.struts2.showcase.source;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.util.ClassLoaderUtil;
import org.apache.struts2.action.ServletContextAware;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import javax.servlet.ServletContext;
import jakarta.servlet.ServletContext;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
@@ -99,9 +98,8 @@ public class ViewSourceAction extends ActionSupport implements ServletContextAwa
/**
* @param className the className to set
*/
@StrutsParameter
public void setClassName(String className) {
if (className != null && !className.trim().isEmpty()) {
if (className != null && className.trim().length() > 0) {
this.className = className;
}
}
@@ -109,9 +107,8 @@ public class ViewSourceAction extends ActionSupport implements ServletContextAwa
/**
* @param config the config to set
*/
@StrutsParameter
public void setConfig(String config) {
if (config != null && !config.trim().isEmpty()) {
if (config != null && config.trim().length() > 0) {
this.config = config;
}
}
@@ -119,9 +116,8 @@ public class ViewSourceAction extends ActionSupport implements ServletContextAwa
/**
* @param page the page to set
*/
@StrutsParameter
public void setPage(String page) {
if (page != null && !page.trim().isEmpty()) {
if (page != null && page.trim().length() > 0) {
this.page = page;
}
}
@@ -129,7 +125,6 @@ public class ViewSourceAction extends ActionSupport implements ServletContextAwa
/**
* @param padding the padding to set
*/
@StrutsParameter
public void setPadding(int padding) {
this.padding = padding;
}
@@ -227,7 +222,6 @@ public class ViewSourceAction extends ActionSupport implements ServletContextAwa
return snippet;
}
@Override
public void withServletContext(ServletContext arg0) {
this.servletContext = arg0;
}
@@ -21,7 +21,6 @@
package org.apache.struts2.showcase.tag.nonui.actionPrefix;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
public class SubmitAction extends ActionSupport {
@@ -33,12 +32,10 @@ public class SubmitAction extends ActionSupport {
return text;
}
@StrutsParameter
public void setText(String text) {
this.text = text;
}
@Override
public String execute() throws Exception {
return SUCCESS;
}
@@ -23,9 +23,8 @@ import org.apache.struts2.dispatcher.PrepareOperations;
public class DebugTagAction extends ActionSupport {
@Override
public String execute() throws Exception {
PrepareOperations.overrideDevMode(true); // Just for Showcase, explicitly switch on for this action only
return SUCCESS;
}
}
}
@@ -22,7 +22,6 @@ package org.apache.struts2.showcase.tag.nonui.iteratortag;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.Validateable;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
/**
*
@@ -48,25 +47,25 @@ public class AppendIteratorTagDemo extends ActionSupport implements Validateable
}
}
public String getIteratorValue1() {
return iteratorValue1;
}
@StrutsParameter
public void setIteratorValue1(String iteratorValue1) {
this.iteratorValue1 = iteratorValue1;
}
public String getIteratorValue2() {
return iteratorValue2;
}
@StrutsParameter
public void setIteratorValue2(String iteratorValue2) {
this.iteratorValue2 = iteratorValue2;
}
@Override
public String input() throws Exception {
return SUCCESS;
}
@@ -21,7 +21,6 @@
package org.apache.struts2.showcase.tag.nonui.iteratortag;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
/**
*/
@@ -38,34 +37,34 @@ public class IteratorGeneratorTagDemo extends ActionSupport {
return value;
}
@StrutsParameter
public void setValue(String value) {
this.value = value;
}
public Integer getCount() {
return count;
}
@StrutsParameter
public void setCount(Integer count) {
this.count = count;
}
public String getSeparator() {
return this.separator;
}
@StrutsParameter
public void setSeparator(String separator) {
this.separator = separator;
}
public String submit() throws Exception {
return SUCCESS;
}
@Override
public String input() throws Exception {
return SUCCESS;
}
@@ -22,7 +22,6 @@ package org.apache.struts2.showcase.tag.nonui.iteratortag;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.Validateable;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
/**
@@ -34,7 +33,7 @@ public class MergeIteratorTagDemo extends ActionSupport implements Validateable
private String iteratorValue1;
private String iteratorValue2;
@Override
public void validate() {
if (iteratorValue1 == null || iteratorValue1.trim().length() <= 0) {
addFieldError("iteratorValue1", "iterator value 1 cannot be empty");
@@ -48,25 +47,25 @@ public class MergeIteratorTagDemo extends ActionSupport implements Validateable
}
}
public String getIteratorValue1() {
return this.iteratorValue1;
}
@StrutsParameter
public void setIteratorValue1(String iteratorValue1) {
this.iteratorValue1 = iteratorValue1;
}
public String getIteratorValue2() {
return this.iteratorValue2;
}
@StrutsParameter
public void setIteratorValue2(String iteratorValue2) {
this.iteratorValue2 = iteratorValue2;
}
@Override
public String input() throws Exception {
return SUCCESS;
}
@@ -22,7 +22,6 @@ package org.apache.struts2.showcase.tag.nonui.iteratortag;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.Validateable;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
/**
*
@@ -35,7 +34,7 @@ public class SubsetIteratorTagDemo extends ActionSupport implements Validateable
private Integer count;
private Integer start;
@Override
public void validate() {
if (iteratorValue == null || iteratorValue.trim().length() <= 0) {
addFieldError("iteratorValue1", "iterator value 1 cannot be empty");
@@ -44,34 +43,34 @@ public class SubsetIteratorTagDemo extends ActionSupport implements Validateable
}
}
public String getIteratorValue() {
return this.iteratorValue;
}
@StrutsParameter
public void setIteratorValue(String iteratorValue) {
this.iteratorValue = iteratorValue;
}
public Integer getCount() {
return this.count;
}
@StrutsParameter
public void setCount(Integer count) {
this.count = count;
}
public Integer getStart() {
return this.start;
}
@StrutsParameter
public void setStart(Integer start) {
this.start = start;
}
@Override
public String input() throws Exception {
return SUCCESS;
}
@@ -79,4 +78,6 @@ public class SubsetIteratorTagDemo extends ActionSupport implements Validateable
public String submit() throws Exception {
return SUCCESS;
}
}
@@ -22,7 +22,6 @@ package org.apache.struts2.showcase.token;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import java.util.Date;
@@ -77,7 +76,6 @@ public class TokenAction extends ActionSupport {
return amount;
}
@StrutsParameter
public void setAmount(int amount) {
this.amount = amount;
}
@@ -30,7 +30,6 @@ public abstract class AbstractValidationActionSupport extends ActionSupport {
return "success";
}
@Override
public String input() throws Exception {
return "input";
}
@@ -18,6 +18,8 @@
*/
package org.apache.struts2.showcase.validation;
import java.sql.Date;
import com.opensymphony.xwork2.validator.annotations.DateRangeFieldValidator;
import com.opensymphony.xwork2.validator.annotations.EmailValidator;
import com.opensymphony.xwork2.validator.annotations.FieldExpressionValidator;
@@ -27,9 +29,6 @@ import com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator;
import com.opensymphony.xwork2.validator.annotations.RequiredStringValidator;
import com.opensymphony.xwork2.validator.annotations.StringLengthFieldValidator;
import com.opensymphony.xwork2.validator.annotations.UrlValidator;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import java.sql.Date;
/**
* <!-- START SNIPPET: ajaxFormSubmit -->
@@ -73,10 +72,9 @@ public class AjaxFormSubmitAction extends AbstractValidationActionSupport {
}
@DateRangeFieldValidator(
min="01/01/1990",
max="01/01/2000",
min="01/01/1990",
max="01/01/2000",
message="must be a min 01-01-1990 max 01-01-2000 if supplied")
@StrutsParameter
public void setDateValidatorField(Date dateValidatorField) {
this.dateValidatorField = dateValidatorField;
}
@@ -86,7 +84,6 @@ public class AjaxFormSubmitAction extends AbstractValidationActionSupport {
}
@EmailValidator(message="must be a valid email if supplied")
@StrutsParameter
public void setEmailValidatorField(String emailValidatorField) {
this.emailValidatorField = emailValidatorField;
}
@@ -96,7 +93,6 @@ public class AjaxFormSubmitAction extends AbstractValidationActionSupport {
}
@IntRangeFieldValidator(min="1", max="10", message="must be integer min 1 max 10 if supplied")
@StrutsParameter
public void setIntegerValidatorField(Integer integerValidatorField) {
this.integerValidatorField = integerValidatorField;
}
@@ -106,9 +102,8 @@ public class AjaxFormSubmitAction extends AbstractValidationActionSupport {
}
@RegexFieldValidator(
regex="[^<>]+",
regex="[^<>]+",
message="regexValidatorField must match a regexp (.*\\.txt) if specified")
@StrutsParameter
public void setRegexValidatorField(String regexValidatorField) {
this.regexValidatorField = regexValidatorField;
}
@@ -118,7 +113,6 @@ public class AjaxFormSubmitAction extends AbstractValidationActionSupport {
}
@RequiredStringValidator(trim=true, message="required and must be string")
@StrutsParameter
public void setRequiredStringValidatorField(String requiredStringValidatorField) {
this.requiredStringValidatorField = requiredStringValidatorField;
}
@@ -128,7 +122,6 @@ public class AjaxFormSubmitAction extends AbstractValidationActionSupport {
}
@RequiredFieldValidator(message="required")
@StrutsParameter
public void setRequiredValidatorField(String requiredValidatorField) {
this.requiredValidatorField = requiredValidatorField;
}
@@ -138,11 +131,10 @@ public class AjaxFormSubmitAction extends AbstractValidationActionSupport {
}
@StringLengthFieldValidator(
minLength="2",
maxLength="4",
trim=true,
minLength="2",
maxLength="4",
trim=true,
message="must be a String of a specific greater than 1 less than 5 if specified")
@StrutsParameter
public void setStringLengthValidatorField(String stringLengthValidatorField) {
this.stringLengthValidatorField = stringLengthValidatorField;
}
@@ -152,10 +144,10 @@ public class AjaxFormSubmitAction extends AbstractValidationActionSupport {
}
@FieldExpressionValidator(
expression = "(fieldExpressionValidatorField == requiredValidatorField)",
expression = "(fieldExpressionValidatorField == requiredValidatorField)",
message = "must be the same as the Required Validator Field if specified")
@StrutsParameter
public void setFieldExpressionValidatorField(String fieldExpressionValidatorField) {
public void setFieldExpressionValidatorField(
String fieldExpressionValidatorField) {
this.fieldExpressionValidatorField = fieldExpressionValidatorField;
}
@@ -164,7 +156,6 @@ public class AjaxFormSubmitAction extends AbstractValidationActionSupport {
}
@UrlValidator(message="must be a valid url if supplied")
@StrutsParameter
public void setUrlValidatorField(String urlValidatorField) {
this.urlValidatorField = urlValidatorField;
}
@@ -26,18 +26,17 @@ import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import org.apache.struts2.interceptor.validation.SkipValidation;
import org.hibernate.validator.constraints.ScriptAssert;
import org.hibernate.validator.constraints.URL;
import javax.validation.constraints.Email;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import java.util.Date;
// <!-- START SNIPPET: beanValidationExample -->
@@ -96,7 +95,6 @@ public class BeanValidationExampleAction extends ActionSupport {
return dateValidatorField;
}
@StrutsParameter
public void setDateValidatorField(Date dateValidatorField) {
this.dateValidatorField = dateValidatorField;
}
@@ -105,7 +103,6 @@ public class BeanValidationExampleAction extends ActionSupport {
return emailValidatorField;
}
@StrutsParameter
public void setEmailValidatorField(String emailValidatorField) {
this.emailValidatorField = emailValidatorField;
}
@@ -114,7 +111,6 @@ public class BeanValidationExampleAction extends ActionSupport {
return integerValidatorField;
}
@StrutsParameter
public void setIntegerValidatorField(Integer integerValidatorField) {
this.integerValidatorField = integerValidatorField;
}
@@ -123,7 +119,6 @@ public class BeanValidationExampleAction extends ActionSupport {
return regexValidatorField;
}
@StrutsParameter
public void setRegexValidatorField(String regexValidatorField) {
this.regexValidatorField = regexValidatorField;
}
@@ -132,7 +127,6 @@ public class BeanValidationExampleAction extends ActionSupport {
return requiredStringValidatorField;
}
@StrutsParameter
public void setRequiredStringValidatorField(String requiredStringValidatorField) {
this.requiredStringValidatorField = requiredStringValidatorField;
}
@@ -141,7 +135,6 @@ public class BeanValidationExampleAction extends ActionSupport {
return requiredValidatorField;
}
@StrutsParameter
public void setRequiredValidatorField(String requiredValidatorField) {
this.requiredValidatorField = requiredValidatorField;
}
@@ -150,7 +143,6 @@ public class BeanValidationExampleAction extends ActionSupport {
return stringLengthValidatorField;
}
@StrutsParameter
public void setStringLengthValidatorField(String stringLengthValidatorField) {
this.stringLengthValidatorField = stringLengthValidatorField;
}
@@ -159,8 +151,8 @@ public class BeanValidationExampleAction extends ActionSupport {
return fieldExpressionValidatorField;
}
@StrutsParameter
public void setFieldExpressionValidatorField(String fieldExpressionValidatorField) {
public void setFieldExpressionValidatorField(
String fieldExpressionValidatorField) {
this.fieldExpressionValidatorField = fieldExpressionValidatorField;
}
@@ -168,7 +160,6 @@ public class BeanValidationExampleAction extends ActionSupport {
return urlValidatorField;
}
@StrutsParameter
public void setUrlValidatorField(String urlValidatorField) {
this.urlValidatorField = urlValidatorField;
}
@@ -20,8 +20,6 @@
*/
package org.apache.struts2.showcase.validation;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
/**
*/
@@ -39,7 +37,6 @@ public class NonFieldValidatorsExampleAction extends AbstractValidationActionSup
return someText;
}
@StrutsParameter
public void setSomeText(String someText) {
this.someText = someText;
}
@@ -48,7 +45,6 @@ public class NonFieldValidatorsExampleAction extends AbstractValidationActionSup
return someTextRetype;
}
@StrutsParameter
public void setSomeTextRetype(String someTextRetype) {
this.someTextRetype = someTextRetype;
}
@@ -57,7 +53,6 @@ public class NonFieldValidatorsExampleAction extends AbstractValidationActionSup
return someTextRetypeAgain;
}
@StrutsParameter
public void setSomeTextRetypeAgain(String someTextRetypeAgain) {
this.someTextRetypeAgain = someTextRetypeAgain;
}
@@ -21,7 +21,6 @@
package org.apache.struts2.showcase.validation;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
/**
*/
@@ -40,7 +39,6 @@ public class QuizAction extends ActionSupport {
return name;
}
@StrutsParameter
public void setName(String name) {
this.name = name;
}
@@ -49,7 +47,6 @@ public class QuizAction extends ActionSupport {
return age;
}
@StrutsParameter
public void setAge(int age) {
this.age = age;
}
@@ -58,7 +55,6 @@ public class QuizAction extends ActionSupport {
return answer;
}
@StrutsParameter
public void setAnswer(String answer) {
this.answer = answer;
}
@@ -21,7 +21,6 @@
package org.apache.struts2.showcase.validation;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
/**
* @version $Date$ $Id$
@@ -31,7 +30,6 @@ public class SubmitApplication extends ActionSupport {
private String name;
private Integer age;
@StrutsParameter
public void setName(String name) {
this.name = name;
}
@@ -40,7 +38,6 @@ public class SubmitApplication extends ActionSupport {
return this.name;
}
@StrutsParameter
public void setAge(Integer age) {
this.age = age;
}
@@ -23,15 +23,12 @@ package org.apache.struts2.showcase.validation;
// START SNIPPET: visitorValidatorsExample
import org.apache.struts2.interceptor.parameter.StrutsParameter;
public class VisitorValidatorsExampleAction extends AbstractValidationActionSupport {
private static final long serialVersionUID = 4375454086939598216L;
private User user;
@StrutsParameter(depth = 1)
public User getUser() {
return user;
}
@@ -21,9 +21,11 @@
package org.apache.struts2.showcase.xslt;
import com.opensymphony.xwork2.ActionSupport;
import jakarta.servlet.http.HttpServletRequest;
import org.apache.struts2.action.ServletRequestAware;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
import java.util.Properties;
@@ -70,7 +72,7 @@ public class JVMAction implements ServletRequestAware {
this.info = info;
}
public static class ImportantInfo {
public class ImportantInfo {
private String classpath;
private Properties systemProperties;
@@ -24,6 +24,9 @@
"https://struts.apache.org/dtds/struts-6.0.dtd">
<struts>
<constant name="struts.multipart.maxSize" value="10240" />
<package name="fileupload" extends="struts-default" namespace="/fileupload">
<action name="upload" class="org.apache.struts2.showcase.fileupload.FileUploadAction" method="input">
@@ -40,7 +43,7 @@
</action>
<action name="doMultipleUploadUsingList" class="org.apache.struts2.showcase.fileupload.MultipleFileUploadUsingListAction" method="upload">
<result name="input">/WEB-INF/fileupload/multipleUploadUsingList.jsp</result>
<result name="input">/WEB-INF/fileupload/multipleUploadUsingList.jsp</result>
<result>/WEB-INF/fileupload/multiple-success.jsp</result>
</action>
@@ -50,7 +53,7 @@
</action>
<action name="doMultipleUploadUsingArray" class="org.apache.struts2.showcase.fileupload.MultipleFileUploadUsingArrayAction" method="upload">
<result name="input">/WEB-INF/fileupload/multipleUploadUsingArray.jsp</result>
<result name="input">/WEB-INF/fileupload/multipleUploadUsingArray.jsp</result>
<result>/WEB-INF/fileupload/multiple-success.jsp</result>
</action>
@@ -47,12 +47,7 @@
<result>/WEB-INF/validation/quiz-success.jsp</result>
</action>
<action name="quizDwr" class="org.apache.struts2.showcase.validation.QuizAction">
<result name="input">/WEB-INF/validation/quiz-dwr.jsp</result>
<result>/WEB-INF/validation/quiz-success.jsp</result>
</action>
<action name="quizClientCss" class="org.apache.struts2.showcase.validation.QuizAction">
<action name="quizClientCss" class="org.apache.struts2.showcase.validation.QuizAction">
<result name="input">/WEB-INF/validation/quiz-client-css.jsp</result>
<result>/WEB-INF/validation/quiz-success.jsp</result>
</action>
@@ -36,15 +36,6 @@
<constant name="struts.allowlist.enable" value="true" />
<constant name="struts.parameters.requireAnnotations" value="true" />
<constant name="struts.allowlist.packageNames" value="
org.apache.struts2.showcase.model,
org.apache.struts2.showcase.modelDriven.model
"/>
<constant name="struts.allowlist.classes" value="
org.apache.struts2.showcase.hangman.Hangman,
org.apache.struts2.showcase.hangman.HangmanConstants,
org.apache.struts2.showcase.hangman.Vocab
"/>
<constant name="struts.convention.package.locators.basePackage" value="org.apache.struts2.showcase" />
<constant name="struts.convention.result.path" value="/WEB-INF" />
@@ -226,7 +226,6 @@
<li><s:a href="%{storeMessageAcrossRequestExample}">Store across request using MessageStoreInterceptor (Example)</s:a></li>
<li><s:a href="%{quizBasic}">Validation (basic)</s:a></li>
<li><s:a href="%{quizClient}">Validation (client)</s:a></li>
<li><s:a href="%{quizDwr}">Validation (DWR)</s:a></li>
<li><s:a href="%{quizClientCss}">Validation (client using css_xhtml theme)</s:a></li>
<li><s:a href="%{visitorValidatorUrl}">Visitor Validator</s:a></li>
<li><s:a href="%{ajaxFormSubmitUrl}">AJAX Form Submit</s:a></li>
@@ -41,8 +41,8 @@
<li>FileName: <s:property value="fileName" /></li>
<li>Original FileName: <s:property value="originalName" /></li>
<li>File: <s:property value="uploadedFile" /></li>
<li>Caption: <s:property value="caption" /></li>
<li id="input-name">Input name: <s:property value="inputName" /></li>
<li>Size: <s:property value="uploadSize" /></li>
<li>Caption: <s:property value="caption" /></li>
</ul>
</div>
</div>
@@ -1,92 +0,0 @@
<!--
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-->
<%@ taglib prefix="s" uri="/struts-tags" %>
<!-- START SNIPPET: dwrValidation -->
<html>
<head>
<title>Struts2 Showcase - Validation - DWR</title>
<s:head/>
<s:script type='text/javascript' src='../dwr/engine.js'></s:script>
<s:script type='text/javascript' src='../dwr/util.js'></s:script>
<s:script type='text/javascript' src='../dwr/interface/validator.js'></s:script>
<s:script type='text/javascript'>
var dwrValidateReply = function(data) {
var validationResult = '';
for (index = 0; index < data.actionErrors.length; ++index) {
validationResult += (data.actionErrors[index] + '. ');
}
for (index = 0; index < data.actionMessages.length; ++index) {
validationResult += (data.actionMessages[index] + '. ');
}
if (typeof data.fieldErrors.name !== 'undefined') {
for (index = 0; index < data.fieldErrors.name.length; ++index) {
validationResult += (data.fieldErrors.name[index] + '. ');
}
}
if (typeof data.fieldErrors.age !== 'undefined') {
for (index = 0; index < data.fieldErrors.age.length; ++index) {
validationResult += (data.fieldErrors.age[index] + '. ');
}
}
if (validationResult === '') {
$('form').submit();
} else {
dwr.util.setValue('validationResult', validationResult);
}
};
function dwrFormValidation() {
var postData = {};
$('form').serializeArray().map(function (x) {
postData[x.name] = x.value;
});
validator.doPost('/validation', 'quizDwr', postData, dwrValidateReply);
return false;
}
</s:script>
</head>
<body>
<div class="page-header">
<h1>DWR validation Example</h1>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<s:form method="post">
<s:textfield label="Name" name="name"/>
<s:textfield label="Age" name="age"/>
<s:textfield label="Favorite color" name="answer"/>
<s:submit cssClass="btn btn-primary" onClick="return dwrFormValidation()"/>
</s:form>
<div id="validationResult" class="errorMessage"></div>
</div>
</div>
</div>
</body>
</html>
<!-- END SNIPPET: dwrValidation -->
+1 -18
View File
@@ -98,16 +98,6 @@
<listener-class>org.apache.struts2.dispatcher.listener.StrutsListener</listener-class>
</listener>
<!-- SNIPPET START: dwr -->
<servlet>
<servlet-name>dwr</servlet-name>
<servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>JspSupportServlet</servlet-name>
<servlet-class>org.apache.struts2.views.JspSupportServlet</servlet-class>
@@ -147,12 +137,7 @@
<servlet-class>org.apache.struts2.showcase.servlet.TestServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>dwr</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-mapping>
<servlet-name>sitemesh-freemarker</servlet-name>
<url-pattern>*.ftl</url-pattern>
</servlet-mapping>
@@ -172,8 +157,6 @@
<url-pattern>/testServlet/*</url-pattern>
</servlet-mapping>
<!-- END SNIPPET: dwr -->
<!-- SNIPPET START: example.velocity.filter.chain
<filter>
<filter-name>struts-cleanup</filter-name>
@@ -20,12 +20,11 @@
*/
package it.org.apache.struts2.showcase;
import org.htmlunit.WebClient;
import org.htmlunit.html.HtmlPage;
import org.junit.Assert;
import org.junit.Test;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
public class ActionChainingTest {
@Test
public void test() throws Exception {
@@ -20,12 +20,11 @@
*/
package it.org.apache.struts2.showcase;
import org.htmlunit.WebClient;
import org.htmlunit.html.HtmlPage;
import org.junit.Assert;
import org.junit.Test;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
public class ActionTagExampleTest {
@Test
public void test() throws Exception {
@@ -18,16 +18,15 @@
*/
package it.org.apache.struts2.showcase;
import org.htmlunit.WebClient;
import org.htmlunit.html.DomElement;
import org.htmlunit.html.HtmlForm;
import org.htmlunit.html.HtmlPage;
import org.htmlunit.html.HtmlSubmitInput;
import org.htmlunit.html.HtmlTextInput;
import org.junit.Assert;
import org.junit.Test;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.DomElement;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
public class AsyncTest {
@Test
public void testChatRoom() throws Exception {
@@ -20,15 +20,14 @@
*/
package it.org.apache.struts2.showcase;
import org.htmlunit.WebClient;
import org.htmlunit.html.HtmlForm;
import org.htmlunit.html.HtmlPage;
import org.htmlunit.html.HtmlSubmitInput;
import org.htmlunit.html.HtmlTextInput;
import org.junit.Assert;
import org.junit.Test;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
public class CRUDTest {
@Test
public void testCreate() throws Exception {
@@ -20,12 +20,11 @@
*/
package it.org.apache.struts2.showcase;
import org.htmlunit.WebClient;
import org.htmlunit.html.HtmlPage;
import org.junit.Assert;
import org.junit.Test;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
public class ComponentTagExampleTest {
@Test
public void test() throws Exception {
@@ -1,88 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package it.org.apache.struts2.showcase;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
public class ConventionTest {
private WebClient webClient;
@Before
public void setUp() throws Exception {
webClient = new WebClient();
}
@After
public void tearDown() throws Exception {
webClient.close();
}
@Test
public void listPeople() throws Exception {
HtmlPage page = webClient.getPage(ParameterUtils.getBaseUrl() + "/person/list-people.action");
assertThat(page.asNormalizedText()).contains(
"3\tAlexandru\tPapesco\n" +
"4\tJay\tBoss\n" +
"5\tRainer\tHermanos\n"
);
}
@Test
public void editPeople() throws Exception {
HtmlPage page = webClient.getPage(ParameterUtils.getBaseUrl() + "/person/edit-person.action");
HtmlForm form = page.getForms().get(0);
form.getInputByName("persons(1).name").setValue("Lukasz");
form.getInputByName("persons(1).lastName").setValue("Lenart");
form.getInputByName("persons(2).name").setValue("Kusal");
form.getInputByName("persons(2).lastName").setValue("Kithul-Godage");
HtmlSubmitInput button = form.getInputByValue("Save all persons");
page = button.click();
assertThat(page.asNormalizedText()).contains(
"1\tLukasz\tLenart\n" +
"2\tKusal\tKithul-Godage\n"
);
}
@Test
public void createPerson() throws Exception {
HtmlPage page = webClient.getPage(ParameterUtils.getBaseUrl() + "/person/new-person!input.action");
HtmlForm form = page.getForms().get(0);
form.getInputByName("person.name").type("Lukasz");
form.getInputByName("person.lastName").type("Lenart");
HtmlSubmitInput button = form.getInputByValue("Create person");
page = button.click();
assertThat(page.asNormalizedText()).contains("6\tLukasz\tLenart\n");
}
}
@@ -20,14 +20,13 @@
*/
package it.org.apache.struts2.showcase;
import org.htmlunit.WebClient;
import org.htmlunit.html.HtmlForm;
import org.htmlunit.html.HtmlPage;
import org.htmlunit.html.HtmlSubmitInput;
import org.junit.Assert;
import org.junit.Test;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
public class ConversionTest {
@Test
public void testList() throws Exception {
@@ -18,9 +18,9 @@
*/
package it.org.apache.struts2.showcase;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.DomElement;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import org.htmlunit.WebClient;
import org.htmlunit.html.DomElement;
import org.htmlunit.html.HtmlPage;
import org.junit.Assert;
import org.junit.Test;
@@ -20,15 +20,14 @@
*/
package it.org.apache.struts2.showcase;
import org.htmlunit.WebClient;
import org.htmlunit.html.HtmlForm;
import org.htmlunit.html.HtmlPage;
import org.htmlunit.html.HtmlSubmitInput;
import org.htmlunit.html.HtmlTextInput;
import org.junit.Assert;
import org.junit.Test;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
public class ExecAndWaitTest {
@Test
public void testNodelay() throws Exception {
@@ -24,12 +24,11 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import org.htmlunit.Page;
import org.htmlunit.WebClient;
import org.junit.Assert;
import org.junit.Test;
import com.gargoylesoftware.htmlunit.Page;
import com.gargoylesoftware.htmlunit.WebClient;
public class FileDownloadTest {
@Test
public void testImage() throws Exception {
@@ -18,62 +18,82 @@
*/
package it.org.apache.struts2.showcase;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.DomElement;
import com.gargoylesoftware.htmlunit.html.HtmlFileInput;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlInput;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
import org.htmlunit.WebClient;
import org.htmlunit.html.HtmlFileInput;
import org.htmlunit.html.HtmlForm;
import org.htmlunit.html.HtmlInput;
import org.htmlunit.html.HtmlPage;
import org.htmlunit.html.HtmlSubmitInput;
import org.junit.Test;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.io.FileWriter;
import java.security.SecureRandom;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.assertj.core.api.Assertions.assertThat;
public class FileUploadTest {
@Test
public void testEmptyFile() throws Exception {
public void testSimpleFileUpload() throws Exception {
try (final WebClient webClient = new WebClient()) {
final HtmlPage page = webClient.getPage(ParameterUtils.getBaseUrl() + "/fileupload/doUpload.action");
final HtmlForm form = page.getFormByName("doUpload");
HtmlInput captionInput = form.getInputByName("caption");
HtmlFileInput uploadInput = form.getInputByName("upload");
captionInput.type("some caption");
File tempFile = File.createTempFile("testEmptyFile", ".tmp");
File tempFile = File.createTempFile("testEmptyFile", ".txt");
tempFile.deleteOnExit();
uploadInput.setValueAttribute(tempFile.getAbsolutePath());
try (FileWriter writer = new FileWriter(tempFile)) {
writer.append("Some strings");
writer.flush();
}
uploadInput.setValue(tempFile.getAbsolutePath());
final HtmlSubmitInput button = form.getInputByValue("Submit");
final HtmlPage resultPage = button.click();
DomElement errorMessage = resultPage.getFirstByXPath("//span[@class='errorMessage']");
assertNotNull(errorMessage);
assertEquals("File cannot be empty", errorMessage.getVisibleText());
String content = resultPage.getVisibleText();
assertThat(content).contains(
"ContentType: text/plain",
"Original FileName: " + tempFile.getName(),
"Caption: some caption",
"Size: 12"
);
}
}
@Test
public void testFileUpload() throws Exception {
public void testUploadOverMaxSize() throws Exception {
try (final WebClient webClient = new WebClient()) {
final HtmlPage page = webClient.getPage(ParameterUtils.getBaseUrl() + "/fileupload/doUpload.action");
final HtmlForm form = page.getFormByName("doUpload");
HtmlInput captionInput = form.getInputByName("caption");
HtmlFileInput uploadInput = form.getInputByName("upload");
captionInput.type("some caption");
File tempFile = File.createTempFile("testEmptyFile", ".tmp");
Files.write(Paths.get(tempFile.toURI()), "some content".getBytes());
captionInput.type("Large file");
File tempFile = File.createTempFile("testEmptyFile", ".txt");
SecureRandom rng = new SecureRandom();
tempFile.deleteOnExit();
uploadInput.setValueAttribute(tempFile.getAbsolutePath());
try (FileWriter writer = new FileWriter(tempFile)) {
for (int i = 0; i < 10240; ++i) {
String line = String.format("%s %s%n", rng.nextInt(), rng.nextInt());
writer.append(line);
}
writer.flush();
}
uploadInput.setValue(tempFile.getAbsolutePath());
final HtmlSubmitInput button = form.getInputByValue("Submit");
final HtmlPage resultPage = button.click();
DomElement inputName = resultPage.getElementById("input-name");
assertNotNull(inputName);
assertEquals("Input name: upload", inputName.getTextContent().trim());
String content = resultPage.getVisibleText();
System.out.println(content);
assertThat(content).contains(
"Request exceeded allowed size limit! Max size allowed is: 10,240!"
);
}
}
@@ -20,9 +20,9 @@
*/
package it.org.apache.struts2.showcase;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.DomElement;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import org.htmlunit.WebClient;
import org.htmlunit.html.DomElement;
import org.htmlunit.html.HtmlPage;
import org.junit.Assert;
import org.junit.Test;
@@ -20,13 +20,12 @@
*/
package it.org.apache.struts2.showcase;
import org.htmlunit.WebClient;
import org.htmlunit.html.DomElement;
import org.htmlunit.html.HtmlPage;
import org.junit.Assert;
import org.junit.Test;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.DomElement;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
public class FreeMarkerManagerTest {
@Test
public void testCustomManager() throws Exception {
@@ -36,11 +35,11 @@ public class FreeMarkerManagerTest {
final DomElement date = page.getElementById("todaysDate");
Assert.assertNotNull(date);
Assert.assertTrue(date.asNormalizedText().length() > 0);
Assert.assertFalse(date.asNormalizedText().isEmpty());
final DomElement time = page.getElementById("timeNow");
Assert.assertNotNull(time);
Assert.assertTrue(time.asNormalizedText().length() > 0);
Assert.assertFalse(time.asNormalizedText().isEmpty());
}
}
@@ -18,16 +18,15 @@
*/
package it.org.apache.struts2.showcase;
import org.htmlunit.FailingHttpStatusCodeException;
import org.htmlunit.WebClient;
import org.junit.Assert;
import org.junit.Test;
import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
import com.gargoylesoftware.htmlunit.WebClient;
public class StaticContentTest {
@Test
public void testInvalidRersources1() throws Exception {
public void testInvalidResources1() throws Exception {
try (final WebClient webClient = new WebClient()) {
try {
webClient.getPage(ParameterUtils.getBaseUrl() + "/struts..");
@@ -40,7 +39,7 @@ public class StaticContentTest {
}
@Test
public void testInvalidRersources2() throws Exception {
public void testInvalidResources2() throws Exception {
try (final WebClient webClient = new WebClient()) {
try {
webClient.getPage(ParameterUtils.getBaseUrl() + "/static/..%252f");
@@ -18,8 +18,8 @@
*/
package it.org.apache.struts2.showcase;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import org.htmlunit.WebClient;
import org.htmlunit.html.HtmlPage;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -20,18 +20,17 @@
*/
package it.org.apache.struts2.showcase;
import org.htmlunit.WebClient;
import org.htmlunit.html.HtmlCheckBoxInput;
import org.htmlunit.html.HtmlForm;
import org.htmlunit.html.HtmlPage;
import org.htmlunit.html.HtmlSelect;
import org.htmlunit.html.HtmlSubmitInput;
import org.htmlunit.html.HtmlTextArea;
import org.htmlunit.html.HtmlTextInput;
import org.junit.Assert;
import org.junit.Test;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlCheckBoxInput;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlSelect;
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
import com.gargoylesoftware.htmlunit.html.HtmlTextArea;
import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
public class UITagExampleTest {
@Test
public void testInputForm() throws Exception {
@@ -20,14 +20,13 @@
*/
package it.org.apache.struts2.showcase;
import org.htmlunit.WebClient;
import org.htmlunit.html.HtmlForm;
import org.htmlunit.html.HtmlPage;
import org.htmlunit.html.HtmlSubmitInput;
import org.junit.Assert;
import org.junit.Test;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
public class ValidationTest {
@Test
public void testFieldValidators() throws Exception {
+3 -56
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>6.11.0-SNAPSHOT</version>
<version>7.0.0-M5</version>
</parent>
<artifactId>struts2-assembly</artifactId>
@@ -104,9 +104,7 @@
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.8.0</version>
<executions>
<execution>
<id>make-assembly</id>
@@ -126,8 +124,8 @@
<descriptor>src/main/assembly/docs.xml</descriptor>
</descriptors>
<finalName>struts-${project.version}</finalName>
<outputDirectory>target/assembly/out</outputDirectory>
<workDirectory>target/assembly/work</workDirectory>
<outputDirectory>${project.build.directory}/assembly/out</outputDirectory>
<workDirectory>${project.build.directory}/assembly/work</workDirectory>
</configuration>
</plugin>
</plugins>
@@ -165,11 +163,6 @@
<artifactId>struts2-config-browser-plugin</artifactId>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-dwr-plugin</artifactId>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-jasperreports-plugin</artifactId>
@@ -185,21 +178,6 @@
<artifactId>struts2-junit-plugin</artifactId>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-pell-multipart-plugin</artifactId>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plexus-plugin</artifactId>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-portlet-plugin</artifactId>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-rest-plugin</artifactId>
@@ -223,40 +201,9 @@
<artifactId>struts2-tiles-plugin</artifactId>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-oval-plugin</artifactId>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-json-plugin</artifactId>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-embeddedjsp-plugin</artifactId>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-gxp-plugin</artifactId>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-osgi-plugin</artifactId>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-osgi-admin-bundle</artifactId>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-osgi-demo-bundle</artifactId>
</dependency>
</dependencies>
</project>

Some files were not shown because too many files have changed in this diff Show More