Compare commits

..

101 Commits

Author SHA1 Message Date
Lukasz Lenart a41f1118fd [maven-release-plugin] copy for tag STRUTS_2_3_5
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5@1394506 13f79535-47bb-0310-9956-ffa450edef68
2012-10-05 13:29:13 +00:00
Lukasz Lenart 755caae35d [maven-release-plugin] prepare release STRUTS_2_3_5
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1394505 13f79535-47bb-0310-9956-ffa450edef68
2012-10-05 13:29:07 +00:00
Lukasz Lenart 497c6616cc WW-3884 upgrades version of archetypes
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1394499 13f79535-47bb-0310-9956-ffa450edef68
2012-10-05 13:12:40 +00:00
Lukasz Lenart 08fa6a2cf2 WW-3884 changes site target
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1394497 13f79535-47bb-0310-9956-ffa450edef68
2012-10-05 13:11:24 +00:00
Lukasz Lenart 2784e24fe3 WW-3872 adds Tiles support to portlet example app
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1394440 13f79535-47bb-0310-9956-ffa450edef68
2012-10-05 10:54:36 +00:00
Lukasz Lenart b83b8586e0 WW-3865 rollbacks changes to TokenInterceptor applied with WW-3582 and adds new method handleToken() to allow in different way lock session object
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1394422 13f79535-47bb-0310-9956-ffa450edef68
2012-10-05 09:35:28 +00:00
Lukasz Lenart 3cf58aa002 WW-3880 adds logging when parameter wasn't accepted
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1390696 13f79535-47bb-0310-9956-ffa450edef68
2012-09-26 19:45:24 +00:00
Lukasz Lenart 2cf6cf5bcf WW-3879 Changes logic when the location is path and when full url address
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1390692 13f79535-47bb-0310-9956-ffa450edef68
2012-09-26 19:27:41 +00:00
Johannes Geppert b84a1a9e9c WW-388: Update UI tags in FreeMarker to allow new HTML input types
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1389534 13f79535-47bb-0310-9956-ffa450edef68
2012-09-24 19:43:44 +00:00
Lukasz Lenart 76ff5832b5 WW-3876 adds additional test cases for NumberConverter
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1385022 13f79535-47bb-0310-9956-ffa450edef68
2012-09-15 06:50:08 +00:00
Lukasz Lenart 3a03c3d735 WW-3811 adds a new constant struts.handle.exception to control when Dispatcher should handle exception and when rethrow it
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1384108 13f79535-47bb-0310-9956-ffa450edef68
2012-09-12 20:18:45 +00:00
Lukasz Lenart 3547865941 WW-3840 corrects LOG and reduce log level to debug inside cleanUp() method
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1384107 13f79535-47bb-0310-9956-ffa450edef68
2012-09-12 20:14:23 +00:00
Lukasz Lenart 95f94ccb64 WW-3144 Adds additional test case to prove that there no problem
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1384088 13f79535-47bb-0310-9956-ffa450edef68
2012-09-12 19:11:29 +00:00
Lukasz Lenart 075f5bdae4 Sanitise input variables
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1383793 13f79535-47bb-0310-9956-ffa450edef68
2012-09-12 06:17:24 +00:00
Lukasz Lenart 07a3f39356 WW-2749 adds missing <version/> tag
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1381889 13f79535-47bb-0310-9956-ffa450edef68
2012-09-07 05:53:33 +00:00
Lukasz Lenart 9d33c74b02 WW-2749 adds support for Tiles in Porlets as a dedicated plugin with new PortletTilesResult
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1381887 13f79535-47bb-0310-9956-ffa450edef68
2012-09-07 05:48:49 +00:00
Lukasz Lenart 73494b036f WW-3875 extracts static util methods into separated class
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1381599 13f79535-47bb-0310-9956-ffa450edef68
2012-09-06 13:44:33 +00:00
Lukasz Lenart a7161ca7d7 WW-3644 changes support for expression as a dynamic attribute to parse only values enclosed in %{ and }
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1381585 13f79535-47bb-0310-9956-ffa450edef68
2012-09-06 12:54:48 +00:00
Lukasz Lenart 62260e0096 WW-3344 corrects mistake in an example
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1381573 13f79535-47bb-0310-9956-ffa450edef68
2012-09-06 12:30:24 +00:00
Lukasz Lenart 328ae40cf8 WW-3874 merges AnnotationTools into AnnotationUtils
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1381560 13f79535-47bb-0310-9956-ffa450edef68
2012-09-06 11:25:26 +00:00
Lukasz Lenart edf2f4a302 WW-3870 Adds package inheritance in plugins
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1380129 13f79535-47bb-0310-9956-ffa450edef68
2012-09-03 05:45:21 +00:00
Lukasz Lenart 58f6fc4666 WW-3231 adds cssStyle and cssClass attributes to generated <label/> tag
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1379561 13f79535-47bb-0310-9956-ffa450edef68
2012-08-31 19:40:40 +00:00
Lukasz Lenart 5cadb2e544 WW-3177 adds better German translation of the error message
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1379461 13f79535-47bb-0310-9956-ffa450edef68
2012-08-31 14:09:27 +00:00
Lukasz Lenart 5d68b267b5 WW-3177 adds better way to handle error messages when an exception occurs, adds support for I18N to translate exceptions and adds default error messages
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1379458 13f79535-47bb-0310-9956-ffa450edef68
2012-08-31 14:06:00 +00:00
Lukasz Lenart ade5c99a07 WW-3866 adds more power to users to check if parameter name can be accepted, adds insecure params test case and cleans up code a bit
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1379386 13f79535-47bb-0310-9956-ffa450edef68
2012-08-31 09:43:17 +00:00
Johannes Geppert 6ecdb5e353 WW-3864: struts2-archetype-blank compile error
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1376638 13f79535-47bb-0310-9956-ffa450edef68
2012-08-23 18:30:10 +00:00
Lukasz Lenart 255b63486c WW-3848 adds warning message that the FilterDispatcher is deprecated and can produce errors when used with other web stacks
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1375926 13f79535-47bb-0310-9956-ffa450edef68
2012-08-22 07:58:38 +00:00
René Gielen 80e03182d6 WW-3860
Restrict accepted parameter name length
Thanks to Johno Crawford for the patch.

git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1368841 13f79535-47bb-0310-9956-ffa450edef68
2012-08-03 09:16:47 +00:00
René Gielen a1ca307981 WW-3858
Decouple token names from their respective session attribute names

git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1368827 13f79535-47bb-0310-9956-ffa450edef68
2012-08-03 08:03:12 +00:00
Lukasz Lenart ec070ff937 WW-3857 changes RestActionMapper to return null if it cannot determine action mapping, adds comment to API
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1367870 13f79535-47bb-0310-9956-ffa450edef68
2012-08-01 07:11:09 +00:00
Johannes Geppert 828f08ee3a WW-3856 Archetypes are missing some files
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1367769 13f79535-47bb-0310-9956-ffa450edef68
2012-07-31 20:47:43 +00:00
Lukasz Lenart 77ce77d342 Solves problem with rest-showcase app and adds additional test to proof how excludePackages works
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1367763 13f79535-47bb-0310-9956-ffa450edef68
2012-07-31 20:38:52 +00:00
Johannes Geppert 5fa0e9a297 WW-3846 Add a new attributes for optionsCollection
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1367168 13f79535-47bb-0310-9956-ffa450edef68
2012-07-30 16:51:53 +00:00
Johannes Geppert 7bc888f554 WW-3846 Add a new attributes for optionsCollection
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1366934 13f79535-47bb-0310-9956-ffa450edef68
2012-07-29 20:10:06 +00:00
Johannes Geppert eadc86b88d WW-3846 Add a new attributes for optionsCollection
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1366884 13f79535-47bb-0310-9956-ffa450edef68
2012-07-29 18:23:06 +00:00
Lukasz Lenart 0784a45cb2 WW-3414 removes ObjectFactory as a field and uses ActionContext to retrieve instance of ObjectFactory to allow serialize instances of XWorkList
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1364910 13f79535-47bb-0310-9956-ffa450edef68
2012-07-24 06:23:33 +00:00
Lukasz Lenart e1788e82eb WW-3839 solves problem with NPE when Log level is WARN
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1364627 13f79535-47bb-0310-9956-ffa450edef68
2012-07-23 13:31:52 +00:00
Lukasz Lenart 139c4d59a8 WW-3822 adds check if setter was defined as this can be read-only property
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1364624 13f79535-47bb-0310-9956-ffa450edef68
2012-07-23 13:20:00 +00:00
Lukasz Lenart d34fe187e2 WW-3833 adds new getFormatted method to support localization and conversion errors
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1364110 13f79535-47bb-0310-9956-ffa450edef68
2012-07-21 14:47:35 +00:00
Lukasz Lenart 74d1231765 WW-3448 add support for query string in forms
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1364095 13f79535-47bb-0310-9956-ffa450edef68
2012-07-21 13:49:58 +00:00
Lukasz Lenart 4c31279877 WW-3804 enables Radio tag to use dynamic attributes
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1364090 13f79535-47bb-0310-9956-ffa450edef68
2012-07-21 13:39:17 +00:00
Lukasz Lenart 1b5a1e7c30 WW-3850 solves problem with NPE when ActionValidationManager is trying to load Object-validation.xml
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1364079 13f79535-47bb-0310-9956-ffa450edef68
2012-07-21 13:12:48 +00:00
Lukasz Lenart 660c8066e3 WW-3828 adds additional test to check if dynamic attributes work with custom theme
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1364077 13f79535-47bb-0310-9956-ffa450edef68
2012-07-21 12:57:02 +00:00
Lukasz Lenart 79b4a4d285 WW-3851 adds FileManager dependency
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1364073 13f79535-47bb-0310-9956-ffa450edef68
2012-07-21 12:36:57 +00:00
Lukasz Lenart 14577aee1f WW-3552 adds usage of TextProvider to allow provide user's implementation
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1364066 13f79535-47bb-0310-9956-ffa450edef68
2012-07-21 11:15:34 +00:00
Lukasz Lenart 11efed59f1 WW-3843 adds proper extension points
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1363947 13f79535-47bb-0310-9956-ffa450edef68
2012-07-20 20:44:32 +00:00
Lukasz Lenart 5b312c6678 Resets providedChanged flag to solve potential bug
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1358155 13f79535-47bb-0310-9956-ffa450edef68
2012-07-06 12:27:28 +00:00
Lukasz Lenart f8a30084d4 WW-3819 moves inject of reload property directly into FileManager
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1357481 13f79535-47bb-0310-9956-ffa450edef68
2012-07-05 07:31:14 +00:00
Johannes Geppert 2a82fa100d MailReader App is not active anymore.
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1356455 13f79535-47bb-0310-9956-ffa450edef68
2012-07-02 20:16:38 +00:00
Lukasz Lenart b9da5b963e WW-3818 - extracts JBoss specific code into JBossFileManager and some code clean ups
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1352307 13f79535-47bb-0310-9956-ffa450edef68
2012-06-20 20:40:27 +00:00
Lukasz Lenart 09adba0f66 WW-3818 - extracts JBoss specific code into JBossFileManager and some code clean ups
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1352301 13f79535-47bb-0310-9956-ffa450edef68
2012-06-20 20:27:39 +00:00
Johannes Geppert 803b1b3677 WW-3842: The OptionTransferSelect tag doesn't recognize the attribute doubleOnmouseup and doubleOnmouseover
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1351491 13f79535-47bb-0310-9956-ffa450edef68
2012-06-18 21:20:49 +00:00
Lukasz Lenart 6f76303fa7 WW-3834 adds missing @Inject annotations to enable OVal support for JPA
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1345102 13f79535-47bb-0310-9956-ffa450edef68
2012-06-01 12:15:57 +00:00
Lukasz Lenart e3b66874d6 WW-3831 adds the same behaviour as in ServletUrlRenderer to render dynamic action in URL tag
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1344990 13f79535-47bb-0310-9956-ffa450edef68
2012-06-01 05:42:55 +00:00
Lukasz Lenart b0a7c6c8d3 WW-3173 adds missing closing tag
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1344620 13f79535-47bb-0310-9956-ffa450edef68
2012-05-31 09:36:59 +00:00
Lukasz Lenart fdb93f691d WW-3826 adds new StrutsPortletTestCase to simplify testing actions to be used in portlet environment
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1344572 13f79535-47bb-0310-9956-ffa450edef68
2012-05-31 05:59:06 +00:00
Lukasz Lenart 14db2edcab WW-3824 changes encoding definition to uppercase for Ajax requests to match specification
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1344143 13f79535-47bb-0310-9956-ffa450edef68
2012-05-30 08:18:33 +00:00
Lukasz Lenart c8ba67f4bd WW-3824 changes encoding definition to uppercase for Ajax requests to match specification
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1344134 13f79535-47bb-0310-9956-ffa450edef68
2012-05-30 07:43:18 +00:00
Lukasz Lenart b70bdeefda WW-3828 adds support for dynamic attributes not only for String literals but for other objects
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1343701 13f79535-47bb-0310-9956-ffa450edef68
2012-05-29 12:43:59 +00:00
Lukasz Lenart 8bd9cc6f48 WW-3173 adds additional test case to prove usage of inline map
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1343639 13f79535-47bb-0310-9956-ffa450edef68
2012-05-29 10:02:31 +00:00
Lukasz Lenart 351aae79b9 WW-3813 rollbacks site target after releasing a new version
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1342582 13f79535-47bb-0310-9956-ffa450edef68
2012-05-25 11:37:59 +00:00
Lukasz Lenart b577d723e9 WW-3802 adds missing statement to delete CGI parameters
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1339021 13f79535-47bb-0310-9956-ffa450edef68
2012-05-16 05:56:45 +00:00
Lukasz Lenart bfa7df79b6 WW-3802 moves clean up code to implementation of MultiPartRequest interface
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1338715 13f79535-47bb-0310-9956-ffa450edef68
2012-05-15 14:10:27 +00:00
Lukasz Lenart f21793d920 WW-3820 changes implementation of getInstanceNames(Class<?> type) to return empty set instead of null
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1338660 13f79535-47bb-0310-9956-ffa450edef68
2012-05-15 11:42:38 +00:00
Lukasz Lenart fca4405004 WW-3817 introduces FileManagerFactory with default implementation and refactors all the code to use the new approach
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1338643 13f79535-47bb-0310-9956-ffa450edef68
2012-05-15 11:05:50 +00:00
Johannes Geppert 8ca2735e94 WW-3815: Dispatching after action phase renders with different stack/TextProvider
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1338360 13f79535-47bb-0310-9956-ffa450edef68
2012-05-14 19:42:11 +00:00
Lukasz Lenart 81b70737a1 [maven-release-plugin] prepare for next development iteration
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1337583 13f79535-47bb-0310-9956-ffa450edef68
2012-05-12 16:06:55 +00:00
Lukasz Lenart 4e61119eab [maven-release-plugin] prepare release STRUTS_2_3_4
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1337581 13f79535-47bb-0310-9956-ffa450edef68
2012-05-12 16:06:29 +00:00
Lukasz Lenart 7eb6cdbeaa WW-3813 Prepares for release
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1337576 13f79535-47bb-0310-9956-ffa450edef68
2012-05-12 15:45:50 +00:00
Lukasz Lenart f75cc72633 WW-3812 wraps Arrays.asList with new ArrayList() to allow add() operation
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1337447 13f79535-47bb-0310-9956-ffa450edef68
2012-05-12 05:44:27 +00:00
Lukasz Lenart 517de353c1 WW-3763 adds setter to inject missing UrlHelper
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1336486 13f79535-47bb-0310-9956-ffa450edef68
2012-05-10 05:54:36 +00:00
Lukasz Lenart 02a84be2c7 WW-3810 reverts support for JBoss 5.1
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1335463 13f79535-47bb-0310-9956-ffa450edef68
2012-05-08 12:28:02 +00:00
Lukasz Lenart 5af2eda14c Reverts site target
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1333786 13f79535-47bb-0310-9956-ffa450edef68
2012-05-04 07:15:29 +00:00
Lukasz Lenart 997c577d4f WW-3805 solves problem with reloading configuration on each request even no changes to file
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1331402 13f79535-47bb-0310-9956-ffa450edef68
2012-04-27 12:56:02 +00:00
Lukasz Lenart b382c5c021 WW-3803 improves support for JAR inside EAR package when used with JBoss 7
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1331373 13f79535-47bb-0310-9956-ffa450edef68
2012-04-27 12:12:03 +00:00
Lukasz Lenart 0e5d4f3e9f Updated tag version and name
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1331339 13f79535-47bb-0310-9956-ffa450edef68
2012-04-27 10:22:26 +00:00
Lukasz Lenart 37ebc858a3 Improves logging messages
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1330502 13f79535-47bb-0310-9956-ffa450edef68
2012-04-25 19:25:03 +00:00
Lukasz Lenart 495753e1aa WW-3801 adds logic to clean ups uploaded files
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1328528 13f79535-47bb-0310-9956-ffa450edef68
2012-04-20 22:23:26 +00:00
Lukasz Lenart 0b2069dba0 WW-3803 solves problem with package name contains the package locator
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1328527 13f79535-47bb-0310-9956-ffa450edef68
2012-04-20 22:21:40 +00:00
Lukasz Lenart 0d8f4d43bd WW-3804 adds support of dynamic attributes to <s:radio/> tag and extends support for dynamic attributes with expression evaluation
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1328526 13f79535-47bb-0310-9956-ffa450edef68
2012-04-20 22:19:41 +00:00
Lukasz Lenart 5a9048065f WW-3282 Changes logic to add namespace only once when building urls and cleans up code
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1327601 13f79535-47bb-0310-9956-ffa450edef68
2012-04-18 18:13:57 +00:00
Lukasz Lenart 73e763faf8 WW-3799 converts FileManager into a bean, adds default implementation and defines new extension point
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1326928 13f79535-47bb-0310-9956-ffa450edef68
2012-04-17 05:03:45 +00:00
Lukasz Lenart 73c976a028 [maven-release-plugin] prepare for next development iteration
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1326479 13f79535-47bb-0310-9956-ffa450edef68
2012-04-16 04:34:52 +00:00
Lukasz Lenart 6411771bb0 [maven-release-plugin] prepare release STRUTS_2_3_3
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1326477 13f79535-47bb-0310-9956-ffa450edef68
2012-04-16 04:34:13 +00:00
Lukasz Lenart f45597252f WW-3798 changes params for wget to download just WW spaces
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1326396 13f79535-47bb-0310-9956-ffa450edef68
2012-04-15 18:49:00 +00:00
Lukasz Lenart 6a4240bdf0 WW-3791 prepares test build
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1326342 13f79535-47bb-0310-9956-ffa450edef68
2012-04-15 14:02:27 +00:00
Lukasz Lenart e9a12de7ee Reverst site link to dev one
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1326062 13f79535-47bb-0310-9956-ffa450edef68
2012-04-14 07:07:49 +00:00
Lukasz Lenart abd628ea09 WW-3442 adds additional initialisation of HttpSession
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1324893 13f79535-47bb-0310-9956-ffa450edef68
2012-04-11 17:49:35 +00:00
Lukasz Lenart 78ee4b8ba2 WW-3796 Changes logic to set encoding on HttpServletRequest if differs from configured
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1324888 13f79535-47bb-0310-9956-ffa450edef68
2012-04-11 17:41:06 +00:00
Lukasz Lenart 4f07559dc1 WW-3431 Solves problem with array initialization
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1324871 13f79535-47bb-0310-9956-ffa450edef68
2012-04-11 17:13:42 +00:00
Lukasz Lenart f064937984 WW-3059 Changes logic to set encoding for XMLHttpRequest type
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1324870 13f79535-47bb-0310-9956-ffa450edef68
2012-04-11 17:12:35 +00:00
Maurizio Cucchiara a99dadfebf Update commons lang3 reference
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1324674 13f79535-47bb-0310-9956-ffa450edef68
2012-04-11 09:42:13 +00:00
Lukasz Lenart 5c15306366 WW-3442 adds Session initialisation method to solve problem with missing session and allow to initialise session on its own in test cases
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1311951 13f79535-47bb-0310-9956-ffa450edef68
2012-04-10 19:33:51 +00:00
Lukasz Lenart ecc0e56440 WW-3432 pushes messages variables to allow customize validation messages
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1311945 13f79535-47bb-0310-9956-ffa450edef68
2012-04-10 19:29:09 +00:00
Lukasz Lenart b90fe0996f WW-3418 solves problem with excludePackages
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1311931 13f79535-47bb-0310-9956-ffa450edef68
2012-04-10 19:04:57 +00:00
Lukasz Lenart 2dacf99394 Removes strange file
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1311908 13f79535-47bb-0310-9956-ffa450edef68
2012-04-10 18:28:32 +00:00
Lukasz Lenart c8850cb558 WW-3413 removes unneeded dependencies
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1311903 13f79535-47bb-0310-9956-ffa450edef68
2012-04-10 18:22:01 +00:00
Lukasz Lenart a377ce5c40 WW-3173 adds additional test case to proof that there is no error
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1311902 13f79535-47bb-0310-9956-ffa450edef68
2012-04-10 18:20:25 +00:00
Lukasz Lenart 7146f389c7 WW-3795 allows specify location as a relative for result type plainText and add possibility to extend class by overriding protected methods
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1311895 13f79535-47bb-0310-9956-ffa450edef68
2012-04-10 18:07:16 +00:00
Lukasz Lenart 73da07e6af WW-3793 corrects name of PlainText Result in documentation to be plainText and not plaintext
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1311872 13f79535-47bb-0310-9956-ffa450edef68
2012-04-10 17:15:38 +00:00
Lukasz Lenart cbb55e9793 [maven-release-plugin] prepare for next development iteration
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1310831 13f79535-47bb-0310-9956-ffa450edef68
2012-04-07 19:28:23 +00:00
320 changed files with 6376 additions and 2965 deletions
+4 -4
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.2</version>
<version>2.3.5</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-blank</artifactId>
@@ -34,9 +34,9 @@
<name>Blank Webapp</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/apps/blank</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/apps/blank</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_2/apps/blank</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/apps/blank</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/apps/blank</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_5/apps/blank</url>
</scm>
<dependencies>
+4 -4
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.2</version>
<version>2.3.5</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-jboss-blank</artifactId>
@@ -34,9 +34,9 @@
<name>JBoss Blank Webapp</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/apps/jboss-blank</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/apps/jboss-blank</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_2/apps/jboss-blank</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/apps/jboss-blank</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/apps/jboss-blank</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_5/apps/jboss-blank</url>
</scm>
<dependencies>
+4 -4
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.2</version>
<version>2.3.5</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-mailreader</artifactId>
@@ -34,9 +34,9 @@
<name>Mail Reader Webapp</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/apps/mailreader</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/apps/mailreader</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_2/apps/mailreader</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/apps/mailreader</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/apps/mailreader</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_5/apps/mailreader</url>
</scm>
<dependencies>
+4 -4
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>2.3.2</version>
<version>2.3.5</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
@@ -42,9 +42,9 @@
</modules>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/apps</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/apps</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_2/apps</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/apps</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/apps</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_5/apps</url>
</scm>
<profiles>
+4 -4
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.2</version>
<version>2.3.5</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-portlet</artifactId>
@@ -34,9 +34,9 @@
<name>Portlet Webapp</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/apps/portlet</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/apps/portlet</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_2/apps/portlet</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/apps/portlet</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/apps/portlet</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_5/apps/portlet</url>
</scm>
<profiles>
+2 -2
View File
@@ -26,13 +26,13 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.2</version>
<version>2.3.5</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-rest-showcase</artifactId>
<packaging>war</packaging>
<version>2.3.2</version>
<version>2.3.5</version>
<name>Struts 2 Rest Showcase Example</name>
<description>Struts 2 Rest Showcase Example</description>
@@ -1,4 +1,4 @@
package org.apache.struts2.rest.example;
package org.demo.rest.example;
public class Order {
String id;
@@ -1,16 +1,11 @@
package org.apache.struts2.rest.example;
package org.demo.rest.example;
import java.util.Collection;
import org.apache.struts2.dispatcher.ServletActionRedirectResult;
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 org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Namespaces;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.InterceptorRef;
import com.opensymphony.xwork2.ModelDriven;
import com.opensymphony.xwork2.Validateable;
@@ -1,4 +1,4 @@
package org.apache.struts2.rest.example;
package org.demo.rest.example;
import java.util.*;
+4 -4
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.2</version>
<version>2.3.5</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-showcase</artifactId>
@@ -34,9 +34,9 @@
<name>Showcase Webapp</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/apps/showcase</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/apps/showcase</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_2/apps/showcase</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/apps/showcase</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/apps/showcase</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_5/apps/showcase</url>
</scm>
@@ -26,12 +26,7 @@ import com.opensymphony.xwork2.util.ValueStack;
import org.apache.struts2.ServletActionContext;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
*/
@@ -67,9 +62,9 @@ public class UITagExample extends ActionSupport implements Validateable {
String thoughts;
public UITagExample() {
favouriteLanguages.add(new Language("EnglishKey", "English Language"));
favouriteLanguages.add(new Language("FrenchKey", "French Language"));
favouriteLanguages.add(new Language("SpanishKey", "Spanish Language"));
favouriteLanguages.add(new Language("EnglishKey", "English Language", "color: blue; font-style: italic;"));
favouriteLanguages.add(new Language("FrenchKey", "French Language", "color: grey;"));
favouriteLanguages.add(new Language("SpanishKey", "Spanish Language", "color: red; font-wight: bold;"));
VehicalType car = new VehicalType("CarKey", "Car");
VehicalType motorcycle = new VehicalType("MotorcycleKey", "Motorcycle");
@@ -268,10 +263,12 @@ public class UITagExample extends ActionSupport implements Validateable {
public static class Language {
String description;
String key;
String style;
public Language(String key, String description) {
public Language(String key, String description, String style) {
this.key = key;
this.description = description;
this.style = style;
}
public String getKey() {
@@ -280,6 +277,9 @@ public class UITagExample extends ActionSupport implements Validateable {
public String getDescription() {
return description;
}
public String getStyle() {
return style;
}
}
@@ -20,6 +20,8 @@
*/
package org.apache.struts2.showcase.model;
import org.apache.commons.lang3.StringEscapeUtils;
import java.io.Serializable;
/**
@@ -47,7 +49,7 @@ public class Skill implements IdEntity {
}
public void setName(String name) {
this.name = name;
this.name = StringEscapeUtils.escapeEcmaScript(StringEscapeUtils.escapeHtml4(name));
}
public String getDescription() {
@@ -55,7 +57,7 @@ public class Skill implements IdEntity {
}
public void setDescription(String description) {
this.description = description;
this.description = StringEscapeUtils.escapeEcmaScript(StringEscapeUtils.escapeHtml4(description));
}
public Serializable getId() {
@@ -24,7 +24,7 @@ log4j.logger.noModule=FATAL
# OpenSymphony Stuff
log4j.logger.com.opensymphony=INFO
log4j.logger.org.apache.struts2=DEBUG
log4j.logger.org.apache.struts2=INFO
# Spring Stuff
log4j.logger.org.springframework=INFO
@@ -23,10 +23,6 @@
For more "by example" solutions,
see the <a href="http://struts.apache.org/2.x/docs/cookbook.html">Struts Cookbook</a> pages.
</li>
<li>
For a "best practices" example, see the
<a href="http://planetstruts.org/struts2-mailreader/">MailReader application</a> Tour and source code.
</li>
</ul>
</blockquote>
<p>
@@ -55,6 +55,7 @@
name="favouriteLanguage"
listKey="key"
listValue="description"
listCssStyle="style"
emptyOption="true"
headerKey="None"
headerValue="None"/>
+4 -4
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>2.3.2</version>
<version>2.3.5</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-archetypes</artifactId>
@@ -34,9 +34,9 @@
<name>Struts 2 Maven Archetypes</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/archetypes</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/archetypes</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/archetypes</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes</url>
</scm>
<modules>
+5 -5
View File
@@ -3,19 +3,19 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-archetypes</artifactId>
<version>2.3.2</version>
<version>2.3.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>struts2-archetype-blank</artifactId>
<version>2.3.2</version>
<version>2.3.5</version>
<packaging>jar</packaging>
<name>Struts 2 Archetypes - Blank</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/archetypes/struts2-archetype-blank</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/archetypes/struts2-archetype-blank</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/archetypes/struts2-archetype-blank</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes/struts2-archetype-blank</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes/struts2-archetype-blank</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes/struts2-archetype-blank</url>
</scm>
<properties>
@@ -46,20 +46,6 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-mock</artifactId>
<version>2.0.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.0.5.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
@@ -62,7 +62,7 @@ public class ConfigTest extends StrutsTestCase {
protected void setUp() throws Exception {
super.setUp();
XmlConfigurationProvider c = new XmlConfigurationProvider("struts.xml");
configurationManager.addConfigurationProvider(c);
configurationManager.addContainerProvider(c);
configurationManager.reload();
}
@@ -2,19 +2,19 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-archetypes</artifactId>
<version>2.3.2</version>
<version>2.3.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>struts2-archetype-convention</artifactId>
<version>2.3.2</version>
<version>2.3.5</version>
<packaging>jar</packaging>
<name>Struts 2 Archetypes - Blank Convention</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/archetypes/struts2-archetype-convention</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/archetypes/struts2-archetype-convention</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/archetypes/struts2-archetype-convention</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes/struts2-archetype-convention</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes/struts2-archetype-convention</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes/struts2-archetype-convention</url>
</scm>
<properties>
@@ -23,6 +23,13 @@
</includes>
</fileSet>
<fileSet filtered="false" packaged="false">
<directory>src/main/resources</directory>
<includes>
<include>**/*.xml</include>
</includes>
</fileSet>
<fileSet filtered="false" packaged="false">
<directory>src/main/webapp</directory>
<includes>
@@ -2,19 +2,19 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-archetypes</artifactId>
<version>2.3.2</version>
<version>2.3.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>struts2-archetype-dbportlet</artifactId>
<version>2.3.2</version>
<version>2.3.5</version>
<packaging>jar</packaging>
<name>Struts 2 Archetypes - Database Portlet</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/archetypes/struts2-archetype-dbportlet</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/archetypes/struts2-archetype-dbportlet</developerConnection>
<url>svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/archetypes/struts2-archetype-dbportlet</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes/struts2-archetype-dbportlet</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes/struts2-archetype-dbportlet</developerConnection>
<url>svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes/struts2-archetype-dbportlet</url>
</scm>
<properties>
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<archetype-descriptor name="struts2-archetype-dbportlet">
<fileSets>
<fileSet filtered="true" packaged="true">
<directory>src/main/java</directory>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
<fileSet filtered="true" packaged="true">
<directory>src/test/java</directory>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
<fileSet filtered="false" packaged="false">
<directory>src/main/resources</directory>
<includes>
<include>**/*.xml</include>
</includes>
</fileSet>
<fileSet filtered="false" packaged="false">
<directory>src/main/webapp</directory>
<includes>
<include>**/*.jsp</include>
</includes>
</fileSet>
<fileSet filtered="true" packaged="false">
<directory>src/main/webapp/WEB-INF</directory>
<includes>
<include>**/*.xml</include>
</includes>
</fileSet>
</fileSets>
</archetype-descriptor>
+5 -5
View File
@@ -2,19 +2,19 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-archetypes</artifactId>
<version>2.3.2</version>
<version>2.3.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>struts2-archetype-plugin</artifactId>
<version>2.3.2</version>
<version>2.3.5</version>
<packaging>jar</packaging>
<name>Struts 2 Archetypes - Plugin</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/archetypes/struts2-archetype-plugin</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/archetypes/struts2-archetype-plugin</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/archetypes/struts2-archetype-plugin</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes/struts2-archetype-plugin</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes/struts2-archetype-plugin</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes/struts2-archetype-plugin</url>
</scm>
<properties>
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<archetype-descriptor name="struts2-archetype-plugin">
<fileSets>
<fileSet filtered="true" packaged="true">
<directory>src/main/java</directory>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
<fileSet filtered="true" packaged="true">
<directory>src/test/java</directory>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
<fileSet filtered="false" packaged="false">
<directory>src/main/resources</directory>
<includes>
<include>**/*.xml</include>
</includes>
</fileSet>
<fileSet filtered="false" packaged="false">
<directory>src/main/webapp</directory>
<includes>
<include>**/*.jsp</include>
</includes>
</fileSet>
<fileSet filtered="true" packaged="false">
<directory>src/main</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.txt</include>
</includes>
</fileSet>
</fileSets>
</archetype-descriptor>
+5 -5
View File
@@ -2,19 +2,19 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-archetypes</artifactId>
<version>2.3.2</version>
<version>2.3.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>struts2-archetype-portlet</artifactId>
<version>2.3.2</version>
<version>2.3.5</version>
<packaging>jar</packaging>
<name>Struts 2 Archetypes - Portlet</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/archetypes/struts2-archetype-portlet</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/archetypes/struts2-archetype-portlet</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/archetypes/struts2-archetype-portlet</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes/struts2-archetype-portlet</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes/struts2-archetype-portlet</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes/struts2-archetype-portlet</url>
</scm>
<properties>
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<archetype-descriptor name="struts2-archetype-portlet">
<fileSets>
<fileSet filtered="true" packaged="true">
<directory>src/main/java</directory>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
<fileSet filtered="true" packaged="true">
<directory>src/test/java</directory>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
<fileSet filtered="false" packaged="false">
<directory>src/main/resources</directory>
<includes>
<include>**/*.xml</include>
</includes>
</fileSet>
<fileSet filtered="false" packaged="false">
<directory>src/main/webapp</directory>
<includes>
<include>**/*.jsp</include>
</includes>
</fileSet>
<fileSet filtered="true" packaged="false">
<directory>src/main/webapp/WEB-INF</directory>
<includes>
<include>**/*.xml</include>
</includes>
</fileSet>
</fileSets>
</archetype-descriptor>
+5 -5
View File
@@ -4,19 +4,19 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-archetypes</artifactId>
<version>2.3.2</version>
<version>2.3.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>struts2-archetype-starter</artifactId>
<version>2.3.2</version>
<version>2.3.5</version>
<packaging>jar</packaging>
<name>Struts 2 Archetypes - Starter</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/archetypes/struts2-archetype-starter</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/archetypes/struts2-archetype-starter</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/archetypes/struts2-archetype-starter</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes/struts2-archetype-starter</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes/struts2-archetype-starter</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes/struts2-archetype-starter</url>
</scm>
<properties>
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<archetype-descriptor name="struts2-archetype-starter">
<fileSets>
<fileSet filtered="true" packaged="true">
<directory>src/main/java</directory>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
<fileSet filtered="true" packaged="true">
<directory>src/test/java</directory>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
<fileSet filtered="false" packaged="true">
<directory>src/main/resources</directory>
<includes>
<include>**/*.properties</include>
</includes>
</fileSet>
<fileSet filtered="false" packaged="false">
<directory>src/main/resources</directory>
<includes>
<include>**/*.xml</include>
</includes>
</fileSet>
<fileSet filtered="false" packaged="false">
<directory>src/main/webapp</directory>
<includes>
<include>**/*.jsp</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8">
<directory>src/main/webapp</directory>
<includes>
<include>**/*.MF</include>
<include>**/*.js</include>
<include>**/*.css</include>
</includes>
</fileSet>
<fileSet filtered="true" packaged="false">
<directory>src/main/webapp/WEB-INF</directory>
<includes>
<include>**/*.xml</include>
</includes>
</fileSet>
</fileSets>
</archetype-descriptor>
+6 -4
View File
@@ -11,13 +11,13 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>2.3.2</version>
<version>2.3.5</version>
</parent>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/assembly</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/assembly</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_2/assembly</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/assembly</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/assembly</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_5/assembly</url>
</scm>
<profiles>
@@ -276,6 +276,8 @@
<arg value="-nv" />
<arg value="-E" />
<arg value="-L" />
<arg value="-l 0" />
<arg value="-np" />
<arg value="--directory-prefix=${project.build.directory}/cwiki" />
<arg value="--no-check-certificate" />
<arg value="-r" />
+4 -4
View File
@@ -4,7 +4,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-osgi-bundles</artifactId>
<version>2.3.2</version>
<version>2.3.5</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-osgi-admin-bundle</artifactId>
@@ -12,9 +12,9 @@
<name>Struts 2 OSGi Admin Bundle</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/bundles/admin</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/bundles/admin</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_2/bundles/admin</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/bundles/admin</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/bundles/admin</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_5/bundles/admin</url>
</scm>
<dependencies>
+4 -4
View File
@@ -4,7 +4,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-osgi-bundles</artifactId>
<version>2.3.2</version>
<version>2.3.5</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-osgi-demo-bundle</artifactId>
@@ -12,9 +12,9 @@
<name>Struts 2 OSGi Demo Bundle</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/bundles/demo</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/bundles/demo</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_2/bundles/demo</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/bundles/demo</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/bundles/demo</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_5/bundles/demo</url>
</scm>
<dependencies>
+4 -4
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>2.3.2</version>
<version>2.3.5</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-osgi-bundles</artifactId>
@@ -34,9 +34,9 @@
<name>Struts OSGi Bundles</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/bundles</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/bundles</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/bundles</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/bundles</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/bundles</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/bundles</url>
</scm>
<modules>
+6 -6
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>2.3.2</version>
<version>2.3.5</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
@@ -34,13 +34,13 @@
<name>Struts 2 Core</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/core</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_2/core</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_2/core</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/core</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/core</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_5/core</url>
</scm>
<properties>
<tlib.version>2.2</tlib.version>
<tlib.version>2.3</tlib.version>
</properties>
<build>
@@ -50,7 +50,7 @@
<artifactId>maven-apt-plugin</artifactId>
<version>1.0.15</version>
<configuration>
<A>uri=/struts-tags,tlibVersion=${tlib.version},jspVersion=2.0,shortName=s,displayName="Struts Tags",
<A>uri=/struts-tags,tlibVersion=${tlib.version},jspVersion=2.0,shortName=s,displayName=Struts Tags,
outFile=${basedir}/target/classes/META-INF/struts-tags.tld,
description="To make it easier to access dynamic data;
the Apache Struts framework includes a library of custom tags.
@@ -64,6 +64,12 @@ public final class StrutsConstants {
/** The com.opensymphony.xwork2.ObjectFactory implementation class */
public static final String STRUTS_OBJECTFACTORY = "struts.objectFactory";
/** The com.opensymphony.xwork2.util.FileManager implementation class */
public static final String STRUTS_FILE_MANAGER_FACTORY = "struts.fileManagerFactory";
/** The com.opensymphony.xwork2.util.fs.FileManager implementation class */
public static final String STRUTS_FILE_MANAGER = "struts.fileManager";
/** The com.opensymphony.xwork2.util.ObjectTypeDeterminer implementation class */
public static final String STRUTS_OBJECTTYPEDETERMINER = "struts.objectTypeDeterminer";
@@ -188,6 +194,9 @@ public final class StrutsConstants {
/** XWork default text provider */
public static final String STRUTS_XWORKTEXTPROVIDER = "struts.xworkTextProvider";
/** The {@link com.opensymphony.xwork2.LocaleProvider} implementation class */
public static final String STRUTS_LOCALE_PROVIDER = "struts.localeProvider";
/** The name of the parameter to create when mapping an id (used by some action mappers) */
public static final String STRUTS_ID_PARAMETER_NAME = "struts.mapper.idParameterName";
@@ -227,4 +236,14 @@ public final class StrutsConstants {
/** The{@link org.apache.struts2.views.util.UrlHelper} implementation class **/
public static final String STRUTS_URL_HELPER = "struts.view.urlHelper";
/** {@link com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter} **/
public static final String STRUTS_CONVERTER_COLLECTION = "struts.converter.collection";
public static final String STRUTS_CONVERTER_ARRAY = "struts.converter.array";
public static final String STRUTS_CONVERTER_DATE = "struts.converter.date";
public static final String STRUTS_CONVERTER_NUMBER = "struts.converter.number";
public static final String STRUTS_CONVERTER_STRING = "struts.converter.string";
/** Enable handling exceptions by Dispatcher - true by default **/
public static final String STRUTS_HANDLE_EXCEPTION = "struts.handle.exception";
}
@@ -28,9 +28,9 @@ import org.apache.struts2.StrutsConstants;
import org.apache.struts2.StrutsException;
import org.apache.struts2.dispatcher.mapper.ActionMapper;
import org.apache.struts2.dispatcher.mapper.ActionMapping;
import org.apache.struts2.util.ComponentUtils;
import org.apache.struts2.util.FastByteArrayOutputStream;
import org.apache.struts2.views.jsp.TagUtils;
import org.apache.struts2.views.util.ContextUtil;
import org.apache.struts2.views.util.UrlHelper;
import javax.servlet.http.HttpServletRequest;
@@ -265,35 +265,7 @@ public class Component {
* the parameter expression is returned as is.
*/
protected String stripExpressionIfAltSyntax(String expr) {
return stripExpressionIfAltSyntax(stack, expr);
}
/**
* If altsyntax (%{...}) is applied, simply strip the "%{" and "}" off.
* @param stack the ValueStack where the context value is searched for.
* @param expr the expression (must be not null)
* @return the stripped expression if altSyntax is enabled. Otherwise
* the parameter expression is returned as is.
*/
public static String stripExpressionIfAltSyntax(ValueStack stack, String expr) {
if (altSyntax(stack)) {
// does the expression start with %{ and end with }? if so, just cut it off!
if (expr.startsWith("%{") && expr.endsWith("}")) {
return expr.substring(2, expr.length() - 1);
}
}
return expr;
}
/**
* Is the altSyntax enabled? [TRUE]
* <p/>
* @param stack the ValueStack where the context value is searched for.
* @return true if altSyntax is activated. False otherwise.
* See <code>struts.properties</code> where the altSyntax flag is defined.
*/
public static boolean altSyntax(ValueStack stack) {
return ContextUtil.isUseAltSyntax(stack.getContext());
return ComponentUtils.stripExpressionIfAltSyntax(stack, expr);
}
/**
@@ -302,7 +274,7 @@ public class Component {
* See <code>struts.properties</code> where the altSyntax flag is defined.
*/
public boolean altSyntax() {
return altSyntax(stack);
return ComponentUtils.altSyntax(stack);
}
/**
@@ -511,10 +483,11 @@ public class Component {
}
/**
* Overwrite to set if body shold be used.
* Overwrite to set if body should be used.
* @return always false for this component.
*/
public boolean usesBody() {
return false;
}
}
@@ -21,14 +21,12 @@
package org.apache.struts2.components;
import java.util.Map;
import com.opensymphony.xwork2.util.ValueStack;
import org.apache.struts2.views.annotations.StrutsTagAttribute;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.views.annotations.StrutsTagAttribute;
import com.opensymphony.xwork2.util.ValueStack;
import java.util.Map;
/**
* DoubleListUIBean is the standard superclass of all Struts double list handling components.
@@ -55,6 +53,9 @@ public abstract class DoubleListUIBean extends ListUIBean {
protected String doubleList;
protected String doubleListKey;
protected String doubleListValue;
protected String doubleListCssClass;
protected String doubleListCssStyle;
protected String doubleListTitle;
protected String doubleName;
protected String doubleValue;
protected String formName;
@@ -149,6 +150,15 @@ public abstract class DoubleListUIBean extends ListUIBean {
}else if (tmpDoubleList instanceof Map) {
addParameter("doubleListValue", "value");
}
if (doubleListCssClass != null) {
addParameter("doubleListCssClass", findString(doubleListCssClass));
}
if (doubleListCssStyle!= null) {
addParameter("doubleListCssStyle", findString(doubleListCssStyle));
}
if (doubleListTitle != null) {
addParameter("doubleListTitle", findString(doubleListTitle));
}
if (formName != null) {
@@ -276,6 +286,21 @@ public abstract class DoubleListUIBean extends ListUIBean {
this.doubleListValue = doubleListValue;
}
@StrutsTagAttribute(description = "Property of second list objects to get css class from")
public void setDoubleListCssClass(String doubleListCssClass) {
this.doubleListCssClass = doubleListCssClass;
}
@StrutsTagAttribute(description = "Property of second list objects to get css style from")
public void setDoubleListCssStyle(String doubleListCssStyle) {
this.doubleListCssStyle = doubleListCssStyle;
}
@StrutsTagAttribute(description = "Property of second list objects to get title from")
public void setDoubleListTitle(String doubleListTitle) {
this.doubleListTitle = doubleListTitle;
}
@StrutsTagAttribute(description="The name for complete component", required=true)
public void setDoubleName(String doubleName) {
this.doubleName = doubleName;
@@ -21,14 +21,13 @@
package org.apache.struts2.components;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.views.annotations.StrutsTag;
import org.apache.struts2.StrutsConstants;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.util.ValueStack;
import org.apache.struts2.StrutsConstants;
import org.apache.struts2.views.annotations.StrutsTag;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* <!-- START SNIPPET: javadoc -->
@@ -48,8 +47,11 @@ import com.opensymphony.xwork2.util.ValueStack;
* </pre>
*
*/
@StrutsTag(name="head", tldBodyContent="empty", tldTagClass="org.apache.struts2.views.jsp.ui.HeadTag",
description="Render a chunk of HEAD for your HTML file")
@StrutsTag(name="head",
tldBodyContent="empty",
tldTagClass="org.apache.struts2.views.jsp.ui.HeadTag",
description="Render a chunk of HEAD for your HTML file",
allowDynamicAttributes = true)
public class Head extends UIBean {
public static final String TEMPLATE = "head";
@@ -21,37 +21,37 @@
package org.apache.struts2.components;
import com.opensymphony.xwork2.util.ValueStack;
import org.apache.struts2.util.ContainUtil;
import org.apache.struts2.util.MakeIterator;
import org.apache.struts2.views.annotations.StrutsTagAttribute;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Array;
import java.util.Collection;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.views.annotations.StrutsTagAttribute;
import org.apache.struts2.util.ContainUtil;
import org.apache.struts2.util.MakeIterator;
import com.opensymphony.xwork2.util.ValueStack;
/**
* DoubleListUIBean is the standard superclass of all Struts list handling components.
*
* <p/>
*
* <p/>
* <p/>
* <!-- START SNIPPET: javadoc -->
*
* <p/>
* Note that the listkey and listvalue attribute will default to "key" and "value"
* respectively only when the list attribute is evaluated to a Map or its decendant.
* Everything else will result in listkey and listvalue to be null and not used.
*
* <p/>
* <!-- END SNIPPET: javadoc -->
*
*/
public abstract class ListUIBean extends UIBean {
protected Object list;
protected String listKey;
protected String listValue;
protected String listCssClass;
protected String listCssStyle;
protected String listTitle;
// indicate if an exception is to be thrown when value attribute is null
protected boolean throwExceptionOnNullValueAttribute = false;
@@ -78,13 +78,12 @@ public abstract class ListUIBean extends UIBean {
if (throwExceptionOnNullValueAttribute) {
// will throw an exception if not found
value = findValue((list == null) ? (String) list : list.toString(), "list",
"The requested list key '" + list + "' could not be resolved as a collection/array/map/enumeration/iterator type. " +
"Example: people or people.{name}");
}
else {
"The requested list key '" + list + "' could not be resolved as a collection/array/map/enumeration/iterator type. " +
"Example: people or people.{name}");
} else {
// ww-1010, allows value with null value to be compatible with ww
// 2.1.7 behaviour
value = findValue((list == null)?(String) list:list.toString());
value = findValue((list == null) ? (String) list : list.toString());
}
}
@@ -103,18 +102,30 @@ public abstract class ListUIBean extends UIBean {
}
if (listKey != null) {
listKey = stripExpressionIfAltSyntax(listKey);
listKey = stripExpressionIfAltSyntax(listKey);
addParameter("listKey", listKey);
} else if (value instanceof Map) {
addParameter("listKey", "key");
}
if (listValue != null) {
listValue = stripExpressionIfAltSyntax(listValue);
listValue = stripExpressionIfAltSyntax(listValue);
addParameter("listValue", listValue);
} else if (value instanceof Map) {
addParameter("listValue", "value");
}
if (listCssClass != null && listCssClass.trim().length() > 0) {
addParameter("listCssClass", listCssClass);
}
if (listCssStyle != null && listCssStyle.trim().length() > 0) {
addParameter("listCssStyle", listCssStyle);
}
if (listTitle != null && listTitle.trim().length() > 0) {
addParameter("listTitle", listTitle);
}
}
public boolean contains(Object obj1, Object obj2) {
@@ -125,22 +136,37 @@ public abstract class ListUIBean extends UIBean {
return null; // don't convert nameValue to anything, we need the raw value
}
@StrutsTagAttribute(description="Iterable source to populate from. If the list is a Map (key, value), the Map key will become the option 'value'" +
" parameter and the Map value will become the option body.", required=true)
@StrutsTagAttribute(description = "Iterable source to populate from. If the list is a Map (key, value), the Map key will become the option 'value'" +
" parameter and the Map value will become the option body.", required = true)
public void setList(Object list) {
this.list = list;
}
@StrutsTagAttribute(description=" Property of list objects to get field value from")
@StrutsTagAttribute(description = " Property of list objects to get field value from")
public void setListKey(String listKey) {
this.listKey = listKey;
}
@StrutsTagAttribute(description="Property of list objects to get field content from")
@StrutsTagAttribute(description = "Property of list objects to get field content from")
public void setListValue(String listValue) {
this.listValue = listValue;
}
@StrutsTagAttribute(description = "Property of list objects to get css class from")
public void setListCssClass(String listCssClass) {
this.listCssClass = listCssClass;
}
@StrutsTagAttribute(description = "Property of list objects to get css style from")
public void setListCssStyle(String listCssStyle) {
this.listCssStyle = listCssStyle;
}
@StrutsTagAttribute(description = "Property of list objects to get title from")
public void setListTitle(String listTitle) {
this.listTitle = listTitle;
}
public void setThrowExceptionOnNullValueAttribute(boolean throwExceptionOnNullValueAttribute) {
this.throwExceptionOnNullValueAttribute = throwExceptionOnNullValueAttribute;
@@ -21,18 +21,16 @@
package org.apache.struts2.components;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.views.annotations.StrutsTag;
import org.apache.struts2.views.annotations.StrutsTagAttribute;
import com.opensymphony.xwork2.util.ValueStack;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import org.apache.struts2.views.annotations.StrutsTag;
import org.apache.struts2.views.annotations.StrutsTagAttribute;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* <!-- START SNIPPET: javadoc -->
@@ -51,7 +49,7 @@ import com.opensymphony.xwork2.util.logging.LoggerFactory;
*
* NOTE: The id and doubleId need not be supplied as they will generated provided
* that the optiontransferselect tag is being used in a form tag. The generated id
* and doubleId will be &lt;form_id&gt;_&lt;optiontransferselect_doubleName&gt; and
* and doubleId will be &lt;form_id&gt;_&lt;optiontransferselect_nameame&gt; and
* &lt;form_id&gt;_&lt;optiontransferselect_doubleName&gt; respectively.
*
* <!-- END SNIPPET: notice -->
@@ -21,12 +21,11 @@
package org.apache.struts2.components;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.opensymphony.xwork2.util.ValueStack;
import org.apache.struts2.views.annotations.StrutsTag;
import com.opensymphony.xwork2.util.ValueStack;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* <!-- START SNIPPET: javadoc -->
@@ -47,10 +46,16 @@ import com.opensymphony.xwork2.util.ValueStack;
* &lt;s:action name="GenderMap" var="genders"/&gt;
* &lt;s:radio label="Gender" name="male" list="#genders.genders"/&gt;
* <!-- END SNIPPET: example -->
* </pre>
*
* <!-- START SNIPPET: example_fmt -->
* &lt;@s.radio name="car" list={"ford": "Ford Motor Co", "toyota": "Toyota"} listKey="key" listValue="value" /&gt;
* <!-- END SNIPPET: example_fmt -->
*
*/
@StrutsTag(name="radio", tldTagClass="org.apache.struts2.views.jsp.ui.RadioTag", description="Renders a radio button input field")
@StrutsTag(name="radio",
tldTagClass="org.apache.struts2.views.jsp.ui.RadioTag",
description="Renders a radio button input field",
allowDynamicAttributes = true)
public class Radio extends ListUIBean {
final public static String TEMPLATE = "radiomap";
@@ -145,6 +145,13 @@ public class ServletUrlRenderer implements UrlRenderer {
}
}
Map actionParams = null;
if (action != null && action.indexOf("?") > 0) {
String queryString = action.substring(action.indexOf("?") + 1);
actionParams = urlHelper.parseQueryString(queryString, false);
action = action.substring(0, action.indexOf("?"));
}
ActionMapping nameMapping = actionMapper.getMappingFromActionName(action);
String actionName = nameMapping.getName();
String actionMethod = nameMapping.getMethod();
@@ -155,7 +162,7 @@ public class ServletUrlRenderer implements UrlRenderer {
ActionMapping mapping = new ActionMapping(actionName, namespace, actionMethod, formComponent.parameters);
String result = urlHelper.buildUrl(formComponent.actionMapper.getUriFromActionMapping(mapping),
formComponent.request, formComponent.response, null, null, formComponent.includeContext, true);
formComponent.request, formComponent.response, actionParams, null, formComponent.includeContext, true);
formComponent.addParameter("action", result);
// let's try to get the actual action class and name
@@ -21,13 +21,12 @@
package org.apache.struts2.components;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.opensymphony.xwork2.util.ValueStack;
import org.apache.struts2.views.annotations.StrutsTag;
import org.apache.struts2.views.annotations.StrutsTagAttribute;
import com.opensymphony.xwork2.util.ValueStack;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* <!-- START SNIPPET: javadoc -->
@@ -67,6 +66,7 @@ public class TextField extends UIBean {
protected String maxlength;
protected String readonly;
protected String size;
protected String type;
public TextField(ValueStack stack, HttpServletRequest request, HttpServletResponse response) {
super(stack, request, response);
@@ -90,6 +90,11 @@ public class TextField extends UIBean {
if (readonly != null) {
addParameter("readonly", findValue(readonly, Boolean.class));
}
if (type != null) {
addParameter("type", findString(type));
}
}
@StrutsTagAttribute(description="HTML maxlength attribute", type="Integer")
@@ -111,4 +116,9 @@ public class TextField extends UIBean {
public void setSize(String size) {
this.size = size;
}
@StrutsTagAttribute(description="Specifies the html5 type element to display. e.g. text, email, url", defaultValue="text")
public void setType(String type) {
this.type = type;
}
}
@@ -22,13 +22,22 @@
package org.apache.struts2.config;
import com.opensymphony.xwork2.ActionProxyFactory;
import com.opensymphony.xwork2.FileManager;
import com.opensymphony.xwork2.FileManagerFactory;
import com.opensymphony.xwork2.LocaleProvider;
import com.opensymphony.xwork2.ObjectFactory;
import com.opensymphony.xwork2.TextProvider;
import com.opensymphony.xwork2.UnknownHandlerManager;
import com.opensymphony.xwork2.XWorkConstants;
import com.opensymphony.xwork2.config.Configuration;
import com.opensymphony.xwork2.config.ConfigurationException;
import com.opensymphony.xwork2.config.ConfigurationProvider;
import com.opensymphony.xwork2.conversion.ObjectTypeDeterminer;
import com.opensymphony.xwork2.conversion.impl.ArrayConverter;
import com.opensymphony.xwork2.conversion.impl.CollectionConverter;
import com.opensymphony.xwork2.conversion.impl.DateConverter;
import com.opensymphony.xwork2.conversion.impl.NumberConverter;
import com.opensymphony.xwork2.conversion.impl.StringConverter;
import com.opensymphony.xwork2.conversion.impl.XWorkConverter;
import com.opensymphony.xwork2.inject.Container;
import com.opensymphony.xwork2.inject.ContainerBuilder;
@@ -172,6 +181,12 @@ import java.util.StringTokenizer;
* <td>Allows provide custom TextProvider for whole application</td>
* </tr>
* <tr>
* <td>com.opensymphony.xwork2.LocaleProvider</td>
* <td>struts.localeProvider</td>
* <td>singleton</td>
* <td>Allows provide custom TextProvider for whole application</td>
* </tr>
* <tr>
* <td>org.apache.struts2.components.UrlRenderer</td>
* <td>struts.urlRenderer</td>
* <td>singleton</td>
@@ -189,6 +204,43 @@ import java.util.StringTokenizer;
* <td>singleton</td>
* <td>Helper class used with URLRenderer to provide exact logic for building URLs</td>
* </tr>
* <tr>
* <td>com.opensymphony.xwork2.FileManagerFactory</td>
* <td>struts.fileManagerFactory</td>
* <td>singleton</td>
* <td>Used to create {@link FileManager} instance to access files on the File System as also to monitor if reload is needed,
* can be implemented / overwritten to meet specific an application server needs
* </td>
* <tr>
* <td>com.opensymphony.xwork2.conversion.impl.CollectionConverter</td>
* <td>struts.converter.collection</td>
* <td>singleton</td>
* <td>Converter used to convert any object to Collection and back</td>
* </tr>
* <tr>
* <td>com.opensymphony.xwork2.conversion.impl.ArrayConverter</td>
* <td>struts.converter.array</td>
* <td>singleton</td>
* <td>Converter used to convert any object to Array and back</td>
* </tr>
* <tr>
* <td>com.opensymphony.xwork2.conversion.impl.DateConverter</td>
* <td>struts.converter.date</td>
* <td>singleton</td>
* <td>Converter used to convert any object to Date and back</td>
* </tr>
* <tr>
* <td>com.opensymphony.xwork2.conversion.impl.NumberConverter</td>
* <td>struts.converter.number</td>
* <td>singleton</td>
* <td>Converter used to convert any object to Number and back</td>
* </tr>
* <tr>
* <td>com.opensymphony.xwork2.conversion.impl.StringConverter</td>
* <td>struts.converter.string</td>
* <td>singleton</td>
* <td>Converter used to convert any object to String and back</td>
* </tr>
* </table>
*
* <!-- END SNIPPET: extensionPoints -->
@@ -234,8 +286,10 @@ public class BeanSelectionProvider implements ConfigurationProvider {
public void register(ContainerBuilder builder, LocatableProperties props) {
alias(ObjectFactory.class, StrutsConstants.STRUTS_OBJECTFACTORY, builder, props);
alias(FileManagerFactory.class, StrutsConstants.STRUTS_FILE_MANAGER_FACTORY, builder, props);
alias(XWorkConverter.class, StrutsConstants.STRUTS_XWORKCONVERTER, builder, props);
alias(TextProvider.class, StrutsConstants.STRUTS_XWORKTEXTPROVIDER, builder, props, Scope.DEFAULT);
alias(LocaleProvider.class, StrutsConstants.STRUTS_LOCALE_PROVIDER, builder, props);
alias(ActionProxyFactory.class, StrutsConstants.STRUTS_ACTIONPROXYFACTORY, builder, props);
alias(ObjectTypeDeterminer.class, StrutsConstants.STRUTS_OBJECTTYPEDETERMINER, builder, props);
alias(ActionMapper.class, StrutsConstants.STRUTS_MAPPER_CLASS, builder, props);
@@ -252,21 +306,28 @@ public class BeanSelectionProvider implements ConfigurationProvider {
alias(UnknownHandlerManager.class, StrutsConstants.STRUTS_UNKNOWN_HANDLER_MANAGER, builder, props);
alias(UrlHelper.class, StrutsConstants.STRUTS_URL_HELPER, builder, props);
alias(CollectionConverter.class, StrutsConstants.STRUTS_CONVERTER_COLLECTION, builder, props);
alias(ArrayConverter.class, StrutsConstants.STRUTS_CONVERTER_ARRAY, builder, props);
alias(DateConverter.class, StrutsConstants.STRUTS_CONVERTER_DATE, builder, props);
alias(NumberConverter.class, StrutsConstants.STRUTS_CONVERTER_NUMBER, builder, props);
alias(StringConverter.class, StrutsConstants.STRUTS_CONVERTER_STRING, builder, props);
if ("true".equalsIgnoreCase(props.getProperty(StrutsConstants.STRUTS_DEVMODE))) {
props.setProperty(StrutsConstants.STRUTS_I18N_RELOAD, "true");
props.setProperty(StrutsConstants.STRUTS_CONFIGURATION_XML_RELOAD, "true");
props.setProperty(StrutsConstants.STRUTS_FREEMARKER_TEMPLATES_CACHE, "false");
props.setProperty(StrutsConstants.STRUTS_FREEMARKER_TEMPLATES_CACHE_UPDATE_DELAY, "0");
// Convert struts properties into ones that xwork expects
props.setProperty("devMode", "true");
props.setProperty(XWorkConstants.DEV_MODE, "true");
} else {
props.setProperty("devMode", "false");
props.setProperty(XWorkConstants.DEV_MODE, "false");
}
// Convert Struts properties into XWork properties
convertIfExist(props, StrutsConstants.STRUTS_LOG_MISSING_PROPERTIES, "logMissingProperties");
convertIfExist(props, StrutsConstants.STRUTS_ENABLE_OGNL_EXPRESSION_CACHE, "enableOGNLExpressionCache");
convertIfExist(props, StrutsConstants.STRUTS_ALLOW_STATIC_METHOD_ACCESS, "allowStaticMethodAccess");
convertIfExist(props, StrutsConstants.STRUTS_LOG_MISSING_PROPERTIES, XWorkConstants.LOG_MISSING_PROPERTIES);
convertIfExist(props, StrutsConstants.STRUTS_ENABLE_OGNL_EXPRESSION_CACHE, XWorkConstants.ENABLE_OGNL_EXPRESSION_CACHE);
convertIfExist(props, StrutsConstants.STRUTS_ALLOW_STATIC_METHOD_ACCESS, XWorkConstants.ALLOW_STATIC_METHOD_ACCESS);
convertIfExist(props, StrutsConstants.STRUTS_CONFIGURATION_XML_RELOAD, XWorkConstants.RELOAD_XML_CONFIGURATION);
LocalizedTextUtil.addDefaultResourceBundle("org/apache/struts2/struts-messages");
loadCustomResourceBundles(props);
@@ -306,20 +367,20 @@ public class BeanSelectionProvider implements ConfigurationProvider {
String foundName = props.getProperty(key, DEFAULT_BEAN_NAME);
if (builder.contains(type, foundName)) {
if (LOG.isInfoEnabled()) {
LOG.info("Choosing bean (#1) for (#2)", foundName, type.getName());
LOG.info("Choosing bean (#0) for (#1)", foundName, type.getName());
}
builder.alias(type, foundName, Container.DEFAULT_NAME);
} else {
try {
Class cls = ClassLoaderUtil.loadClass(foundName, this.getClass());
if (LOG.isDebugEnabled()) {
LOG.debug("Choosing bean (#1) for (#2)", cls.getName(), type.getName());
LOG.debug("Choosing bean (#0) for (#1)", cls.getName(), type.getName());
}
builder.factory(type, cls, scope);
} catch (ClassNotFoundException ex) {
// Perhaps a spring bean id, so we'll delegate to the object factory at runtime
if (LOG.isDebugEnabled()) {
LOG.debug("Choosing bean (#1) for (#2) to be loaded from the ObjectFactory", foundName, type.getName());
LOG.debug("Choosing bean (#0) for (#1) to be loaded from the ObjectFactory", foundName, type.getName());
}
if (DEFAULT_BEAN_NAME.equals(foundName)) {
// Probably an optional bean, will ignore
@@ -334,7 +395,7 @@ public class BeanSelectionProvider implements ConfigurationProvider {
}
} else {
if (LOG.isWarnEnabled()) {
LOG.warn("Unable to alias bean type (#1), default mapping already assigned.", type.getName());
LOG.warn("Unable to alias bean type (#0), default mapping already assigned.", type.getName());
}
}
}
@@ -24,12 +24,17 @@ package org.apache.struts2.dispatcher;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionProxy;
import com.opensymphony.xwork2.ActionProxyFactory;
import com.opensymphony.xwork2.FileManager;
import com.opensymphony.xwork2.FileManagerFactory;
import com.opensymphony.xwork2.LocaleProvider;
import com.opensymphony.xwork2.ObjectFactory;
import com.opensymphony.xwork2.Result;
import com.opensymphony.xwork2.config.Configuration;
import com.opensymphony.xwork2.config.ConfigurationException;
import com.opensymphony.xwork2.config.ConfigurationManager;
import com.opensymphony.xwork2.config.ConfigurationProvider;
import com.opensymphony.xwork2.config.FileManagerFactoryProvider;
import com.opensymphony.xwork2.config.FileManagerProvider;
import com.opensymphony.xwork2.config.entities.InterceptorMapping;
import com.opensymphony.xwork2.config.entities.InterceptorStackConfig;
import com.opensymphony.xwork2.config.entities.PackageConfig;
@@ -39,7 +44,6 @@ import com.opensymphony.xwork2.inject.ContainerBuilder;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.interceptor.Interceptor;
import com.opensymphony.xwork2.util.ClassLoaderUtil;
import com.opensymphony.xwork2.util.FileManager;
import com.opensymphony.xwork2.util.LocalizedTextUtil;
import com.opensymphony.xwork2.util.ValueStack;
import com.opensymphony.xwork2.util.ValueStackFactory;
@@ -63,6 +67,7 @@ import org.apache.struts2.dispatcher.multipart.MultiPartRequest;
import org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper;
import org.apache.struts2.util.AttributeMap;
import org.apache.struts2.util.ObjectFactoryDestroyable;
import org.apache.struts2.util.fs.JBossFileManager;
import org.apache.struts2.views.freemarker.FreemarkerManager;
import javax.servlet.ServletContext;
@@ -73,7 +78,6 @@ import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -151,6 +155,12 @@ public class Dispatcher {
*/
private boolean paramsWorkaroundEnabled = false;
/**
* Indicates if Dispatcher should handle exception and call sendError()
* Introduced to allow integration with other frameworks like Spring Security
*/
private boolean handleException;
/**
* Provide the dispatcher instance for the current thread.
*
@@ -250,6 +260,11 @@ public class Dispatcher {
this.valueStackFactory = valueStackFactory;
}
@Inject(StrutsConstants.STRUTS_HANDLE_EXCEPTION)
public void setHandleException(String handleException) {
this.handleException = Boolean.parseBoolean(handleException);
}
/**
* Releases all instances bound to this dispatcher instance.
*/
@@ -306,6 +321,28 @@ public class Dispatcher {
configurationManager = null;
}
private void init_FileManager() throws ClassNotFoundException {
if (initParams.containsKey(StrutsConstants.STRUTS_FILE_MANAGER)) {
final String fileManagerClassName = initParams.get(StrutsConstants.STRUTS_FILE_MANAGER);
final Class<FileManager> fileManagerClass = (Class<FileManager>) Class.forName(fileManagerClassName);
if (LOG.isInfoEnabled()) {
LOG.info("Custom FileManager specified: #0", fileManagerClassName);
}
configurationManager.addContainerProvider(new FileManagerProvider(fileManagerClass, fileManagerClass.getSimpleName()));
} else {
// add any other Struts 2 provided implementations of FileManager
configurationManager.addContainerProvider(new FileManagerProvider(JBossFileManager.class, "jboss"));
}
if (initParams.containsKey(StrutsConstants.STRUTS_FILE_MANAGER_FACTORY)) {
final String fileManagerFactoryClassName = initParams.get(StrutsConstants.STRUTS_FILE_MANAGER_FACTORY);
final Class<FileManagerFactory> fileManagerFactoryClass = (Class<FileManagerFactory>) Class.forName(fileManagerFactoryClassName);
if (LOG.isInfoEnabled()) {
LOG.info("Custom FileManagerFactory specified: #0", fileManagerFactoryClassName);
}
configurationManager.addContainerProvider(new FileManagerFactoryProvider(fileManagerFactoryClass));
}
}
private void init_DefaultProperties() {
configurationManager.addContainerProvider(new DefaultPropertiesProvider());
}
@@ -396,11 +433,6 @@ public class Dispatcher {
return container;
}
private void init_CheckConfigurationReloading(Container container) {
FileManager.setReloadingConfigs("true".equals(container.getInstance(String.class,
StrutsConstants.STRUTS_CONFIGURATION_XML_RELOAD)));
}
private void init_CheckWebLogicWorkaround(Container container) {
// test whether param-access workaround needs to be enabled
if (servletContext != null && servletContext.getServerInfo() != null
@@ -426,6 +458,7 @@ public class Dispatcher {
}
try {
init_FileManager();
init_DefaultProperties(); // [1]
init_TraditionalXmlConfigurations(); // [2]
init_LegacyStrutsProperties(); // [3]
@@ -435,7 +468,6 @@ public class Dispatcher {
Container container = init_PreloadConfiguration();
container.inject(this);
init_CheckConfigurationReloading(container);
init_CheckWebLogicWorkaround(container);
if (!dispatcherListeners.isEmpty()) {
@@ -516,21 +548,24 @@ public class Dispatcher {
}
} catch (ConfigurationException e) {
// WW-2874 Only log error if in devMode
if(devMode) {
if (devMode) {
String reqStr = request.getRequestURI();
if (request.getQueryString() != null) {
reqStr = reqStr + "?" + request.getQueryString();
}
LOG.error("Could not find action or result\n" + reqStr, e);
} else {
if (LOG.isWarnEnabled()) {
LOG.warn("Could not find action or result", e);
}
}
else {
if (LOG.isWarnEnabled()) {
LOG.warn("Could not find action or result", e);
}
}
sendError(request, response, context, HttpServletResponse.SC_NOT_FOUND, e);
} catch (Exception e) {
sendError(request, response, context, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e);
if (handleException || devMode) {
sendError(request, response, context, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e);
} else {
throw new ServletException(e);
}
} finally {
UtilTimerStack.pop(timerKey);
}
@@ -679,6 +714,10 @@ public class Dispatcher {
if (defaultEncoding != null) {
encoding = defaultEncoding;
}
// check for Ajax request to use UTF-8 encoding strictly http://www.w3.org/TR/XMLHttpRequest/#the-send-method
if ("XMLHttpRequest".equals(request.getHeader("X-Requested-With"))) {
encoding = "UTF-8";
}
Locale locale = null;
if (defaultLocale != null) {
@@ -686,11 +725,7 @@ public class Dispatcher {
}
if (encoding != null) {
try {
request.setCharacterEncoding(encoding);
} catch (Exception e) {
LOG.error("Error setting character encoding to '" + encoding + "' - ignoring.", e);
}
applyEncoding(request, encoding);
}
if (locale != null) {
@@ -702,6 +737,18 @@ public class Dispatcher {
}
}
private void applyEncoding(HttpServletRequest request, String encoding) {
try {
if (!encoding.equals(request.getCharacterEncoding())) {
// if the encoding is already correctly set and the parameters have been already read
// do not try to set encoding because it is useless and will cause an error
request.setCharacterEncoding(encoding);
}
} catch (Exception e) {
LOG.error("Error setting character encoding to '" + encoding + "' - ignoring.", e);
}
}
/**
* Wrap and return the given request or return the original request object.
* </p>
@@ -727,17 +774,16 @@ public class Dispatcher {
MultiPartRequest mpr = null;
//check for alternate implementations of MultiPartRequest
Set<String> multiNames = getContainer().getInstanceNames(MultiPartRequest.class);
if (multiNames != null) {
for (String multiName : multiNames) {
if (multiName.equals(multipartHandlerName)) {
mpr = getContainer().getInstance(MultiPartRequest.class, multiName);
}
for (String multiName : multiNames) {
if (multiName.equals(multipartHandlerName)) {
mpr = getContainer().getInstance(MultiPartRequest.class, multiName);
}
}
if (mpr == null ) {
mpr = getContainer().getInstance(MultiPartRequest.class);
}
request = new MultiPartRequestWrapper(mpr, request, getSaveDir(servletContext));
LocaleProvider provider = getContainer().getInstance(LocaleProvider.class);
request = new MultiPartRequestWrapper(mpr, request, getSaveDir(servletContext), provider);
} else {
request = new StrutsRequestWrapper(request);
}
@@ -750,35 +796,13 @@ public class Dispatcher {
*
* @param request the HttpServletRequest object.
* @see org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper
* @throws java.io.IOException on any error.
*/
public void cleanUpRequest(HttpServletRequest request) throws IOException {
public void cleanUpRequest(HttpServletRequest request) {
if (!(request instanceof MultiPartRequestWrapper)) {
return;
}
MultiPartRequestWrapper multiWrapper = (MultiPartRequestWrapper) request;
Enumeration fileParameterNames = multiWrapper.getFileParameterNames();
while (fileParameterNames != null && fileParameterNames.hasMoreElements()) {
String inputValue = (String) fileParameterNames.nextElement();
File[] files = multiWrapper.getFiles(inputValue);
for (File currentFile : files) {
if (LOG.isInfoEnabled()) {
String msg = LocalizedTextUtil.findText(this.getClass(), "struts.messages.removing.file", Locale.ENGLISH, "no.message.found", new Object[]{inputValue, currentFile});
LOG.info(msg);
}
if ((currentFile != null) && currentFile.isFile()) {
if (!currentFile.delete()) {
if (LOG.isWarnEnabled()) {
LOG.warn("Resource Leaking: Could not remove uploaded file '" + currentFile.getCanonicalPath() + "'.");
}
}
}
}
}
multiWrapper.cleanUp();
}
/**
@@ -790,8 +814,7 @@ public class Dispatcher {
* @param e the Exception that is reported.
* @param ctx the ServletContext object.
*/
public void sendError(HttpServletRequest request, HttpServletResponse response,
ServletContext ctx, int code, Exception e) {
public void sendError(HttpServletRequest request, HttpServletResponse response, ServletContext ctx, int code, Exception e) {
Boolean devModeOverride = FilterDispatcher.getDevModeOverride();
if (devModeOverride != null ? devModeOverride : devMode) {
response.setContentType("text/html");
@@ -388,6 +388,8 @@ public class FilterDispatcher implements StrutsStatics, Filter {
*/
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
showDeprecatedWarning();
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;
ServletContext servletContext = getServletContext();
@@ -441,4 +443,21 @@ public class FilterDispatcher implements StrutsStatics, Filter {
devModeOverride.remove();
}
}
private void showDeprecatedWarning() {
String msg =
"\n\n" +
"***********************************************************************\n" +
"* WARNING!!! *\n" +
"* *\n" +
"* >>> FilterDispatcher <<< is deprecated! Please use the new filters! *\n" +
"* *\n" +
"* This can be a source of unpredictable problems! *\n" +
"* *\n" +
"* Please refer to the docs for more details! *\n" +
"* http://struts.apache.org/2.x/docs/webxml.html *\n" +
"* *\n" +
"***********************************************************************\n\n";
System.out.println(msg);
}
}
@@ -27,6 +27,7 @@ import com.opensymphony.xwork2.util.logging.LoggerFactory;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
@@ -35,7 +36,7 @@ import java.nio.charset.Charset;
/**
* <!-- START SNIPPET: description -->
*
* A result that send the content out as plain text. Usefull typically when needed
* A result that send the content out as plain text. Useful typically when needed
* to display the raw content of a JSP or Html file for example.
*
* <!-- END SNIPPET: description -->
@@ -57,12 +58,12 @@ import java.nio.charset.Charset;
* <!-- START SNIPPET: example -->
*
* &lt;action name="displayJspRawContent" &gt;
* &lt;result type="plaintext"&gt;/myJspFile.jsp&lt;/result&gt;
* &lt;result type="plainText"&gt;/myJspFile.jsp&lt;/result&gt;
* &lt;/action&gt;
*
*
* &lt;action name="displayJspRawContent" &gt;
* &lt;result type="plaintext"&gt;
* &lt;result type="plainText"&gt;
* &lt;param name="location"&gt;/myJspFile.jsp&lt;/param&gt;
* &lt;param name="charSet"&gt;UTF-8&lt;/param&gt;
* &lt;/result&gt;
@@ -112,53 +113,27 @@ public class PlainTextResult extends StrutsResultSupport {
* @see org.apache.struts2.dispatcher.StrutsResultSupport#doExecute(java.lang.String, com.opensymphony.xwork2.ActionInvocation)
*/
protected void doExecute(String finalLocation, ActionInvocation invocation) throws Exception {
// verify charset
Charset charset = null;
if (charSet != null) {
if (Charset.isSupported(charSet)) {
charset = Charset.forName(charSet);
}
else {
if (LOG.isWarnEnabled()) {
LOG.warn("charset ["+charSet+"] is not recognized ");
}
charset = null;
}
}
Charset charset = readCharset();
HttpServletResponse response = (HttpServletResponse) invocation.getInvocationContext().get(HTTP_RESPONSE);
ServletContext servletContext = (ServletContext) invocation.getInvocationContext().get(SERVLET_CONTEXT);
if (charset != null) {
response.setContentType("text/plain; charset="+charSet);
}
else {
response.setContentType("text/plain");
}
response.setHeader("Content-Disposition", "inline");
applyCharset(charset, response);
applyAdditionalHeaders(response);
String location = adjustLocation(finalLocation);
PrintWriter writer = response.getWriter();
InputStreamReader reader = null;
try {
InputStream resourceAsStream = servletContext.getResourceAsStream(finalLocation);
InputStream resourceAsStream = readStream(invocation, location);
logWrongStream(finalLocation, resourceAsStream);
if (charset != null) {
reader = new InputStreamReader(resourceAsStream, charset);
} else {
reader = new InputStreamReader(resourceAsStream);
}
if (resourceAsStream == null) {
if (LOG.isWarnEnabled()) {
LOG.warn("resource at location ["+finalLocation+"] cannot be obtained (return null) from ServletContext !!! ");
}
} else {
char[] buffer = new char[BUFFER_SIZE];
int charRead;
while((charRead = reader.read(buffer)) != -1) {
writer.write(buffer, 0, charRead);
}
if (resourceAsStream != null) {
sendStream(writer, reader);
}
} finally {
if (reader != null)
@@ -169,4 +144,60 @@ public class PlainTextResult extends StrutsResultSupport {
}
}
}
protected InputStream readStream(ActionInvocation invocation, String location) {
ServletContext servletContext = (ServletContext) invocation.getInvocationContext().get(SERVLET_CONTEXT);
return servletContext.getResourceAsStream(location);
}
protected void logWrongStream(String finalLocation, InputStream resourceAsStream) {
if (resourceAsStream == null) {
if (LOG.isWarnEnabled()) {
LOG.warn("Resource at location [" + finalLocation + "] cannot be obtained (return null) from ServletContext !!! ");
}
}
}
protected void sendStream(PrintWriter writer, InputStreamReader reader) throws IOException {
char[] buffer = new char[BUFFER_SIZE];
int charRead;
while((charRead = reader.read(buffer)) != -1) {
writer.write(buffer, 0, charRead);
}
}
protected String adjustLocation(String location) {
if (location.charAt(0) != '/') {
return "/" + location;
}
return location;
}
protected void applyAdditionalHeaders(HttpServletResponse response) {
response.setHeader("Content-Disposition", "inline");
}
protected void applyCharset(Charset charset, HttpServletResponse response) {
if (charset != null) {
response.setContentType("text/plain; charset=" + charSet);
} else {
response.setContentType("text/plain");
}
}
protected Charset readCharset() {
Charset charset = null;
if (charSet != null) {
if (Charset.isSupported(charSet)) {
charset = Charset.forName(charSet);
} else {
if (LOG.isWarnEnabled()) {
LOG.warn("charset [" + charSet + "] is not recognized ");
}
charset = null;
}
}
return charset;
}
}
@@ -25,7 +25,7 @@ import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.StrutsStatics;
@@ -250,11 +250,13 @@ public class ServletRedirectResult extends StrutsResultSupport implements Reflec
}
private static boolean isPathUrl(String url) {
private boolean isPathUrl(String url) {
// filter out "http:", "https:", "mailto:", "file:", "ftp:"
// since the only valid places for : in URL's is before the path specification
// either before the port, or after the protocol
return (url.indexOf(':') == -1);
return !url.startsWith("http:")
&& !url.startsWith("https:")
&& !url.startsWith("mailto:")
&& !url.startsWith("file:")
&& !url.startsWith("ftp:");
}
/**
@@ -21,10 +21,10 @@
package org.apache.struts2.dispatcher.mapper;
import javax.servlet.http.HttpServletRequest;
import com.opensymphony.xwork2.config.ConfigurationManager;
import javax.servlet.http.HttpServletRequest;
/**
* <!-- START SNIPPET: javadoc -->
*
@@ -51,7 +51,7 @@ public interface ActionMapper {
*
* @param request The servlet request
* @param configManager The current configuration manager
* @return The appropriate action mapping
* @return The appropriate action mapping or null if mapping cannot be determined
*/
ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager);
@@ -21,10 +21,13 @@
package org.apache.struts2.dispatcher.multipart;
import com.opensymphony.xwork2.LocaleProvider;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.util.LocalizedTextUtil;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUploadBase;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.RequestContext;
import org.apache.commons.fileupload.disk.DiskFileItem;
@@ -42,50 +45,84 @@ import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
/**
* Multipart form data request adapter for Jakarta Commons Fileupload package.
*/
public class JakartaMultiPartRequest implements MultiPartRequest {
static final Logger LOG = LoggerFactory.getLogger(MultiPartRequest.class);
static final Logger LOG = LoggerFactory.getLogger(JakartaMultiPartRequest.class);
// maps parameter name -> List of FileItem objects
protected Map<String,List<FileItem>> files = new HashMap<String,List<FileItem>>();
protected Map<String, List<FileItem>> files = new HashMap<String, List<FileItem>>();
// maps parameter name -> List of param values
protected Map<String,List<String>> params = new HashMap<String,List<String>>();
protected Map<String, List<String>> params = new HashMap<String, List<String>>();
// any errors while processing this request
protected List<String> errors = new ArrayList<String>();
protected long maxSize;
private Locale defaultLocale = Locale.ENGLISH;
@Inject(StrutsConstants.STRUTS_MULTIPART_MAXSIZE)
public void setMaxSize(String maxSize) {
this.maxSize = Long.parseLong(maxSize);
}
@Inject
public void setLocaleProvider(LocaleProvider provider) {
defaultLocale = provider.getLocale();
}
/**
* Creates a new request wrapper to handle multi-part data using methods adapted from Jason Pell's
* multipart classes (see class description).
*
* @param saveDir the directory to save off the file
* @param saveDir the directory to save off the file
* @param request the request containing the multipart
* @throws java.io.IOException is thrown if encoding fails.
* @throws java.io.IOException is thrown if encoding fails.
*/
public void parse(HttpServletRequest request, String saveDir) throws IOException {
try {
setLocale(request);
processUpload(request, saveDir);
} catch (FileUploadException e) {
} catch (FileUploadBase.SizeLimitExceededException e) {
if (LOG.isWarnEnabled()) {
LOG.warn("Unable to parse request", e);
LOG.warn("Request exceeded size limit!", e);
}
String errorMessage = buildErrorMessage(e, new Object[]{e.getPermittedSize(), e.getActualSize()});
if (!errors.contains(errorMessage)) {
errors.add(errorMessage);
}
} catch (Exception e) {
if (LOG.isWarnEnabled()) {
LOG.warn("Unable to parse request", e);
}
String errorMessage = buildErrorMessage(e, new Object[]{});
if (!errors.contains(errorMessage)) {
errors.add(errorMessage);
}
errors.add(e.getMessage());
}
}
protected void setLocale(HttpServletRequest request) {
if (defaultLocale == null) {
defaultLocale = request.getLocale();
}
}
protected String buildErrorMessage(Throwable e, Object[] args) {
String errorKey = "struts.messages.upload.error." + e.getClass().getSimpleName();
if (LOG.isDebugEnabled()) {
LOG.debug("Preparing error message for key: [#0]", errorKey);
}
return LocalizedTextUtil.findText(this.getClass(), errorKey, defaultLocale, e.getMessage(), args);
}
private void processUpload(HttpServletRequest request, String saveDir) throws FileUploadException, UnsupportedEncodingException {
for (FileItem item : parseRequest(request, saveDir)) {
if (LOG.isDebugEnabled()) {
@@ -142,6 +179,7 @@ public class JakartaMultiPartRequest implements MultiPartRequest {
values.add(item.getString());
}
params.put(item.getFieldName(), values);
item.delete();
}
private List<FileItem> parseRequest(HttpServletRequest servletRequest, String saveDir) throws FileUploadException {
@@ -199,12 +237,12 @@ public class JakartaMultiPartRequest implements MultiPartRequest {
List<File> fileList = new ArrayList<File>(items.size());
for (FileItem fileItem : items) {
File storeLocation = ((DiskFileItem) fileItem).getStoreLocation();
if(fileItem.isInMemory() && storeLocation!=null && !storeLocation.exists()) {
if (fileItem.isInMemory() && storeLocation != null && !storeLocation.exists()) {
try {
storeLocation.createNewFile();
} catch (IOException e) {
if(LOG.isErrorEnabled()){
LOG.error("Cannot write uploaded empty file to disk: " + storeLocation.getAbsolutePath(),e);
if (LOG.isErrorEnabled()) {
LOG.error("Cannot write uploaded empty file to disk: " + storeLocation.getAbsolutePath(), e);
}
}
}
@@ -284,14 +322,14 @@ public class JakartaMultiPartRequest implements MultiPartRequest {
/* (non-Javadoc)
* @see org.apache.struts2.dispatcher.multipart.MultiPartRequest#getErrors()
*/
public List getErrors() {
public List<String> getErrors() {
return errors;
}
/**
* Returns the canonical name of the given file.
*
* @param filename the given file
* @param filename the given file
* @return the canonical name of the given file
*/
private String getCanonicalName(String filename) {
@@ -309,7 +347,7 @@ public class JakartaMultiPartRequest implements MultiPartRequest {
/**
* Creates a RequestContext needed by Jakarta Commons Upload.
*
* @param req the request.
* @param req the request.
* @return a new request context.
*/
private RequestContext createRequestContext(final HttpServletRequest req) {
@@ -336,4 +374,24 @@ public class JakartaMultiPartRequest implements MultiPartRequest {
};
}
/* (non-Javadoc)
* @see org.apache.struts2.dispatcher.multipart.MultiPartRequest#cleanUp()
*/
public void cleanUp() {
Set<String> names = files.keySet();
for (String name : names) {
List<FileItem> items = files.get(name);
for (FileItem item : items) {
if (LOG.isDebugEnabled()) {
String msg = LocalizedTextUtil.findText(this.getClass(), "struts.messages.removing.file",
Locale.ENGLISH, "no.message.found", new Object[]{name, item});
LOG.debug(msg);
}
if (!item.isInMemory()) {
item.delete();
}
}
}
}
}
@@ -21,13 +21,12 @@
package org.apache.struts2.dispatcher.multipart;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;
import java.util.Enumeration;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
/**
* Abstract wrapper class HTTP requests to handle multi-part data. <p>
@@ -114,5 +113,11 @@ public interface MultiPartRequest {
*
* @return a list of Strings that represent various errors during parsing
*/
public List getErrors();
public List<String> getErrors();
/**
* Cleans up all uploaded file, should be called at the end of request
*/
public void cleanUp();
}
@@ -21,22 +21,23 @@
package org.apache.struts2.dispatcher.multipart;
import com.opensymphony.xwork2.LocaleProvider;
import com.opensymphony.xwork2.util.LocalizedTextUtil;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import org.apache.struts2.dispatcher.StrutsRequestWrapper;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Vector;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.dispatcher.StrutsRequestWrapper;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
/**
* Parse a multipart request and provide a wrapper around the request. The parsing implementation used
@@ -55,33 +56,54 @@ import com.opensymphony.xwork2.util.logging.LoggerFactory;
*
*/
public class MultiPartRequestWrapper extends StrutsRequestWrapper {
protected static final Logger LOG = LoggerFactory.getLogger(MultiPartRequestWrapper.class);
Collection<String> errors;
MultiPartRequest multi;
private Collection<String> errors;
private MultiPartRequest multi;
private Locale defaultLocale = Locale.ENGLISH;
/**
* Process file downloads and log any errors.
*
* @param multiPartRequest Our MultiPartRequest object
* @param request Our HttpServletRequest object
* @param saveDir Target directory for any files that we save
* @param multiPartRequest Our MultiPartRequest object
* @param provider
*/
public MultiPartRequestWrapper(MultiPartRequest multiPartRequest, HttpServletRequest request, String saveDir) {
public MultiPartRequestWrapper(MultiPartRequest multiPartRequest, HttpServletRequest request, String saveDir, LocaleProvider provider) {
super(request);
errors = new ArrayList<String>();
multi = multiPartRequest;
defaultLocale = provider.getLocale();
setLocale(request);
try {
multi.parse(request, saveDir);
for (Object o : multi.getErrors()) {
String error = (String) o;
for (String error : multi.getErrors()) {
addError(error);
}
} catch (IOException e) {
addError("Cannot parse request: "+e.toString());
if (LOG.isWarnEnabled()) {
LOG.warn(e.getMessage(), e);
}
addError(buildErrorMessage(e, new Object[] {e.getMessage()}));
}
}
protected void setLocale(HttpServletRequest request) {
if (defaultLocale == null) {
defaultLocale = request.getLocale();
}
}
protected String buildErrorMessage(Throwable e, Object[] args) {
String errorKey = "struts.messages.upload.error." + e.getClass().getSimpleName();
if (LOG.isDebugEnabled()) {
LOG.debug("Preparing error message for key: [#0]", errorKey);
}
return LocalizedTextUtil.findText(this.getClass(), errorKey, defaultLocale, e.getMessage(), args);
}
/**
* Get an enumeration of the parameter names for uploaded files
*
@@ -200,7 +222,7 @@ public class MultiPartRequestWrapper extends StrutsRequestWrapper {
* @return <tt>true</tt> if any errors occured when parsing the HTTP multipart request, <tt>false</tt> otherwise.
*/
public boolean hasErrors() {
return !((errors == null) || errors.isEmpty());
return !errors.isEmpty();
}
/**
@@ -213,16 +235,14 @@ public class MultiPartRequestWrapper extends StrutsRequestWrapper {
}
/**
* Adds an error message.
* Adds an error message when it isn't already added.
*
* @param anErrorMessage the error message to report.
*/
protected void addError(String anErrorMessage) {
if (errors == null) {
errors = new ArrayList<String>();
if (!errors.contains(anErrorMessage)) {
errors.add(anErrorMessage);
}
errors.add(anErrorMessage);
}
/**
@@ -245,4 +265,11 @@ public class MultiPartRequestWrapper extends StrutsRequestWrapper {
return temp.elements();
}
public void cleanUp() {
if (multi != null) {
multi.cleanUp();
}
}
}
@@ -20,23 +20,21 @@
*/
package org.apache.struts2.dispatcher.ng;
import org.apache.struts2.dispatcher.Dispatcher;
import org.apache.struts2.dispatcher.mapper.ActionMapping;
import org.apache.struts2.dispatcher.mapper.ActionMapper;
import org.apache.struts2.StrutsException;
import org.apache.struts2.RequestUtils;
import javax.servlet.ServletException;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.util.ValueStack;
import com.opensymphony.xwork2.util.ValueStackFactory;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import org.apache.struts2.RequestUtils;
import org.apache.struts2.StrutsException;
import org.apache.struts2.dispatcher.Dispatcher;
import org.apache.struts2.dispatcher.mapper.ActionMapper;
import org.apache.struts2.dispatcher.mapper.ActionMapping;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
@@ -47,6 +45,8 @@ import java.util.regex.Pattern;
*/
public class PrepareOperations {
private static final Logger LOG = LoggerFactory.getLogger(PrepareOperations.class);
private ServletContext servletContext;
private Dispatcher dispatcher;
private static final String STRUTS_ACTION_MAPPING_KEY = "struts.actionMapping";
@@ -98,10 +98,13 @@ public class PrepareOperations {
return;
}
}
// always clean up the thread request, even if an action hasn't been executed
ActionContext.setContext(null);
Dispatcher.setInstance(null);
try {
dispatcher.cleanUpRequest(request);
} finally {
ActionContext.setContext(null);
Dispatcher.setInstance(null);
}
}
/**
@@ -173,7 +176,7 @@ public class PrepareOperations {
*/
public void cleanupDispatcher() {
if (dispatcher == null) {
throw new StrutsException("something is seriously wrong, Dispatcher is not initialized (null) ");
throw new StrutsException("Something is seriously wrong, Dispatcher is not initialized (null) ");
} else {
try {
dispatcher.cleanup();
@@ -72,7 +72,7 @@ public class CheckboxInterceptor extends AbstractInterceptor {
iterator.remove();
if (values != null && values instanceof String[] && ((String[])values).length > 1) {
if (LOG.isDebugEnabled()) {
LOG.debug("Bypassing automatic checkbox detection due to multiple checkboxes of the same name: #1", name);
LOG.debug("Bypassing automatic checkbox detection due to multiple checkboxes of the same name: #0", name);
}
continue;
}
@@ -257,8 +257,9 @@ public class ExecuteAndWaitInterceptor extends MethodFilterInterceptor {
if ((!executeAfterValidationPass || !secondTime) && bp != null && !bp.isDone()) {
actionInvocation.getStack().push(bp.getAction());
if (TokenHelper.getToken() != null) {
session.put(TokenHelper.getTokenName(), TokenHelper.getToken());
final String token = TokenHelper.getToken();
if (token != null) {
TokenHelper.setSessionToken(TokenHelper.getTokenName(), token);
}
Map results = proxy.getConfig().getResults();
@@ -24,10 +24,13 @@ package org.apache.struts2.interceptor;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.ActionProxy;
import com.opensymphony.xwork2.LocaleProvider;
import com.opensymphony.xwork2.TextProvider;
import com.opensymphony.xwork2.TextProviderFactory;
import com.opensymphony.xwork2.ValidationAware;
import com.opensymphony.xwork2.inject.Container;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
import com.opensymphony.xwork2.util.LocalizedTextUtil;
import com.opensymphony.xwork2.util.PatternMatcher;
import com.opensymphony.xwork2.util.TextParseUtil;
import com.opensymphony.xwork2.util.logging.Logger;
@@ -37,7 +40,14 @@ import org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.util.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* <!-- START SNIPPET: description -->
@@ -145,27 +155,27 @@ import java.util.*;
* <pre>
* <!-- START SNIPPET: example-action -->
* package com.example;
* <p/>
*
* import java.io.File;
* import com.opensymphony.xwork2.ActionSupport;
* <p/>
*
* public UploadAction extends ActionSupport {
* private File file;
* private String contentType;
* private String filename;
* <p/>
*
* public void setUpload(File file) {
* this.file = file;
* }
* <p/>
*
* public void setUploadContentType(String contentType) {
* this.contentType = contentType;
* }
* <p/>
*
* public void setUploadFileName(String filename) {
* this.filename = filename;
* }
* <p/>
*
* public String execute() {
* //...
* return SUCCESS;
@@ -179,23 +189,22 @@ public class FileUploadInterceptor extends AbstractInterceptor {
private static final long serialVersionUID = -4764627478894962478L;
protected static final Logger LOG = LoggerFactory.getLogger(FileUploadInterceptor.class);
private static final String DEFAULT_MESSAGE = "no.message.found";
protected boolean useActionMessageBundle;
protected Long maximumSize;
protected Set<String> allowedTypesSet = Collections.emptySet();
protected Set<String> allowedExtensionsSet = Collections.emptySet();
private PatternMatcher matcher;
private Container container;
@Inject
public void setMatcher(PatternMatcher matcher) {
this.matcher = matcher;
}
public void setUseActionMessageBundle(String value) {
this.useActionMessageBundle = Boolean.valueOf(value);
@Inject
public void setContainer(Container container) {
this.container = container;
}
/**
@@ -237,7 +246,7 @@ public class FileUploadInterceptor extends AbstractInterceptor {
if (!(request instanceof MultiPartRequestWrapper)) {
if (LOG.isDebugEnabled()) {
ActionProxy proxy = invocation.getProxy();
LOG.debug(getTextMessage("struts.messages.bypass.request", new Object[]{proxy.getNamespace(), proxy.getActionName()}, ac.getLocale()));
LOG.debug(getTextMessage("struts.messages.bypass.request", new String[]{proxy.getNamespace(), proxy.getActionName()}));
}
return invocation.invoke();
@@ -258,10 +267,6 @@ public class FileUploadInterceptor extends AbstractInterceptor {
if (validation != null) {
validation.addActionError(error);
}
if (LOG.isWarnEnabled()) {
LOG.warn(error);
}
}
}
@@ -289,7 +294,7 @@ public class FileUploadInterceptor extends AbstractInterceptor {
String fileNameName = inputName + "FileName";
for (int index = 0; index < files.length; index++) {
if (acceptFile(action, files[index], fileName[index], contentType[index], inputName, validation, ac.getLocale())) {
if (acceptFile(action, files[index], fileName[index], contentType[index], inputName, validation)) {
acceptedFiles.add(files[index]);
acceptedContentTypes.add(contentType[index]);
acceptedFileNames.add(fileName[index]);
@@ -306,12 +311,12 @@ public class FileUploadInterceptor extends AbstractInterceptor {
}
} else {
if (LOG.isWarnEnabled()) {
LOG.warn(getTextMessage(action, "struts.messages.invalid.file", new Object[]{inputName}, ac.getLocale()));
LOG.warn(getTextMessage(action, "struts.messages.invalid.file", new String[]{inputName}));
}
}
} else {
if (LOG.isWarnEnabled()) {
LOG.warn(getTextMessage(action, "struts.messages.invalid.content.type", new Object[]{inputName}, ac.getLocale()));
LOG.warn(getTextMessage(action, "struts.messages.invalid.content.type", new String[]{inputName}));
}
}
}
@@ -329,48 +334,47 @@ public class FileUploadInterceptor extends AbstractInterceptor {
* @param inputName - inputName of the file.
* @param validation - Non-null ValidationAware if the action implements ValidationAware, allowing for better
* logging.
* @param locale
* @return true if the proposed file is acceptable by contentType and size.
*/
protected boolean acceptFile(Object action, File file, String filename, String contentType, String inputName, ValidationAware validation, Locale locale) {
protected boolean acceptFile(Object action, File file, String filename, String contentType, String inputName, ValidationAware validation) {
boolean fileIsAcceptable = false;
// If it's null the upload failed
if (file == null) {
String errMsg = getTextMessage(action, "struts.messages.error.uploading", new Object[]{inputName}, locale);
String errMsg = getTextMessage(action, "struts.messages.error.uploading", new String[]{inputName});
if (validation != null) {
validation.addFieldError(inputName, errMsg);
}
if (LOG.isWarnEnabled()) {
LOG.warn(errMsg);
LOG.warn(errMsg);
}
} else if (maximumSize != null && maximumSize < file.length()) {
String errMsg = getTextMessage(action, "struts.messages.error.file.too.large", new Object[]{inputName, filename, file.getName(), "" + file.length()}, locale);
String errMsg = getTextMessage(action, "struts.messages.error.file.too.large", new String[]{inputName, filename, file.getName(), "" + file.length()});
if (validation != null) {
validation.addFieldError(inputName, errMsg);
}
if (LOG.isWarnEnabled()) {
LOG.warn(errMsg);
LOG.warn(errMsg);
}
} else if ((!allowedTypesSet.isEmpty()) && (!containsItem(allowedTypesSet, contentType))) {
String errMsg = getTextMessage(action, "struts.messages.error.content.type.not.allowed", new Object[]{inputName, filename, file.getName(), contentType}, locale);
String errMsg = getTextMessage(action, "struts.messages.error.content.type.not.allowed", new String[]{inputName, filename, file.getName(), contentType});
if (validation != null) {
validation.addFieldError(inputName, errMsg);
}
if (LOG.isWarnEnabled()) {
LOG.warn(errMsg);
LOG.warn(errMsg);
}
} else if ((!allowedExtensionsSet.isEmpty()) && (!hasAllowedExtension(allowedExtensionsSet, filename))) {
String errMsg = getTextMessage(action, "struts.messages.error.file.extension.not.allowed", new Object[]{inputName, filename, file.getName(), contentType}, locale);
String errMsg = getTextMessage(action, "struts.messages.error.file.extension.not.allowed", new String[]{inputName, filename, file.getName(), contentType});
if (validation != null) {
validation.addFieldError(inputName, errMsg);
}
if (LOG.isWarnEnabled()) {
LOG.warn(errMsg);
LOG.warn(errMsg);
}
} else {
fileIsAcceptable = true;
@@ -426,21 +430,34 @@ public class FileUploadInterceptor extends AbstractInterceptor {
return result;
}
private String getTextMessage(String messageKey, Object[] args, Locale locale) {
return getTextMessage(null, messageKey, args, locale);
protected String getTextMessage(String messageKey, String[] args) {
return getTextMessage(this, messageKey, args);
}
private String getTextMessage(Object action, String messageKey, Object[] args, Locale locale) {
if (args == null || args.length == 0) {
if (action != null && useActionMessageBundle) {
return LocalizedTextUtil.findText(action.getClass(), messageKey, locale);
}
return LocalizedTextUtil.findText(this.getClass(), messageKey, locale);
} else {
if (action != null && useActionMessageBundle) {
return LocalizedTextUtil.findText(action.getClass(), messageKey, locale, DEFAULT_MESSAGE, args);
}
return LocalizedTextUtil.findText(this.getClass(), messageKey, locale, DEFAULT_MESSAGE, args);
protected String getTextMessage(Object action, String messageKey, String[] args) {
if (action instanceof TextProvider) {
return ((TextProvider) action).getText(messageKey, args);
}
return getTextProvider(action).getText(messageKey, args);
}
private TextProvider getTextProvider(Object action) {
TextProviderFactory tpf = new TextProviderFactory();
if (container != null) {
container.inject(tpf);
}
LocaleProvider localeProvider = getLocaleProvider(action);
return tpf.createInstance(action.getClass(), localeProvider);
}
private LocaleProvider getLocaleProvider(Object action) {
LocaleProvider localeProvider;
if (action instanceof LocaleProvider) {
localeProvider = (LocaleProvider) action;
} else {
localeProvider = container.getInstance(LocaleProvider.class);
}
return localeProvider;
}
}
@@ -22,9 +22,10 @@
package org.apache.struts2.interceptor;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.TextProvider;
import com.opensymphony.xwork2.ValidationAware;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;
import com.opensymphony.xwork2.util.LocalizedTextUtil;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.util.TokenHelper;
@@ -120,18 +121,31 @@ public class TokenInterceptor extends MethodFilterInterceptor {
public static final String INVALID_TOKEN_CODE = "invalid.token";
private static final String INVALID_TOKEN_MESSAGE_KEY = "struts.messages.invalid.token";
private static final String DEFAULT_ERROR_MESSAGE = "The form has already been processed or no token was supplied, please try again.";
private TextProvider textProvider;
@Inject
public void setTextProvider(TextProvider textProvider) {
this.textProvider = textProvider;
}
/**
* @see com.opensymphony.xwork2.interceptor.MethodFilterInterceptor#doIntercept(com.opensymphony.xwork2.ActionInvocation)
*/
@Override
protected String doIntercept(ActionInvocation invocation) throws Exception {
if (log.isDebugEnabled()) {
log.debug("Intercepting invocation to check for valid transaction token.");
}
return handleToken(invocation);
}
protected String handleToken(ActionInvocation invocation) throws Exception {
//see WW-2902: we need to use the real HttpSession here, as opposed to the map
//that wraps the session, because a new wrap is created on every request
HttpSession session = ServletActionContext.getRequest().getSession(true);
synchronized (session) {
if (!TokenHelper.validToken()) {
return handleInvalidToken(invocation);
@@ -149,9 +163,7 @@ public class TokenInterceptor extends MethodFilterInterceptor {
*/
protected String handleInvalidToken(ActionInvocation invocation) throws Exception {
Object action = invocation.getAction();
String errorMessage = LocalizedTextUtil.findText(this.getClass(), "struts.messages.invalid.token",
invocation.getInvocationContext().getLocale(),
"The form has already been processed or no token was supplied, please try again.", new Object[0]);
String errorMessage = getErrorMessage(invocation);
if (action instanceof ValidationAware) {
((ValidationAware) action).addActionError(errorMessage);
@@ -162,6 +174,14 @@ public class TokenInterceptor extends MethodFilterInterceptor {
return INVALID_TOKEN_CODE;
}
protected String getErrorMessage(ActionInvocation invocation) {
Object action = invocation.getAction();
if (action instanceof TextProvider) {
return ((TextProvider) action).getText(INVALID_TOKEN_MESSAGE_KEY, DEFAULT_ERROR_MESSAGE);
}
return textProvider.getText(INVALID_TOKEN_MESSAGE_KEY, DEFAULT_ERROR_MESSAGE);
}
/**
* Called when a valid token is found. This method invokes the action by can be changed to do something more
* interesting.
@@ -172,4 +192,5 @@ public class TokenInterceptor extends MethodFilterInterceptor {
protected String handleValidToken(ActionInvocation invocation) throws Exception {
return invocation.invoke();
}
}
@@ -21,19 +21,18 @@
package org.apache.struts2.interceptor;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.util.InvocationSessionStore;
import org.apache.struts2.util.TokenHelper;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.Result;
import com.opensymphony.xwork2.util.ValueStack;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.util.InvocationSessionStore;
import org.apache.struts2.util.TokenHelper;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.Map;
/**
@@ -105,9 +104,20 @@ public class TokenSessionStoreInterceptor extends TokenInterceptor {
private static final long serialVersionUID = -9032347965469098195L;
/* (non-Javadoc)
* @see org.apache.struts2.interceptor.TokenInterceptor#handleInvalidToken(com.opensymphony.xwork2.ActionInvocation)
*/
@Override
protected String handleToken(ActionInvocation invocation) throws Exception {
//see WW-2902: we need to use the real HttpSession here, as opposed to the map
//that wraps the session, because a new wrap is created on every request
HttpSession session = ServletActionContext.getRequest().getSession(true);
synchronized (session) {
if (!TokenHelper.validToken()) {
return handleInvalidToken(invocation);
}
return handleValidToken(invocation);
}
}
@Override
protected String handleInvalidToken(ActionInvocation invocation) throws Exception {
ActionContext ac = invocation.getInvocationContext();
@@ -121,7 +131,8 @@ public class TokenSessionStoreInterceptor extends TokenInterceptor {
params.remove(tokenName);
params.remove(TokenHelper.TOKEN_NAME_FIELD);
ActionInvocation savedInvocation = InvocationSessionStore.loadInvocation(tokenName, token);
String sessionTokenName = TokenHelper.buildTokenSessionAttributeName(tokenName);
ActionInvocation savedInvocation = InvocationSessionStore.loadInvocation(sessionTokenName, token);
if (savedInvocation != null) {
// set the valuestack to the request scope
@@ -135,9 +146,7 @@ public class TokenSessionStoreInterceptor extends TokenInterceptor {
Result result = savedInvocation.getResult();
if ((result != null) && (savedInvocation.getProxy().getExecuteResult())) {
synchronized (context) {
result.execute(savedInvocation);
}
result.execute(savedInvocation);
}
// turn off execution of this invocations result
@@ -150,15 +159,15 @@ public class TokenSessionStoreInterceptor extends TokenInterceptor {
return INVALID_TOKEN_CODE;
}
/* (non-Javadoc)
* @see org.apache.struts2.interceptor.TokenInterceptor#handleValidToken(com.opensymphony.xwork2.ActionInvocation)
*/
@Override
protected String handleValidToken(ActionInvocation invocation) throws Exception {
// we know the token name and token must be there
String key = TokenHelper.getTokenName();
String token = TokenHelper.getToken(key);
InvocationSessionStore.storeInvocation(key, token, invocation);
String sessionTokenName = TokenHelper.buildTokenSessionAttributeName(key);
InvocationSessionStore.storeInvocation(sessionTokenName, token, invocation);
return invocation.invoke();
}
}
@@ -0,0 +1,51 @@
package org.apache.struts2.util;
import com.opensymphony.xwork2.util.ValueStack;
import org.apache.struts2.views.util.ContextUtil;
/**
* Various static methods used with components
*/
public class ComponentUtils {
/**
* If altSyntax (%{...}) is applied, simply strip the "%{" and "}" off.
*
* @param stack the ValueStack where the context value is searched for.
* @param expr the expression (must be not null)
* @return the stripped expression if altSyntax is enabled. Otherwise
* the parameter expression is returned as is.
*/
public static String stripExpressionIfAltSyntax(ValueStack stack, String expr) {
if (altSyntax(stack)) {
// does the expression start with %{ and end with }? if so, just cut it off!
if (isExpression(expr)) {
return expr.substring(2, expr.length() - 1);
}
}
return expr;
}
/**
* Is the altSyntax enabled? [TRUE]
*
* @param stack the ValueStack where the context value is searched for.
* @return true if altSyntax is activated. False otherwise.
* See <code>struts.properties</code> where the altSyntax flag is defined.
*/
public static boolean altSyntax(ValueStack stack) {
return ContextUtil.isUseAltSyntax(stack.getContext());
}
/**
* Check if object is expression base on altSyntax
*
* @param value to treat as an expression
* @return true if it is an expression
*/
public static boolean isExpression(Object value) {
String expr = value.toString();
return expr.startsWith("%{") && expr.endsWith("}");
}
}
@@ -25,6 +25,7 @@ import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ObjectFactory;
import com.opensymphony.xwork2.inject.Container;
import com.opensymphony.xwork2.util.ClassLoaderUtil;
import com.opensymphony.xwork2.util.TextParseUtil;
import com.opensymphony.xwork2.util.ValueStack;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
@@ -148,6 +149,10 @@ public class StrutsUtil {
return (request == null)? "" : request.getContextPath();
}
public String translateVariables(String expression) {
return TextParseUtil.translateVariables(expression, stack);
}
/**
* the selectedList objects are matched to the list.listValue
* <p/>
@@ -94,7 +94,7 @@ public class TextProviderHelper {
} else {
LOG.warn("Could not locate the message resource '"+key+"' as there is no TextProvider in the ValueStack.");
}
if (msg.equals(defaultMessage)) {
if (defaultMessage.equals(msg)) {
LOG.warn("The default value expression '"+defaultMessage+"' was evaluated and did not match a property. The literal value '"+defaultMessage+"' will be used.");
} else {
LOG.warn("The default value expression '"+defaultMessage+"' evaluated to '"+msg+"'");
@@ -36,10 +36,15 @@ import com.opensymphony.xwork2.util.logging.LoggerFactory;
*/
public class TokenHelper {
/**
/**
* The default namespace for storing token session values
*/
public static final String TOKEN_NAMESPACE = "struts.tokens";
/**
* The default name to map the token value
*/
public static final String DEFAULT_TOKEN_NAME = "struts.token";
public static final String DEFAULT_TOKEN_NAME = "token";
/**
* The name of the field which will hold the token name
@@ -58,31 +63,53 @@ public class TokenHelper {
return setToken(DEFAULT_TOKEN_NAME);
}
/**
* Sets a transaction token into the session using the provided token name.
*
* @param tokenName the name to store into the session with the token as the value
* @return the token string
*/
public static String setToken(String tokenName) {
Map session = ActionContext.getContext().getSession();
String token = generateGUID();
try {
session.put(tokenName, token);
}
catch(IllegalStateException e) {
// WW-1182 explain to user what the problem is
String msg = "Error creating HttpSession due response is commited to client. You can use the CreateSessionInterceptor or create the HttpSession from your action before the result is rendered to the client: " + e.getMessage();
LOG.error(msg, e);
throw new IllegalArgumentException(msg);
}
/**
* Sets a transaction token into the session based on the provided token name.
*
* @param tokenName the token name based on which a generated token value is stored into session; for actual session
* store, this name will be prefixed by a namespace.
*
* @return the token string
*/
public static String setToken( String tokenName ) {
String token = generateGUID();
setSessionToken(tokenName, token);
return token;
}
return token;
}
/**
* Put a given named token into the session map. The token will be stored with a namespace prefix prepended.
*
* @param tokenName the token name based on which given token value is stored into session; for actual session store,
* this name will be prefixed by a namespace.
* @param token the token value to store
*/
public static void setSessionToken( String tokenName, String token ) {
Map<String, Object> session = ActionContext.getContext().getSession();
try {
session.put(buildTokenSessionAttributeName(tokenName), token);
} catch ( IllegalStateException e ) {
// WW-1182 explain to user what the problem is
String msg = "Error creating HttpSession due response is commited to client. You can use the CreateSessionInterceptor or create the HttpSession from your action before the result is rendered to the client: " + e.getMessage();
LOG.error(msg, e);
throw new IllegalArgumentException(msg);
}
}
/**
* Gets a transaction token into the session using the default token name.
/**
* Build a name-spaced token session attribute name based on the given token name.
*
* @param tokenName the token name to prefix
*
* @return the name space prefixed session token name
*/
public static String buildTokenSessionAttributeName( String tokenName ) {
return TOKEN_NAMESPACE + "." + tokenName;
}
/**
* Gets a transaction token from the params in the ServletActionContext using the default token name.
*
* @return token
*/
@@ -175,7 +202,8 @@ public class TokenHelper {
}
Map session = ActionContext.getContext().getSession();
String sessionToken = (String) session.get(tokenName);
String tokenSessionName = buildTokenSessionAttributeName(tokenName);
String sessionToken = (String) session.get(tokenSessionName);
if (!token.equals(sessionToken)) {
if (LOG.isWarnEnabled()) {
@@ -188,7 +216,7 @@ public class TokenHelper {
}
// remove the token so it won't be used again
session.remove(tokenName);
session.remove(tokenSessionName);
return true;
}
@@ -0,0 +1,172 @@
package org.apache.struts2.util.fs;
import com.opensymphony.xwork2.util.fs.DefaultFileManager;
import com.opensymphony.xwork2.util.fs.FileRevision;
import com.opensymphony.xwork2.util.fs.Revision;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
* FileManager implementation used with JBoss AS
*/
public class JBossFileManager extends DefaultFileManager {
private static final Logger LOG = LoggerFactory.getLogger(JBossFileManager.class);
private static final String JBOSS5_VFS = "vfs";
private static final String JBOSS5_VFSZIP = "vfszip";
private static final String JBOSS5_VFSMEMORY = "vfsmemory";
private static final String JBOSS5_VFSFILE = "vfsfile";
private static final String VFS_JBOSS7 = "org.jboss.vfs.VirtualFile";
private static final String VFS_JBOSS5 = "org.jboss.virtual.VirtualFile";
@Override
public boolean support() {
boolean supports = isJBoss7() || isJBoss5();
if (supports && LOG.isInfoEnabled()) {
LOG.info("JBoss server detected, Struts 2 will use [#0] to support file system operations!", JBossFileManager.class.getSimpleName());
}
return supports;
}
private boolean isJBoss5() {
try {
Class.forName(VFS_JBOSS5);
return true;
} catch (ClassNotFoundException e) {
LOG.debug("Cannot load [#0] class, not a JBoss 5!", VFS_JBOSS7);
return false;
}
}
private boolean isJBoss7() {
try {
Class.forName(VFS_JBOSS7);
return true;
} catch (ClassNotFoundException e) {
LOG.debug("Cannot load [#0] class, not a JBoss 7!", VFS_JBOSS7);
return false;
}
}
@Override
public void monitorFile(URL fileUrl) {
if (isReloadingConfigs()) {
if (isJBossUrl(fileUrl)) {
Revision revision = FileRevision.build(normalizeToFileProtocol(fileUrl));
files.put(fileUrl.toString(), revision);
} else {
super.monitorFile(fileUrl);
}
}
}
@Override
public URL normalizeToFileProtocol(URL url) {
if (isJBossUrl(url)) {
try {
return getJBossPhysicalUrl(url);
} catch (IOException e) {
LOG.error(e.getMessage(), e);
return null;
}
} else {
return super.normalizeToFileProtocol(url);
}
}
@Override
public Collection<? extends URL> getAllPhysicalUrls(URL url) throws IOException {
if (isJBossUrl(url)) {
return getAllJBossPhysicalUrls(url);
} else {
return super.getAllPhysicalUrls(url);
}
}
/**
* Check if given URL is pointing to JBoss 5 VFS resource
* @param fileUrl
* @return
*/
protected boolean isJBossUrl(URL fileUrl) {
final String protocol = fileUrl.getProtocol();
return JBOSS5_VFSZIP.equals(protocol) || JBOSS5_VFSMEMORY.equals(protocol) || JBOSS5_VFS.equals(protocol)
|| ("true".equals(System.getProperty("jboss.vfs.forceVfsJar")) && JBOSS5_VFSFILE.equals(protocol));
}
/**
* Try to determine physical file location.
*
* @param url JBoss VFS URL
* @return URL pointing to physical file or original URL
* @throws java.io.IOException If conversion fails
*/
protected URL getJBossPhysicalUrl(URL url) throws IOException {
Object content = url.openConnection().getContent();
try {
String s = content.getClass().toString();
if (s.startsWith("class org.jboss.vfs.VirtualFile")) { // JBoss 7 and probably 6
File physicalFile = readJBossPhysicalFile(content);
return physicalFile.toURI().toURL();
} else if (s.startsWith("class org.jboss.virtual.VirtualFile")) { // JBoss 5
String fileName = url.toExternalForm();
return new URL("file", null, fileName.substring(fileName.indexOf(":") + 1));
}
} catch (Exception e) {
LOG.warn("Error calling getPhysicalFile() on JBoss VirtualFile.", e);
}
return url;
}
private File readJBossPhysicalFile(Object content) throws Exception {
Method method = content.getClass().getDeclaredMethod("getPhysicalFile");
return (File) method.invoke(content);
}
private List<URL> getAllJBossPhysicalUrls(URL url) throws IOException {
List<URL> urls = new ArrayList<URL>();
Object content = url.openConnection().getContent();
try {
if (content.getClass().toString().startsWith("class org.jboss.vfs.VirtualFile")) {
File physicalFile = readJBossPhysicalFile(content);
readFile(urls, physicalFile);
readFile(urls, physicalFile.getParentFile());
} else {
urls.add(url);
}
} catch (Exception e) {
LOG.warn("Error calling getPhysicalFile() on JBoss VirtualFile.", e);
}
return urls;
}
private void readFile(List<URL> urls, File physicalFile) throws MalformedURLException {
if (physicalFile.isDirectory()) {
for (File file : physicalFile.listFiles()) {
if (file.isFile()) {
addIfAbsent(urls, file.toURI().toURL());
} else if (file.isDirectory()) {
readFile(urls, file);
}
}
}
}
private void addIfAbsent(List<URL> urls, URL fileUrl) {
if (!urls.contains(fileUrl)) {
urls.add(fileUrl);
}
}
}
@@ -21,9 +21,11 @@
package org.apache.struts2.views.freemarker;
import com.opensymphony.xwork2.FileManager;
import com.opensymphony.xwork2.FileManagerFactory;
import com.opensymphony.xwork2.inject.Container;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.util.FileManager;
import com.opensymphony.xwork2.util.ClassLoaderUtil;
import com.opensymphony.xwork2.util.ValueStack;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
@@ -176,6 +178,8 @@ public class FreemarkerManager {
protected String templateUpdateDelay;
protected Map<String,TagLibrary> tagLibraries;
private FileManager fileManager;
@Inject(StrutsConstants.STRUTS_I18N_ENCODING)
public void setEncoding(String encoding) {
this.encoding = encoding;
@@ -211,6 +215,11 @@ public class FreemarkerManager {
this.tagLibraries = Collections.unmodifiableMap(map);
}
@Inject
public void setFileManagerFactory(FileManagerFactory fileManagerFactory) {
this.fileManager = fileManagerFactory.getFileManager();
}
public boolean getNoCharsetInContentType() {
return noCharsetInContentType;
}
@@ -427,7 +436,8 @@ public class FreemarkerManager {
InputStream in = null;
try {
in = FileManager.loadFile("freemarker.properties", FreemarkerManager.class);
in = fileManager.loadFile(ClassLoaderUtil.getResource("freemarker.properties", getClass()));
if (in != null) {
Properties p = new Properties();
@@ -25,7 +25,7 @@ import java.io.PrintWriter;
import javax.servlet.jsp.tagext.BodyTagSupport;
import org.apache.struts2.components.Component;
import org.apache.struts2.util.ComponentUtils;
import org.apache.struts2.util.FastByteArrayOutputStream;
import com.opensymphony.xwork2.util.TextParseUtil;
@@ -49,17 +49,17 @@ public class StrutsBodyTagSupport extends BodyTagSupport {
}
protected Object findValue(String expr) {
expr = Component.stripExpressionIfAltSyntax(getStack(), expr);
expr = ComponentUtils.stripExpressionIfAltSyntax(getStack(), expr);
return getStack().findValue(expr);
}
protected Object findValue(String expr, Class toType) {
if (Component.altSyntax(getStack()) && toType == String.class) {
if (ComponentUtils.altSyntax(getStack()) && toType == String.class) {
return TextParseUtil.translateVariables('%', expr, getStack());
//return translateVariables(expr, getStack());
} else {
expr = Component.stripExpressionIfAltSyntax(getStack(), expr);
expr = ComponentUtils.stripExpressionIfAltSyntax(getStack(), expr);
return getStack().findValue(expr, toType);
}
@@ -31,6 +31,9 @@ public abstract class AbstractDoubleListTag extends AbstractRequiredListTag {
protected String doubleList;
protected String doubleListKey;
protected String doubleListValue;
protected String doubleListCssClass;
protected String doubleListCssStyle;
protected String doubleListTitle;
protected String doubleName;
protected String doubleValue;
protected String formName;
@@ -76,6 +79,9 @@ public abstract class AbstractDoubleListTag extends AbstractRequiredListTag {
bean.setDoubleList(doubleList);
bean.setDoubleListKey(doubleListKey);
bean.setDoubleListValue(doubleListValue);
bean.setDoubleListCssClass(doubleListCssClass);
bean.setDoubleListCssStyle(doubleListCssStyle);
bean.setDoubleListTitle(doubleListTitle);
bean.setDoubleName(doubleName);
bean.setDoubleValue(doubleValue);
bean.setFormName(formName);
@@ -127,6 +133,18 @@ public abstract class AbstractDoubleListTag extends AbstractRequiredListTag {
this.doubleListValue = listValue;
}
public void setDoubleListCssClass(String doubleListCssClass) {
this.doubleListCssClass = doubleListCssClass;
}
public void setDoubleListCssStyle(String doubleListCssStyle) {
this.doubleListCssStyle = doubleListCssStyle;
}
public void setDoubleListTitle(String doubleListTitle) {
this.doubleListTitle = doubleListTitle;
}
public void setDoubleName(String aName) {
doubleName = aName;
}
@@ -29,6 +29,9 @@ public abstract class AbstractListTag extends AbstractUITag {
protected String list;
protected String listKey;
protected String listValue;
protected String listCssClass;
protected String listCssStyle;
protected String listTitle;
protected void populateParams() {
super.populateParams();
@@ -37,6 +40,9 @@ public abstract class AbstractListTag extends AbstractUITag {
listUIBean.setList(list);
listUIBean.setListKey(listKey);
listUIBean.setListValue(listValue);
listUIBean.setListCssClass(listCssClass);
listUIBean.setListCssStyle(listCssStyle);
listUIBean.setListTitle(listTitle);
}
public void setList(String list) {
@@ -50,4 +56,16 @@ public abstract class AbstractListTag extends AbstractUITag {
public void setListValue(String listValue) {
this.listValue = listValue;
}
public void setListCssClass(String listCssClass) {
this.listCssClass = listCssClass;
}
public void setListCssStyle(String listCssStyle) {
this.listCssStyle = listCssStyle;
}
public void setListTitle(String listTitle) {
this.listTitle = listTitle;
}
}
@@ -23,6 +23,7 @@ package org.apache.struts2.views.jsp.ui;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.struts2.components.UIBean;
import org.apache.struts2.util.ComponentUtils;
import org.apache.struts2.views.jsp.ComponentTagSupport;
import javax.servlet.jsp.JspException;
@@ -291,10 +292,11 @@ public abstract class AbstractUITag extends ComponentTagSupport implements Dynam
}
public void setDynamicAttribute(String uri, String localName, Object value) throws JspException {
if (value != null && value instanceof String) {
if (ComponentUtils.altSyntax(getStack()) && ComponentUtils.isExpression(value)) {
dynamicAttributes.put(localName, String.valueOf(ObjectUtils.defaultIfNull(findValue(value.toString()), value)));
} else {
dynamicAttributes.put(localName, value);
}
}
}
@@ -21,13 +21,12 @@
package org.apache.struts2.views.jsp.ui;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.opensymphony.xwork2.util.ValueStack;
import org.apache.struts2.components.Component;
import org.apache.struts2.components.TextField;
import com.opensymphony.xwork2.util.ValueStack;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* @see TextField
@@ -39,6 +38,7 @@ public class TextFieldTag extends AbstractUITag {
protected String maxlength;
protected String readonly;
protected String size;
protected String type;
public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
return new TextField(stack, req, res);
@@ -51,6 +51,7 @@ public class TextFieldTag extends AbstractUITag {
textField.setMaxlength(maxlength);
textField.setReadonly(readonly);
textField.setSize(size);
textField.setType(type);
}
/**
@@ -71,4 +72,8 @@ public class TextFieldTag extends AbstractUITag {
public void setSize(String size) {
this.size = size;
}
public void setType(String type) {
this.type = type;
}
}
@@ -38,6 +38,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashMap;
@@ -308,7 +309,7 @@ public class DefaultUrlHelper implements UrlHelper {
} else {
String currentParamValues[] = (String[]) currentParam;
if (currentParamValues != null) {
List<String> paramList = Arrays.asList(currentParamValues);
List<String> paramList = new ArrayList<String>(Arrays.asList(currentParamValues));
paramList.add(translatedParamValue);
queryParams.put(paramName, paramList.toArray(new String[paramList.size()]));
} else {
@@ -207,4 +207,8 @@ struts.ognl.logMissingProperties=false
### Caches parsed OGNL expressions, but can lead to memory leaks
### if the application generates a lot of different expressions
struts.ognl.enableExpressionCache=true
### Indicates if Dispatcher should handle unexpected exceptions by calling sendError()
### or simply rethrow it as a ServletException to allow future processing by other frameworks like Spring Security
struts.handle.exception=true
### END SNIPPET: complete_file
@@ -27,10 +27,14 @@ struts.messages.invalid.file=Could not find a Filename for {0}. Verify that a va
struts.messages.invalid.content.type=Could not find a Content-Type for {0}. Verify that a valid file was submitted.
struts.messages.removing.file=Removing file {0} {1}
struts.messages.error.uploading=Error uploading: {0}
struts.messages.error.file.too.large=File too large: {0} "{1}" "{2}" {3}
struts.messages.error.file.too.large=The file is to large to be uploaded: {0} "{1}" "{2}" {3}
struts.messages.error.content.type.not.allowed=Content-Type not allowed: {0} "{1}" "{2}" {3}
struts.messages.error.file.extension.not.allowed=File extension not allowed: {0} "{1}" "{2}" {3}
# dedicated messages used to handle various problems with file upload - check {@link JakartaMultiPartRequest#parse(HttpServletRequest, String)}
struts.messages.upload.error.SizeLimitExceededException=Request exceeded allowed size limit! Max size allowed is: {0} but request was: {1}!
struts.messages.upload.error.IOException=Error uploading: {0}!
devmode.notification=Developer Notification (set struts.devMode to false to disable this message):\n{0}
struts.exception.missing-package-action.with-context = There is no Action mapped for namespace [{0}] and action name [{1}] associated with context path [{2}].
@@ -30,4 +30,8 @@ struts.messages.error.uploading=Fejl ved upload: {0}
struts.messages.error.file.too.large=Filen er for stor: {0} "{1}" {2}
struts.messages.error.content.type.not.allowed=Content-Type er ikke tilladt: {0} "{1}" {2}
# dedicated messages used to handle various problems with file upload - check {@link JakartaMultiPartRequest#parse(HttpServletRequest, String)}
struts.messages.upload.error.SizeLimitExceededException=Request overskredet tilladte st\u00F8rrelse gr\u00E6nse! Max tilladte st\u00F8rrelse er: {0}, men anmodning var: {1}!
struts.messages.upload.error.IOException=Fejl ved upload: {0}!
devmode.notification=Note til udvikler (ret struts.devMode til 'false' for at deaktivere denne meddelse):\n{0}
@@ -19,16 +19,21 @@
# under the License.
#
struts.messages.invalid.token=Das Formular wurde bereits verarbeitet oder es wurde kein Token angegeben, bitte versuchen Sie es erneut.
struts.internal.invalid.token=Das Formular Token {0} stimmt nicht mit dem Session Token {1} \u00fcberein.
struts.internal.invalid.token=Das Formular Token {0} stimmt nicht mit dem Session Token {1} \u00FCberein.
struts.messages.bypass.request=\u00dcberspringe {0}/{1}
struts.messages.bypass.request=\u00DCberspringe {0}/{1}
struts.messages.current.file=Datei {0} {1} {2} {3}
struts.messages.invalid.file=Es konnte kein Dateiname f\u00fcr {0} ermittelt werden. \u00dcberpr\u00fcfen Sie ob eine g\u00fcltige Datei \u00fcbermittelt wurde.
struts.messages.invalid.content.type=Es konnte kein Content-Type f\u00fcr {0} ermittelt werden. \u00dcberpr\u00fcfen Sie ob eine g\u00fcltige Datei \u00fcbermittelt wurde.
struts.messages.invalid.file=Es konnte kein Dateiname f\u00FCr {0} ermittelt werden. \u00DCberpr\u00FCfen Sie ob eine g\u00FCltige Datei \u00FCbermittelt wurde.
struts.messages.invalid.content.type=Es konnte kein Content-Type f\u00FCr {0} ermittelt werden. \u00DCberpr\u00FCfen Sie ob eine g\u00FCltige Datei \u00FCbermittelt wurde.
struts.messages.removing.file=Entferne Datei {0} {1}
struts.messages.error.uploading=Fehler beim Upload: {0}
struts.messages.error.file.too.large=Datei zu gross: {0} "{1}" "{2}" {3}
struts.messages.error.content.type.not.allowed=Content-Type nicht erlaubt: {0} "{1}" "{2}" {3}
struts.messages.error.file.extension.not.allowed=File extension nicht erlaubt: {0} "{1}" "{2}" {3}
# dedicated messages used to handle various problems with file upload - check {@link JakartaMultiPartRequest#parse(HttpServletRequest, String)}
struts.messages.upload.error.SizeLimitExceededException=Der Request \u00FCbertraf die maximal erlaubte Gr\u00F6\u00DFe und wurde daher abgelehnt. Die maximal zul\u00E4ssige Gr\u00F6\u00DFe ist {0}, die Gr\u00F6\u00DFe der Anfrage betrug aber {1}!
struts.messages.upload.error.IOException=Fehler beim Upload: {0}!
devmode.notification=Entwickler Hinweis (Setzen Sie struts.devMode auf false um diese Nachricht zu deaktivieren):\n{0}
@@ -18,17 +18,21 @@
# specific language governing permissions and limitations
# under the License.
#
struts.messages.invalid.token=Formularz zosta\u0142 ju\u017c przetworzony lub nie za\u0142\u0105czono tokena, spr\u00f3buj ponownie.
struts.messages.invalid.token=Formularz zosta\u0142 ju\u017C przetworzony lub nie za\u0142\u0105czono tokena, spr\u00F3buj ponownie.
struts.internal.invalid.token=Token formularza {0} nie pasuje do tokena sesji {1}.
struts.messages.bypass.request=Omijanie {0}/{1}
struts.messages.current.file=Plik {0} {1} {2} {3}
struts.messages.invalid.file=Nie odnaleziono nazwy pliku dla {0}. Upewnij si\u0119 \u017ce wys\u0142ano w\u0142a\u015bciwy plik.
struts.messages.invalid.content.type=Nie odnaleziono Content-Type dla {0}. Upewnij si\u0119 \u017ce wys\u0142ano w\u0142a\u015bciwy plik.
struts.messages.invalid.file=Nie odnaleziono nazwy pliku dla {0}. Upewnij si\u0119 \u017Ce wys\u0142ano w\u0142a\u015Bciwy plik.
struts.messages.invalid.content.type=Nie odnaleziono Content-Type dla {0}. Upewnij si\u0119 \u017Ce wys\u0142ano w\u0142a\u015Bciwy plik.
struts.messages.removing.file=Usuwanie pliku {0} {1}
struts.messages.error.uploading=B\u0142\u0105d podczas wysy\u0142ania pliku: {0}
struts.messages.error.file.too.large=Plik jest za du\u017cy: {0} "{1}" "{2}" {3}
struts.messages.error.file.too.large=Plik jest za du\u017Cy: {0} "{1}" "{2}" {3}
struts.messages.error.content.type.not.allowed=Niedozwolony Content-Type: {0} "{1}" "{2}" {3}
struts.messages.error.file.extension.not.allowed=Niedozwolony File extension: {0} "{1}" "{2}" {3}
devmode.notification=Powiadmienie Developera (ustaw struts.devMode na false by wy\u0142\u0105czy\u0107 t\u0119 wiadomo\u015b\u0107):\n{0}
# dedicated messages used to handle various problems with file upload - check {@link JakartaMultiPartRequest#parse(HttpServletRequest, String)}
struts.messages.upload.error.SizeLimitExceededException=Zapytanie przekroczy\u0142o dozwolony limit rozmiaru! Maksymalny rozmiar to: {0} ale \u017C\u0105danie mia\u0142o: {1}!
struts.messages.upload.error.IOException=B\u0142\u0105d podczas wysy\u0142ania pliku: {0}!
devmode.notification=Powiadmienie Developera (ustaw struts.devMode na false by wy\u0142\u0105czy\u0107 t\u0119 wiadomo\u015B\u0107):\n{0}
@@ -30,4 +30,8 @@ struts.messages.error.uploading=Erro de uploading: {0}
struts.messages.error.file.too.large=Arquivo muito grande: {0} "{1}" {2}
struts.messages.error.content.type.not.allowed=Content-Type n\u00E3o permitido: {0} "{1}" {2}
# dedicated messages used to handle various problems with file upload - check {@link JakartaMultiPartRequest#parse(HttpServletRequest, String)}
struts.messages.upload.error.SizeLimitExceededException=Pedido excedeu o limite de tamanho permitido! Tamanho m\u00E1ximo permitido \u00E9: {0} mas foi pedido: {1}!
struts.messages.upload.error.IOException=Erro de uploading: {0}!
devmode.notification=Notifica\u00E7\u00E3o para o Desenvolvedor (altere o param\u00EAtro struts.devMode para false para desabilitar esta mensagem):\n{0}
+11 -7
View File
@@ -29,6 +29,11 @@
<bean class="com.opensymphony.xwork2.ObjectFactory" name="xwork" />
<bean type="com.opensymphony.xwork2.ObjectFactory" name="struts" class="org.apache.struts2.impl.StrutsObjectFactory" />
<bean type="com.opensymphony.xwork2.FileManager" class="com.opensymphony.xwork2.util.fs.DefaultFileManager" name="system"/>
<bean type="com.opensymphony.xwork2.FileManagerFactory" class="com.opensymphony.xwork2.util.fs.DefaultFileManagerFactory" name="xwork"/>
<bean type="com.opensymphony.xwork2.FileManagerFactory" class="com.opensymphony.xwork2.util.fs.DefaultFileManagerFactory" name="struts"/>
<bean type="com.opensymphony.xwork2.ActionProxyFactory" name="xwork" class="com.opensymphony.xwork2.DefaultActionProxyFactory"/>
<bean type="com.opensymphony.xwork2.ActionProxyFactory" name="struts" class="org.apache.struts2.impl.StrutsActionProxyFactory"/>
@@ -60,17 +65,16 @@
<bean type="org.apache.struts2.components.template.TemplateEngine" name="jsp" class="org.apache.struts2.components.template.JspTemplateEngine" />
<bean type="com.opensymphony.xwork2.conversion.impl.XWorkConverter" name="struts" class="com.opensymphony.xwork2.conversion.impl.XWorkConverter" />
<bean type="com.opensymphony.xwork2.conversion.impl.XWorkConverter" name="xwork1" class="com.opensymphony.xwork2.conversion.impl.XWorkConverter" />
<bean class="com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter" />
<bean type="com.opensymphony.xwork2.conversion.TypeConverter" name="collection" class="com.opensymphony.xwork2.conversion.impl.CollectionConverter" scope="singleton"/>
<bean type="com.opensymphony.xwork2.conversion.TypeConverter" name="array" class="com.opensymphony.xwork2.conversion.impl.ArrayConverter" scope="singleton"/>
<bean type="com.opensymphony.xwork2.conversion.TypeConverter" name="date" class="com.opensymphony.xwork2.conversion.impl.DateConverter" scope="singleton"/>
<bean type="com.opensymphony.xwork2.conversion.TypeConverter" name="number" class="com.opensymphony.xwork2.conversion.impl.NumberConverter" scope="singleton"/>
<bean type="com.opensymphony.xwork2.conversion.TypeConverter" name="string" class="com.opensymphony.xwork2.conversion.impl.StringConverter" scope="singleton"/>
<bean type="com.opensymphony.xwork2.conversion.impl.CollectionConverter" name="struts" class="com.opensymphony.xwork2.conversion.impl.CollectionConverter" scope="singleton"/>
<bean type="com.opensymphony.xwork2.conversion.impl.ArrayConverter" name="struts" class="com.opensymphony.xwork2.conversion.impl.ArrayConverter" scope="singleton"/>
<bean type="com.opensymphony.xwork2.conversion.impl.DateConverter" name="struts" class="com.opensymphony.xwork2.conversion.impl.DateConverter" scope="singleton"/>
<bean type="com.opensymphony.xwork2.conversion.impl.NumberConverter" name="struts" class="com.opensymphony.xwork2.conversion.impl.NumberConverter" scope="singleton"/>
<bean type="com.opensymphony.xwork2.conversion.impl.StringConverter" name="struts" class="com.opensymphony.xwork2.conversion.impl.StringConverter" scope="singleton"/>
<bean type="com.opensymphony.xwork2.TextProvider" name="xwork1" class="com.opensymphony.xwork2.TextProviderSupport" scope="default" />
<bean type="com.opensymphony.xwork2.TextProvider" name="struts" class="com.opensymphony.xwork2.TextProviderSupport" scope="default" />
<bean type="com.opensymphony.xwork2.LocaleProvider" name="struts" class="com.opensymphony.xwork2.DefaultLocaleProvider" scope="singleton" />
<bean type="org.apache.struts2.components.UrlRenderer" name="struts" class="org.apache.struts2.components.ServletUrlRenderer"/>
<bean type="org.apache.struts2.views.util.UrlHelper" name="struts" class="org.apache.struts2.views.util.DefaultUrlHelper"/>
@@ -34,6 +34,27 @@
<#else>
<#assign itemValue = stack.findString('top')/>
</#if>
<#if parameters.listCssClass??>
<#if stack.findString(parameters.listCssClass)??>
<#assign itemCssClass= stack.findString(parameters.listCssClass)/>
<#else>
<#assign itemCssClass = ''/>
</#if>
</#if>
<#if parameters.listCssStyle??>
<#if stack.findString(parameters.listCssStyle)??>
<#assign itemCssStyle= stack.findString(parameters.listCssStyle)/>
<#else>
<#assign itemCssStyle = ''/>
</#if>
</#if>
<#if parameters.listTitle??>
<#if stack.findString(parameters.listTitle)??>
<#assign itemTitle= stack.findString(parameters.listTitle)/>
<#else>
<#assign itemTitle = ''/>
</#if>
</#if>
<#assign itemKeyStr=itemKey.toString() />
<input type="checkbox" name="${parameters.name?html}" value="${itemKeyStr?html}"
id="${parameters.name?html}-${itemCount}"<#rt/>
@@ -43,8 +64,26 @@
<#if parameters.disabled?default(false)>
disabled="disabled"<#rt/>
</#if>
<#if parameters.title??>
title="${parameters.title?html}"<#rt/>
<#if itemCssClass?if_exists != "">
class="${itemCssClass?html}"<#rt/>
<#else>
<#if parameters.cssClass??>
class="${parameters.cssClass?html}"<#rt/>
</#if>
</#if>
<#if itemCssStyle?if_exists != "">
style="${itemCssStyle?html}"<#rt/>
<#else>
<#if parameters.cssStyle??>
style="${parameters.cssStyle?html}"<#rt/>
</#if>
</#if>
<#if itemTitle?if_exists != "">
title="${itemTitle?html}"<#rt/>
<#else>
<#if parameters.title??>
title="${parameters.title?html}"<#rt/>
</#if>
</#if>
<#include "/${parameters.templateDir}/simple/css.ftl" />
<#include "/${parameters.templateDir}/simple/scripting-events.ftl" />
@@ -61,10 +61,40 @@
<#else>
<#assign tmpListValue = stack.findString('top') />
</#if>
<#if parameters.listCssClass??>
<#if stack.findString(parameters.listCssClass)??>
<#assign itemCssClass= stack.findString(parameters.listCssClass)/>
<#else>
<#assign itemCssClass = ''/>
</#if>
</#if>
<#if parameters.listCssStyle??>
<#if stack.findString(parameters.listCssStyle)??>
<#assign itemCssStyle= stack.findString(parameters.listCssStyle)/>
<#else>
<#assign itemCssStyle = ''/>
</#if>
</#if>
<#if parameters.listTitle??>
<#if stack.findString(parameters.listTitle)??>
<#assign itemTitle= stack.findString(parameters.listTitle)/>
<#else>
<#assign itemTitle = ''/>
</#if>
</#if>
<option value="${tmpListKey?html}"<#rt/>
<#if (parameters.nameValue == tmpListKey)>
selected="selected"<#rt/>
</#if>
<#if itemCssClass?if_exists != "">
class="${itemCssClass?html}"<#rt/>
</#if>
<#if itemCssStyle?if_exists != "">
style="${itemCssStyle?html}"<#rt/>
</#if>
<#if itemTitle?if_exists != "">
title="${itemTitle?html}"<#rt/>
</#if>
><#t/>
${tmpListValue?html}<#t/>
</option><#lt/>
@@ -110,7 +110,37 @@
<#else>
<#assign doubleItemValue = stack.findString('top')/>
</#if>
<#if parameters.doubleListCssClass??>
<#if stack.findString(parameters.doubleListCssClass)??>
<#assign itemDoubleCssClass= stack.findString(parameters.doubleListCssClass)/>
<#else>
<#assign itemDoubleCssClass = ''/>
</#if>
</#if>
<#if parameters.doubleListCssStyle??>
<#if stack.findString(parameters.doubleListCssStyle)??>
<#assign itemDoubleCssStyle= stack.findString(parameters.doubleListCssStyle)/>
<#else>
<#assign itemDoubleCssStyle = ''/>
</#if>
</#if>
<#if parameters.doubleListTitle??>
<#if stack.findString(parameters.doubleListTitle)??>
<#assign itemDoubleTitle= stack.findString(parameters.doubleListTitle)/>
<#else>
<#assign itemDoubleTitle = ''/>
</#if>
</#if>
${parameters.id}Group[${itemCount}][${doubleItemCount}] = new Option("${doubleItemValue?js_string}", "${doubleItemKeyStr?js_string}");
<#if itemDoubleCssClass?if_exists != "">
${parameters.id}Group[${itemCount}][${doubleItemCount}].setAttribute("class","${itemDoubleCssClass?html}");
</#if>
<#if itemDoubleCssStyle?if_exists != "">
${parameters.id}Group[${itemCount}][${doubleItemCount}].setAttribute("style","${itemDoubleCssStyle?html}");
</#if>
<#if itemDoubleTitle?if_exists != "">
${parameters.id}Group[${itemCount}][${doubleItemCount}].setAttribute("title","${itemDoubleTitle?html}");
</#if>
<#assign doubleItemCount = doubleItemCount + 1/>
</@s.iterator>
@@ -23,6 +23,12 @@
<#if (parameters.dynamicAttributes?? && parameters.dynamicAttributes?size > 0)><#rt/>
<#assign aKeys = parameters.dynamicAttributes.keySet()><#rt/>
<#list aKeys as aKey><#rt/>
${aKey}="${parameters.dynamicAttributes[aKey]?html}"<#rt/>
<#assign keyValue = parameters.dynamicAttributes[aKey]/>
<#if keyValue?is_string>
<#assign value = struts.translateVariables(keyValue)!keyValue/>
<#else>
<#assign value = keyValue?string/>
</#if>
${aKey}="${value?html}"<#rt/>
</#list><#rt/>
</#if><#rt/>
@@ -214,11 +214,14 @@
onmousedown="${parameters.doubleOnmousedown?html}"
</#if><#t/>
<#if parameters.doubleOnmouseup??><#t/>
onmouseup="${parameters.doubleMnmouseup?html}"
onmouseup="${parameters.doubleOnmouseup?html}"
</#if><#t/>
<#if parameters.doubleOnmousemove??><#t/>
onmousemove="${parameters.doubleOnmousemove?html}"
</#if><#t/>
<#if parameters.doubleOnmouseover??><#t/>
onmouseover="${parameters.doubleOnmouseover?html}"
</#if><#t/>
<#if parameters.doubleOnmouseout??><#t/>
onmouseout="${parameters.doubleOnmouseout?html}"
</#if><#t/>
@@ -32,6 +32,27 @@
<#else>
<#assign itemValue = stack.findString('top')/>
</#if>
<#if parameters.listCssClass??>
<#if stack.findString(parameters.listCssClass)??>
<#assign itemCssClass= stack.findString(parameters.listCssClass)/>
<#else>
<#assign itemCssClass = ''/>
</#if>
</#if>
<#if parameters.listCssStyle??>
<#if stack.findString(parameters.listCssStyle)??>
<#assign itemCssStyle= stack.findString(parameters.listCssStyle)/>
<#else>
<#assign itemCssStyle = ''/>
</#if>
</#if>
<#if parameters.listTitle??>
<#if stack.findString(parameters.listTitle)??>
<#assign itemTitle= stack.findString(parameters.listTitle)/>
<#else>
<#assign itemTitle = ''/>
</#if>
</#if>
<input type="radio"<#rt/>
<#if parameters.name??>
name="${parameters.name?html}"<#rt/>
@@ -49,20 +70,33 @@
<#if parameters.tabindex??>
tabindex="${parameters.tabindex?html}"<#rt/>
</#if>
<#if parameters.cssClass??>
<#if itemCssClass?if_exists != "">
class="${itemCssClass?html}"<#rt/>
<#else>
<#if parameters.cssClass??>
class="${parameters.cssClass?html}"<#rt/>
</#if>
</#if>
<#if parameters.cssStyle??>
<#if itemCssStyle?if_exists != "">
style="${itemCssStyle?html}"<#rt/>
<#else>
<#if parameters.cssStyle??>
style="${parameters.cssStyle?html}"<#rt/>
</#if>
</#if>
<#if itemTitle?if_exists != "">
title="${itemTitle?html}"<#rt/>
<#else>
<#if parameters.title??>
title="${parameters.title?html}"<#rt/>
</#if>
</#if>
<#include "/${parameters.templateDir}/simple/css.ftl" />
<#if parameters.title??>
title="${parameters.title?html}"<#rt/>
</#if>
<#include "/${parameters.templateDir}/simple/scripting-events.ftl" />
<#include "/${parameters.templateDir}/simple/common-attributes.ftl" />
<#include "/${parameters.templateDir}/simple/dynamic-attributes.ftl" />
/><#rt/>
<label for="${parameters.id?html}${itemKeyStr?html}"><#rt/>
<label for="${parameters.id?html}${itemKeyStr?html}"<#include "/${parameters.templateDir}/simple/css.ftl"/>><#rt/>
${itemValue}<#t/>
</label>
</@s.iterator>
@@ -78,10 +78,40 @@
<#else>
<#assign itemValue = stack.findString('top')/>
</#if>
<#if parameters.listCssClass??>
<#if stack.findString(parameters.listCssClass)??>
<#assign itemCssClass= stack.findString(parameters.listCssClass)/>
<#else>
<#assign itemCssClass = ''/>
</#if>
</#if>
<#if parameters.listCssStyle??>
<#if stack.findString(parameters.listCssStyle)??>
<#assign itemCssStyle= stack.findString(parameters.listCssStyle)/>
<#else>
<#assign itemCssStyle = ''/>
</#if>
</#if>
<#if parameters.listTitle??>
<#if stack.findString(parameters.listTitle)??>
<#assign itemTitle= stack.findString(parameters.listTitle)/>
<#else>
<#assign itemTitle = ''/>
</#if>
</#if>
<option value="${itemKeyStr?html}"<#rt/>
<#if tag.contains(parameters.nameValue, itemKey) == true>
selected="selected"<#rt/>
</#if>
<#if itemCssClass?if_exists != "">
class="${itemCssClass?html}"<#rt/>
</#if>
<#if itemCssStyle?if_exists != "">
style="${itemCssStyle?html}"<#rt/>
</#if>
<#if itemTitle?if_exists != "">
title="${itemTitle?html}"<#rt/>
</#if>
>${itemValue?html}</option><#lt/>
</@s.iterator>
@@ -20,7 +20,8 @@
* under the License.
*/
-->
<input type="text"<#rt/>
<input<#rt/>
type="${parameters.type?default("text")?html}"<#rt/>
name="${parameters.name?default("")?html}"<#rt/>
<#if parameters.get("size")??>
size="${parameters.get("size")?html}"<#rt/>
@@ -137,6 +137,22 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top">Iterable source to populate from. If the list is a Map (key, value), the Map key will become the option 'value' parameter and the Map value will become the option body.</td>
</tr>
<tr>
<td align="left" valign="top">listCssClass</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get css class from</td>
</tr>
<tr>
<td align="left" valign="top">listCssStyle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get css style from</td>
</tr>
<tr>
<td align="left" valign="top">listKey</td>
<td align="left" valign="top">false</td>
@@ -145,6 +161,14 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top"> Property of list objects to get field value from</td>
</tr>
<tr>
<td align="left" valign="top">listTitle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get title from</td>
</tr>
<tr>
<td align="left" valign="top">listValue</td>
<td align="left" valign="top">false</td>
@@ -425,6 +425,14 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top">Icon path used for image that will have the tooltip</td>
</tr>
<tr>
<td align="left" valign="top">type</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">text</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Specifies the html5 type element to display. e.g. text, email, url</td>
</tr>
<tr>
<td align="left" valign="top">value</td>
<td align="left" valign="top">false</td>
@@ -153,6 +153,22 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top">The second iterable source to populate from.</td>
</tr>
<tr>
<td align="left" valign="top">doubleListCssClass</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of second list objects to get css class from</td>
</tr>
<tr>
<td align="left" valign="top">doubleListCssStyle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of second list objects to get css style from</td>
</tr>
<tr>
<td align="left" valign="top">doubleListKey</td>
<td align="left" valign="top">false</td>
@@ -161,6 +177,14 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top">The key expression to use for second list</td>
</tr>
<tr>
<td align="left" valign="top">doubleListTitle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of second list objects to get title from</td>
</tr>
<tr>
<td align="left" valign="top">doubleListValue</td>
<td align="left" valign="top">false</td>
@@ -401,6 +425,22 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top">Iterable source to populate from. If the list is a Map (key, value), the Map key will become the option 'value' parameter and the Map value will become the option body.</td>
</tr>
<tr>
<td align="left" valign="top">listCssClass</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get css class from</td>
</tr>
<tr>
<td align="left" valign="top">listCssStyle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get css style from</td>
</tr>
<tr>
<td align="left" valign="top">listKey</td>
<td align="left" valign="top">false</td>
@@ -409,6 +449,14 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top"> Property of list objects to get field value from</td>
</tr>
<tr>
<td align="left" valign="top">listTitle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get title from</td>
</tr>
<tr>
<td align="left" valign="top">listValue</td>
<td align="left" valign="top">false</td>
+1 -1
View File
@@ -20,7 +20,7 @@ Please do not edit it directly.
<!-- START SNIPPET: tagattributes -->
<table width="100%">
<tr>
<td colspan="6"><h4>Dynamic Attributes Allowed:</h4> false</td>
<td colspan="6"><h4>Dynamic Attributes Allowed:</h4> true</td>
</tr>
<tr>
<td colspan="6">&nbsp;</td>
@@ -209,6 +209,22 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top">Iterable source to populate from. If the list is a Map (key, value), the Map key will become the option 'value' parameter and the Map value will become the option body.</td>
</tr>
<tr>
<td align="left" valign="top">listCssClass</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get css class from</td>
</tr>
<tr>
<td align="left" valign="top">listCssStyle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get css style from</td>
</tr>
<tr>
<td align="left" valign="top">listKey</td>
<td align="left" valign="top">false</td>
@@ -217,6 +233,14 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top"> Property of list objects to get field value from</td>
</tr>
<tr>
<td align="left" valign="top">listTitle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get title from</td>
</tr>
<tr>
<td align="left" valign="top">listValue</td>
<td align="left" valign="top">false</td>
@@ -289,6 +289,22 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top">The second iterable source to populate from.</td>
</tr>
<tr>
<td align="left" valign="top">doubleListCssClass</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of second list objects to get css class from</td>
</tr>
<tr>
<td align="left" valign="top">doubleListCssStyle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of second list objects to get css style from</td>
</tr>
<tr>
<td align="left" valign="top">doubleListKey</td>
<td align="left" valign="top">false</td>
@@ -297,6 +313,14 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top">The key expression to use for second list</td>
</tr>
<tr>
<td align="left" valign="top">doubleListTitle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of second list objects to get title from</td>
</tr>
<tr>
<td align="left" valign="top">doubleListValue</td>
<td align="left" valign="top">false</td>
@@ -561,6 +585,22 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top">Iterable source to populate from. If the list is a Map (key, value), the Map key will become the option 'value' parameter and the Map value will become the option body.</td>
</tr>
<tr>
<td align="left" valign="top">listCssClass</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get css class from</td>
</tr>
<tr>
<td align="left" valign="top">listCssStyle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get css style from</td>
</tr>
<tr>
<td align="left" valign="top">listKey</td>
<td align="left" valign="top">false</td>
@@ -569,6 +609,14 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top"> Property of list objects to get field value from</td>
</tr>
<tr>
<td align="left" valign="top">listTitle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get title from</td>
</tr>
<tr>
<td align="left" valign="top">listValue</td>
<td align="left" valign="top">false</td>
@@ -385,6 +385,14 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top">Icon path used for image that will have the tooltip</td>
</tr>
<tr>
<td align="left" valign="top">type</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">text</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Specifies the html5 type element to display. e.g. text, email, url</td>
</tr>
<tr>
<td align="left" valign="top">value</td>
<td align="left" valign="top">false</td>
+25 -1
View File
@@ -20,7 +20,7 @@ Please do not edit it directly.
<!-- START SNIPPET: tagattributes -->
<table width="100%">
<tr>
<td colspan="6"><h4>Dynamic Attributes Allowed:</h4> false</td>
<td colspan="6"><h4>Dynamic Attributes Allowed:</h4> true</td>
</tr>
<tr>
<td colspan="6">&nbsp;</td>
@@ -137,6 +137,22 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top">Iterable source to populate from. If the list is a Map (key, value), the Map key will become the option 'value' parameter and the Map value will become the option body.</td>
</tr>
<tr>
<td align="left" valign="top">listCssClass</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get css class from</td>
</tr>
<tr>
<td align="left" valign="top">listCssStyle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get css style from</td>
</tr>
<tr>
<td align="left" valign="top">listKey</td>
<td align="left" valign="top">false</td>
@@ -145,6 +161,14 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top"> Property of list objects to get field value from</td>
</tr>
<tr>
<td align="left" valign="top">listTitle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get title from</td>
</tr>
<tr>
<td align="left" valign="top">listValue</td>
<td align="left" valign="top">false</td>
+24
View File
@@ -161,6 +161,22 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top">Iterable source to populate from. If the list is a Map (key, value), the Map key will become the option 'value' parameter and the Map value will become the option body.</td>
</tr>
<tr>
<td align="left" valign="top">listCssClass</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get css class from</td>
</tr>
<tr>
<td align="left" valign="top">listCssStyle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get css style from</td>
</tr>
<tr>
<td align="left" valign="top">listKey</td>
<td align="left" valign="top">false</td>
@@ -169,6 +185,14 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top"> Property of list objects to get field value from</td>
</tr>
<tr>
<td align="left" valign="top">listTitle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get title from</td>
</tr>
<tr>
<td align="left" valign="top">listValue</td>
<td align="left" valign="top">false</td>
@@ -377,6 +377,14 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top">Icon path used for image that will have the tooltip</td>
</tr>
<tr>
<td align="left" valign="top">type</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">text</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Specifies the html5 type element to display. e.g. text, email, url</td>
</tr>
<tr>
<td align="left" valign="top">value</td>
<td align="left" valign="top">false</td>
@@ -185,6 +185,22 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top">Iterable source to populate from. If the list is a Map (key, value), the Map key will become the option 'value' parameter and the Map value will become the option body.</td>
</tr>
<tr>
<td align="left" valign="top">listCssClass</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get css class from</td>
</tr>
<tr>
<td align="left" valign="top">listCssStyle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get css style from</td>
</tr>
<tr>
<td align="left" valign="top">listKey</td>
<td align="left" valign="top">false</td>
@@ -193,6 +209,14 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top"> Property of list objects to get field value from</td>
</tr>
<tr>
<td align="left" valign="top">listTitle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get title from</td>
</tr>
<tr>
<td align="left" valign="top">listValue</td>
<td align="left" valign="top">false</td>
@@ -21,28 +21,9 @@
package org.apache.struts2.dispatcher;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import javax.servlet.FilterConfig;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.StrutsConstants;
import org.apache.struts2.StrutsTestCase;
import org.apache.struts2.dispatcher.FilterDispatcherTest.InnerActionMapper;
import org.apache.struts2.dispatcher.FilterDispatcherTest.InnerDestroyableObjectFactory;
import org.apache.struts2.dispatcher.FilterDispatcherTest.InnerDispatcher;
import org.springframework.mock.web.MockFilterConfig;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.MockServletContext;
import com.mockobjects.dynamic.C;
import com.mockobjects.dynamic.Mock;
import com.mockobjects.servlet.MockFilterChain;
import com.opensymphony.xwork2.FileManagerFactory;
import com.opensymphony.xwork2.ObjectFactory;
import com.opensymphony.xwork2.config.Configuration;
import com.opensymphony.xwork2.config.ConfigurationManager;
@@ -50,11 +31,21 @@ import com.opensymphony.xwork2.config.entities.InterceptorMapping;
import com.opensymphony.xwork2.config.entities.InterceptorStackConfig;
import com.opensymphony.xwork2.config.entities.PackageConfig;
import com.opensymphony.xwork2.inject.Container;
import com.opensymphony.xwork2.inject.ContainerBuilder;
import com.opensymphony.xwork2.inject.Context;
import com.opensymphony.xwork2.inject.Factory;
import com.opensymphony.xwork2.interceptor.Interceptor;
import com.opensymphony.xwork2.util.LocalizedTextUtil;
import com.opensymphony.xwork2.util.fs.DefaultFileManagerFactory;
import org.apache.struts2.StrutsConstants;
import org.apache.struts2.StrutsTestCase;
import org.apache.struts2.dispatcher.FilterDispatcherTest.InnerDestroyableObjectFactory;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.MockServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
/**
* Test case for Dispatcher.
@@ -81,7 +72,7 @@ public class DispatcherTest extends StrutsTestCase {
HttpServletRequest req = new MockHttpServletRequest();
HttpServletResponse res = new MockHttpServletResponse();
Dispatcher du = initDispatcher(new HashMap() {{
Dispatcher du = initDispatcher(new HashMap<String, String>() {{
put(StrutsConstants.STRUTS_I18N_ENCODING, "utf-8");
}});
du.prepare(req, res);
@@ -89,12 +80,54 @@ public class DispatcherTest extends StrutsTestCase {
assertEquals(req.getCharacterEncoding(), "utf-8");
}
public void testEncodingForXMLHttpRequest() throws Exception {
// given
MockHttpServletRequest req = new MockHttpServletRequest();
req.addHeader("X-Requested-With", "XMLHttpRequest");
req.setCharacterEncoding("UTF-8");
HttpServletResponse res = new MockHttpServletResponse();
Dispatcher du = initDispatcher(new HashMap<String, String>() {{
put(StrutsConstants.STRUTS_I18N_ENCODING, "latin-2");
}});
// when
du.prepare(req, res);
// then
assertEquals(req.getCharacterEncoding(), "UTF-8");
}
public void testSetEncodingIfDiffer() throws Exception {
// given
Mock mock = new Mock(HttpServletRequest.class);
mock.expectAndReturn("getCharacterEncoding", "utf-8");
mock.expectAndReturn("getHeader", "X-Requested-With", "");
mock.expectAndReturn("getLocale", Locale.getDefault());
mock.expectAndReturn("getCharacterEncoding", "utf-8");
HttpServletRequest req = (HttpServletRequest) mock.proxy();
HttpServletResponse res = new MockHttpServletResponse();
Dispatcher du = initDispatcher(new HashMap<String, String>() {{
put(StrutsConstants.STRUTS_I18N_ENCODING, "utf-8");
}});
// when
du.prepare(req, res);
// then
assertEquals(req.getCharacterEncoding(), "utf-8");
mock.verify();
}
public void testPrepareSetEncodingPropertyWithMultipartRequest() throws Exception {
MockHttpServletRequest req = new MockHttpServletRequest();
MockHttpServletResponse res = new MockHttpServletResponse();
req.setContentType("multipart/form-data");
Dispatcher du = initDispatcher(new HashMap() {{
Dispatcher du = initDispatcher(new HashMap<String, String>() {{
put(StrutsConstants.STRUTS_I18N_ENCODING, "utf-8");
}});
du.prepare(req, res);
@@ -130,7 +163,7 @@ public class DispatcherTest extends StrutsTestCase {
public void testConfigurationManager() {
Dispatcher du = null;
Dispatcher du;
InternalConfigurationManager configurationManager = new InternalConfigurationManager();
try {
du = new Dispatcher(new MockServletContext(), new HashMap<String, String>());
@@ -148,7 +181,7 @@ public class DispatcherTest extends StrutsTestCase {
}
finally {
du.setInstance(null);
Dispatcher.setInstance(null);
}
}
@@ -163,6 +196,12 @@ public class DispatcherTest extends StrutsTestCase {
Mock mockContainer = new Mock(Container.class);
mockConfiguration.expectAndReturn("getContainer", mockContainer.proxy());
mockContainer.expectAndReturn("getInstance", C.args(C.eq(ObjectFactory.class)), destroyedObjectFactory);
mockConfiguration.expectAndReturn("getContainer", mockContainer.proxy());
mockConfiguration.expectAndReturn("getContainer", mockContainer.proxy());
FileManagerFactory fileManagerFactory = new DefaultFileManagerFactory();
container.inject(fileManagerFactory);
mockContainer.expectAndReturn("getInstance", C.args(C.eq(FileManagerFactory.class)), fileManagerFactory);
mockContainer.expectAndReturn("getInstance", C.args(C.eq(FileManagerFactory.class)), fileManagerFactory);
mockConfiguration.expect("destroy");
mockConfiguration.matchAndReturn("getPackageConfigs", new HashMap<String, PackageConfig>());
@@ -190,7 +229,10 @@ public class DispatcherTest extends StrutsTestCase {
Mock mockContainer = new Mock(Container.class);
mockContainer.matchAndReturn("getInstance", C.args(C.eq(ObjectFactory.class)), new ObjectFactory());
DefaultFileManagerFactory factory = new DefaultFileManagerFactory();
container.inject(factory);
mockContainer.matchAndReturn("getInstance", C.args(C.eq(FileManagerFactory.class)), factory);
Mock mockConfiguration = new Mock(Configuration.class);
mockConfiguration.matchAndReturn("getPackageConfigs", packageConfigs);
mockConfiguration.matchAndReturn("getContainer", mockContainer.proxy());
@@ -21,17 +21,10 @@
package org.apache.struts2.dispatcher;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.FilterConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.StrutsConstants;
import com.mockobjects.servlet.MockFilterChain;
import com.opensymphony.xwork2.ObjectFactory;
import com.opensymphony.xwork2.config.ConfigurationManager;
import com.opensymphony.xwork2.config.impl.DefaultConfiguration;
import org.apache.struts2.StrutsTestCase;
import org.apache.struts2.dispatcher.mapper.ActionMapper;
import org.apache.struts2.dispatcher.mapper.ActionMapping;
@@ -41,14 +34,13 @@ import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.MockServletContext;
import com.mockobjects.servlet.MockFilterChain;
import com.opensymphony.xwork2.ObjectFactory;
import com.opensymphony.xwork2.config.ConfigurationManager;
import com.opensymphony.xwork2.config.impl.DefaultConfiguration;
import com.opensymphony.xwork2.inject.Container;
import com.opensymphony.xwork2.inject.ContainerBuilder;
import com.opensymphony.xwork2.inject.Context;
import com.opensymphony.xwork2.inject.Factory;
import javax.servlet.FilterConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
/**
* FilterDispatcher TestCase.
@@ -21,23 +21,19 @@
package org.apache.struts2.dispatcher;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import junit.framework.TestCase;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.mock.MockActionInvocation;
import com.opensymphony.xwork2.util.ClassLoaderUtil;
import com.opensymphony.xwork2.util.ValueStack;
import org.apache.struts2.StrutsStatics;
import org.apache.struts2.StrutsTestCase;
import org.apache.struts2.views.jsp.AbstractUITagTest;
import org.apache.struts2.views.jsp.StrutsMockHttpServletResponse;
import org.apache.struts2.views.jsp.StrutsMockServletContext;
import com.opensymphony.xwork2.util.ClassLoaderUtil;
import com.opensymphony.xwork2.util.ValueStackFactory;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.mock.MockActionInvocation;
import com.opensymphony.xwork2.util.ValueStack;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
/**
* Test case for PlainTextResult.
@@ -80,6 +76,29 @@ public class PlainTextResultTest extends StrutsTestCase {
}
}
public void testPlainTextWithoutSlash() throws Exception {
PlainTextResult result = new PlainTextResult();
result.setLocation("someJspFile.jsp");
response.setExpectedContentType("text/plain");
response.setExpectedHeader("Content-Disposition", "inline");
InputStream jspResourceInputStream =
ClassLoaderUtil.getResourceAsStream("org/apache/struts2/dispatcher/someJspFile.jsp", PlainTextResultTest.class);
try {
servletContext.setResourceAsStream(jspResourceInputStream);
result.execute(invocation);
String r = AbstractUITagTest.normalize(stringWriter.getBuffer().toString(), true);
String e = AbstractUITagTest.normalize(readAsString("org/apache/struts2/dispatcher/someJspFile.jsp"), true);
assertEquals(r, e);
}
finally {
jspResourceInputStream.close();
}
}
public void testPlainTextWithEncoding() throws Exception {
PlainTextResult result = new PlainTextResult();
result.setLocation("/someJspFile.jsp");

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