Compare commits

...

222 Commits

Author SHA1 Message Date
Lukasz Lenart bef7211c41 [maven-release-plugin] copy for tag STRUTS_2_3_9
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_9@1442036 13f79535-47bb-0310-9956-ffa450edef68
2013-02-04 07:11:36 +00:00
Lukasz Lenart 77d51c4222 [maven-release-plugin] prepare release STRUTS_2_3_9
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1442035 13f79535-47bb-0310-9956-ffa450edef68
2013-02-04 07:11:30 +00:00
Lukasz Lenart 2e19fc6670 WW-3977 changes version of archetypes
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1442033 13f79535-47bb-0310-9956-ffa450edef68
2013-02-04 06:56:26 +00:00
Lukasz Lenart 98ec0ea1bb WW-3977 changes site target
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1442032 13f79535-47bb-0310-9956-ffa450edef68
2013-02-04 06:53:48 +00:00
Lukasz Lenart 8a8c193fde Corrects site endpoint
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1441896 13f79535-47bb-0310-9956-ffa450edef68
2013-02-03 11:46:19 +00:00
Lukasz Lenart 596858143f Adjusts site configuration to use new Apache scm plugin
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1441613 13f79535-47bb-0310-9956-ffa450edef68
2013-02-01 20:12:37 +00:00
Lukasz Lenart 97ae65c7a3 WW-3974 solves problem with parsing properties
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1439606 13f79535-47bb-0310-9956-ffa450edef68
2013-01-28 20:17:03 +00:00
Lukasz Lenart 504c86ead7 WW-3973 adds disclaimer about ParameterNameAware
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1439410 13f79535-47bb-0310-9956-ffa450edef68
2013-01-28 14:06:10 +00:00
Lukasz Lenart 12afffe7c3 WW-3931 adds new plugin to support Tiles 3 result type
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1439344 13f79535-47bb-0310-9956-ffa450edef68
2013-01-28 11:18:26 +00:00
Lukasz Lenart f852cacfee WW-3492 uses getter instead direct field access
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1439265 13f79535-47bb-0310-9956-ffa450edef68
2013-01-28 06:14:30 +00:00
Lukasz Lenart c9f2977902 WW-3698 wraps value with ValueStackDataSource if no already wrapped
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1439171 13f79535-47bb-0310-9956-ffa450edef68
2013-01-27 20:27:04 +00:00
Lukasz Lenart 6493648cc1 WW-3492 adds proper handling of If-Modified-Since header
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1439169 13f79535-47bb-0310-9956-ffa450edef68
2013-01-27 20:23:06 +00:00
Lukasz Lenart 30bc4bacc0 WW-3363 removes struts.multipart.handler and reference only to struts.multipart.parser to be consistent with the docs
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1439156 13f79535-47bb-0310-9956-ffa450edef68
2013-01-27 19:48:59 +00:00
Lukasz Lenart 7fe363aee4 WW-3664 extends Dispatcher to create directory tree defined as struts.multipart.saveDir
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1439137 13f79535-47bb-0310-9956-ffa450edef68
2013-01-27 18:41:57 +00:00
Lukasz Lenart 2d7564c05b WW-3871 refactors XWorkConverter to separate logic a bit
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1437180 13f79535-47bb-0310-9956-ffa450edef68
2013-01-22 21:20:35 +00:00
Lukasz Lenart ebc33bc718 Adds support for debug(String, Object...)
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1436984 13f79535-47bb-0310-9956-ffa450edef68
2013-01-22 14:55:59 +00:00
Lukasz Lenart 3f1f9a133b WW-3845 adds usage of putIfAbsent to improve atomicity
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1436951 13f79535-47bb-0310-9956-ffa450edef68
2013-01-22 14:28:15 +00:00
Lukasz Lenart 7010dd2f56 WW-3845 improves code to avoid empty HashSet
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1436940 13f79535-47bb-0310-9956-ffa450edef68
2013-01-22 14:13:07 +00:00
Lukasz Lenart 4f98e9148d WW-3971 adds ContainerHolder to reduce numbers of calls to getConfiguration() and optimize RuntimeConfiguration class to more thread friendly
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1436878 13f79535-47bb-0310-9956-ffa450edef68
2013-01-22 12:44:45 +00:00
Lukasz Lenart 2d91d4598f Reduces log level to info
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1436866 13f79535-47bb-0310-9956-ffa450edef68
2013-01-22 12:27:12 +00:00
Lukasz Lenart bacefffda4 WW-3919 adds proper logic to render id attribute
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1436660 13f79535-47bb-0310-9956-ffa450edef68
2013-01-21 22:23:18 +00:00
Lukasz Lenart e1da75d1bc WW-3912 adds proper support for checked attribute
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1436650 13f79535-47bb-0310-9956-ffa450edef68
2013-01-21 22:07:08 +00:00
Lukasz Lenart aba3b61670 WW-3922 uses default template engine to support cooperation with other plugins
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1436643 13f79535-47bb-0310-9956-ffa450edef68
2013-01-21 21:52:34 +00:00
Lukasz Lenart 62ee2636af WW-3920 adds support for scripting events
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1436637 13f79535-47bb-0310-9956-ffa450edef68
2013-01-21 21:47:13 +00:00
Lukasz Lenart 9b951fcd73 WW-3829 moves link to wiki
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1436528 13f79535-47bb-0310-9956-ffa450edef68
2013-01-21 18:17:13 +00:00
Lukasz Lenart 96c99ce061 WW-3829 adds better logging and improve example in JavaDoc
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1436526 13f79535-47bb-0310-9956-ffa450edef68
2013-01-21 18:13:32 +00:00
Lukasz Lenart 32ea57d925 Solves problem with possible NPE when key is null - https://github.com/apache/struts2/pull/4
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1436290 13f79535-47bb-0310-9956-ffa450edef68
2013-01-21 11:37:16 +00:00
Lukasz Lenart 186d2c1346 WW-3673 upgrades Log4j version
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1435936 13f79535-47bb-0310-9956-ffa450edef68
2013-01-20 19:57:56 +00:00
Lukasz Lenart 6d5c38bea2 WW-3808 adds xerces to allow pass build on JDK7
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1435934 13f79535-47bb-0310-9956-ffa450edef68
2013-01-20 19:52:55 +00:00
Lukasz Lenart 02dbb86205 WW-3916 adds usage of the latest Jetty plugin
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1435931 13f79535-47bb-0310-9956-ffa450edef68
2013-01-20 19:44:55 +00:00
Lukasz Lenart bbdaff9c0a WW-3965 solves problem with double bang in generated URI
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1434896 13f79535-47bb-0310-9956-ffa450edef68
2013-01-17 20:22:32 +00:00
Lukasz Lenart c4bc382de5 WW-3908 renames required attribute into requiredLabel to allow support of Html5 required attribute
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1434580 13f79535-47bb-0310-9956-ffa450edef68
2013-01-17 07:41:45 +00:00
Lukasz Lenart 85cfb8ba76 Solves problem with missing action name when mapping returned with empty action name
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1433889 13f79535-47bb-0310-9956-ffa450edef68
2013-01-16 10:39:01 +00:00
Lukasz Lenart adf10c07bb Solves problem with missing action name when mapping returned with empty action name
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1433854 13f79535-47bb-0310-9956-ffa450edef68
2013-01-16 08:36:59 +00:00
Lukasz Lenart 37025bc7b6 Adds better logging message to indicate where is the problem, which result type is missing DEFAULT_PARAM field
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1433853 13f79535-47bb-0310-9956-ffa450edef68
2013-01-16 08:34:41 +00:00
Lukasz Lenart 9389ae248a WW-3962 removes duplicated initialisation of loggerFactory
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1433650 13f79535-47bb-0310-9956-ffa450edef68
2013-01-15 21:09:01 +00:00
Lukasz Lenart bb5694b855 Improves logging of exceptions
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1433644 13f79535-47bb-0310-9956-ffa450edef68
2013-01-15 20:58:08 +00:00
Lukasz Lenart 09302facda WW-3837 solves problem with NPE
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1433600 13f79535-47bb-0310-9956-ffa450edef68
2013-01-15 19:43:43 +00:00
Lukasz Lenart 2db92f7040 WW-3904 removes parse param as is not needed anymore
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1432606 13f79535-47bb-0310-9956-ffa450edef68
2013-01-13 13:20:30 +00:00
Lukasz Lenart a8966a383d WW-3960 adds support to specify param as an expression
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1432603 13f79535-47bb-0310-9956-ffa450edef68
2013-01-13 13:05:21 +00:00
Lukasz Lenart dfe1d7c672 WW-3893 adds optional to params to define minLength, maxLength and trim params as an OGNL expression
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1432595 13f79535-47bb-0310-9956-ffa450edef68
2013-01-13 12:08:19 +00:00
Lukasz Lenart 6f110d8939 WW-3894 updates JavaDoc to match new implementation
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1432590 13f79535-47bb-0310-9956-ffa450edef68
2013-01-13 11:23:55 +00:00
Lukasz Lenart f81e5ac903 WW-3892 updates JavaDoc to match the implementation
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1432589 13f79535-47bb-0310-9956-ffa450edef68
2013-01-13 11:22:59 +00:00
Lukasz Lenart 52dba6bc29 WW-3894 updates JavaDoc to match new implementation
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1432588 13f79535-47bb-0310-9956-ffa450edef68
2013-01-13 11:19:47 +00:00
Lukasz Lenart 42c487bbca WW-3892 adjusts para names to new version of RegexpValidator
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1432586 13f79535-47bb-0310-9956-ffa450edef68
2013-01-13 11:03:39 +00:00
Lukasz Lenart b63c5086ba WW-3894 uses dedicated params to specify OGNL expressions
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1432585 13f79535-47bb-0310-9956-ffa450edef68
2013-01-13 11:00:37 +00:00
Lukasz Lenart f6a3d59df7 Adds missing documentation section
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1431540 13f79535-47bb-0310-9956-ffa450edef68
2013-01-10 18:18:39 +00:00
Johannes Geppert 5f083d4b23 WW-3959 Support for Slf4j as optional XWork Logging Backend
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1431482 13f79535-47bb-0310-9956-ffa450edef68
2013-01-10 16:26:26 +00:00
Lukasz Lenart d59aac13f2 WW-2923 adds support to be Locale independent
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1431122 13f79535-47bb-0310-9956-ffa450edef68
2013-01-09 22:35:08 +00:00
Lukasz Lenart e3602c0992 WW-2923 refactors validators to use dedicated params to define expressions
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1431115 13f79535-47bb-0310-9956-ffa450edef68
2013-01-09 22:21:56 +00:00
Lukasz Lenart 551e66d11e WW-3955 adds support to specify maxInclusive, minInclusive, minExclusive and maxExclusive params as expression
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1428576 13f79535-47bb-0310-9956-ffa450edef68
2013-01-03 20:25:46 +00:00
Lukasz Lenart fab92fb0f2 Corrects tiny problem with formatting
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1428457 13f79535-47bb-0310-9956-ffa450edef68
2013-01-03 16:31:57 +00:00
Lukasz Lenart ec4d64a308 Adds missing parse param in example
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1428445 13f79535-47bb-0310-9956-ffa450edef68
2013-01-03 16:20:11 +00:00
Lukasz Lenart a77303e4bf Adds additional SNIPPET
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1428441 13f79535-47bb-0310-9956-ffa450edef68
2013-01-03 16:14:09 +00:00
Lukasz Lenart dadb24ef47 Adds additional SNIPPET
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1428436 13f79535-47bb-0310-9956-ffa450edef68
2013-01-03 16:12:49 +00:00
Lukasz Lenart ed155d05fe Adds additional SNIPPET
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1428435 13f79535-47bb-0310-9956-ffa450edef68
2013-01-03 16:12:17 +00:00
Lukasz Lenart f5b8031de5 Adds additional SNIPPET
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1428431 13f79535-47bb-0310-9956-ffa450edef68
2013-01-03 16:11:26 +00:00
Lukasz Lenart de18aca845 Adds additional SNIPPET
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1428430 13f79535-47bb-0310-9956-ffa450edef68
2013-01-03 16:11:01 +00:00
Lukasz Lenart 837f85931e Removes duplicated warning
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1428427 13f79535-47bb-0310-9956-ffa450edef68
2013-01-03 16:05:54 +00:00
Lukasz Lenart 8ba1848ecd Adds additional SNIPPET
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1428423 13f79535-47bb-0310-9956-ffa450edef68
2013-01-03 16:04:24 +00:00
Lukasz Lenart 6a5a17f639 Removes duplicated code
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1428293 13f79535-47bb-0310-9956-ffa450edef68
2013-01-03 11:29:38 +00:00
Lukasz Lenart 204a6f544f WW-3893 adds support to specify minLength, maxLength and trim params as expression
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1428282 13f79535-47bb-0310-9956-ffa450edef68
2013-01-03 11:14:26 +00:00
Lukasz Lenart 673873c0c6 Moves parse(String, Class) to parent class to allow use it in all subclasess
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1428281 13f79535-47bb-0310-9956-ffa450edef68
2013-01-03 11:13:36 +00:00
Lukasz Lenart 159829bd5b WW-3892 adds support to specify expression, caseSensitive and trim params as expressions
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1428270 13f79535-47bb-0310-9956-ffa450edef68
2013-01-03 10:32:30 +00:00
Lukasz Lenart e65442f874 WW-3892 adds support to specify expression, caseSensitive and trim params as expressions
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1428268 13f79535-47bb-0310-9956-ffa450edef68
2013-01-03 10:31:35 +00:00
Lukasz Lenart a7a7d1297c WW-3892 adds support to specify expression, caseSensitive and trim params as expressions
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1428264 13f79535-47bb-0310-9956-ffa450edef68
2013-01-03 10:22:07 +00:00
Lukasz Lenart bc81e66e91 WW-3889 adds support to specify min and max constraints as expressions
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1428077 13f79535-47bb-0310-9956-ffa450edef68
2013-01-02 21:44:41 +00:00
Lukasz Lenart 5d1edd6cc6 WW-3891 uses new way to define min/max as expression
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1428076 13f79535-47bb-0310-9956-ffa450edef68
2013-01-02 21:43:39 +00:00
Lukasz Lenart daf5567a58 WW-3890 uses new way to define min/max as expression
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1428075 13f79535-47bb-0310-9956-ffa450edef68
2013-01-02 21:43:01 +00:00
Lukasz Lenart 6517e330d0 WW-3888 uses new way to define min/max as expression
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1428073 13f79535-47bb-0310-9956-ffa450edef68
2013-01-02 21:42:12 +00:00
Lukasz Lenart aa9de79979 WW-3890 improves support for generics and moves test values into the tests
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1428072 13f79535-47bb-0310-9956-ffa450edef68
2013-01-02 21:41:26 +00:00
Lukasz Lenart 542b68666b WW-2923 adds better support for generics
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1428071 13f79535-47bb-0310-9956-ffa450edef68
2013-01-02 21:40:21 +00:00
Lukasz Lenart 3a0454129e Removes unused constants and adds some logging
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1428017 13f79535-47bb-0310-9956-ffa450edef68
2013-01-02 20:41:22 +00:00
Lukasz Lenart d3624cbfbd WW-3953 adjusts Log level for accepted parameters
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1426761 13f79535-47bb-0310-9956-ffa450edef68
2012-12-29 13:38:20 +00:00
Lukasz Lenart 612e6f6611 Reverts back site target
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1425299 13f79535-47bb-0310-9956-ffa450edef68
2012-12-22 15:43:47 +00:00
Lukasz Lenart 23d2fbba65 Adds private scope
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1424653 13f79535-47bb-0310-9956-ffa450edef68
2012-12-20 19:54:05 +00:00
Lukasz Lenart bd01d1525a WW-3890 adds support for expression in specifying min and max constraints
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1424652 13f79535-47bb-0310-9956-ffa450edef68
2012-12-20 19:47:02 +00:00
Lukasz Lenart 40b7bfbe25 WW-3891 adds new Short validator and adds support for expression in specifying min and max constraints
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1424643 13f79535-47bb-0310-9956-ffa450edef68
2012-12-20 19:12:36 +00:00
Lukasz Lenart 27f8976f3a WW-3950 solves problem when there are two Convention based application deployed to JBoss 4.x
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1424375 13f79535-47bb-0310-9956-ffa450edef68
2012-12-20 09:25:40 +00:00
Lukasz Lenart c76e84572a WW-3947 improves Portlet Archetype
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1423630 13f79535-47bb-0310-9956-ffa450edef68
2012-12-18 20:37:23 +00:00
Lukasz Lenart bbb710b49f WW-3906 updates docs about parsing parameters
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1423626 13f79535-47bb-0310-9956-ffa450edef68
2012-12-18 20:30:41 +00:00
Lukasz Lenart 33a2e74ac4 WW-3906 adds support to parse all parameters of HttpHeaderResult
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1423621 13f79535-47bb-0310-9956-ffa450edef68
2012-12-18 20:27:39 +00:00
Lukasz Lenart 0ad2b155e2 WW-3755 extracts acceptedParamNames to constant
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1423615 13f79535-47bb-0310-9956-ffa450edef68
2012-12-18 20:13:50 +00:00
Lukasz Lenart fdc6b27e68 WW-3929 adds new errorPosition attribute
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1423607 13f79535-47bb-0310-9956-ffa450edef68
2012-12-18 19:53:12 +00:00
Lukasz Lenart 6368033118 WW-3925 adds better support for looking index action when user hits default namespace
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1423571 13f79535-47bb-0310-9956-ffa450edef68
2012-12-18 18:36:09 +00:00
Lukasz Lenart 036c5e77d4 Moves documentation to the wiki
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1422955 13f79535-47bb-0310-9956-ffa450edef68
2012-12-17 14:50:18 +00:00
Lukasz Lenart ab427ca043 Adds additional example how to use the mapper - thanks to Antonios Gkogkakis
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1422939 13f79535-47bb-0310-9956-ffa450edef68
2012-12-17 14:16:32 +00:00
Lukasz Lenart 640437c48b [maven-release-plugin] prepare for next development iteration
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1422546 13f79535-47bb-0310-9956-ffa450edef68
2012-12-16 11:45:49 +00:00
Lukasz Lenart 992bc8c641 [maven-release-plugin] prepare release STRUTS_2_3_8
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1422543 13f79535-47bb-0310-9956-ffa450edef68
2012-12-16 11:44:57 +00:00
Lukasz Lenart 3ac5711ef3 WW-3946 Removes commented plugins to allow prepare a release
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1422519 13f79535-47bb-0310-9956-ffa450edef68
2012-12-16 11:09:31 +00:00
Lukasz Lenart eb43cfc9c8 WW-3946 updates archetypes version
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1422507 13f79535-47bb-0310-9956-ffa450edef68
2012-12-16 10:29:05 +00:00
Lukasz Lenart 1f1d855086 WW-3946 prepares for release
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1422506 13f79535-47bb-0310-9956-ffa450edef68
2012-12-16 10:27:44 +00:00
Lukasz Lenart a4f1a77b2d WW-3863 Allows to define encoding per result
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1421740 13f79535-47bb-0310-9956-ffa450edef68
2012-12-14 08:53:49 +00:00
Lukasz Lenart b86d3d13fe WW-3942 solves NPE in iterator tag
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1421210 13f79535-47bb-0310-9956-ffa450edef68
2012-12-13 10:42:09 +00:00
Lukasz Lenart 0d93ceedf3 WW-3943 adds support for REST plugin
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1421096 13f79535-47bb-0310-9956-ffa450edef68
2012-12-13 07:24:06 +00:00
Christian Grobmeier 6bd836ee2a corrected svn id tag
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1420932 13f79535-47bb-0310-9956-ffa450edef68
2012-12-12 19:44:33 +00:00
Christian Grobmeier b87e82b1c9 added required license header
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1420931 13f79535-47bb-0310-9956-ffa450edef68
2012-12-12 19:43:31 +00:00
Christian Grobmeier b72d2a08c4 created serial uid
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1420930 13f79535-47bb-0310-9956-ffa450edef68
2012-12-12 19:37:49 +00:00
Christian Grobmeier adacc6741a example on how to wire session scoped spring beans prio spring-test 3.2 with the junit plugin
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1420928 13f79535-47bb-0310-9956-ffa450edef68
2012-12-12 19:36:56 +00:00
Lukasz Lenart 21d624697d WW-3766 sets struts.freemarker.mru.max.strong.size to 0 to SoftCacheStorage which performs better in heavy loaded applications
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1419061 13f79535-47bb-0310-9956-ffa450edef68
2012-12-09 18:09:19 +00:00
Lukasz Lenart 147a391cb6 WW-2537 cleans up code and logging
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1419038 13f79535-47bb-0310-9956-ffa450edef68
2012-12-09 17:45:58 +00:00
Lukasz Lenart f437838f39 WW-2537 clears warning about generics
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1418923 13f79535-47bb-0310-9956-ffa450edef68
2012-12-09 12:57:07 +00:00
Lukasz Lenart b312f1e7a0 WW-2537 clears warning about generics
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1418920 13f79535-47bb-0310-9956-ffa450edef68
2012-12-09 12:51:14 +00:00
Lukasz Lenart 225921477b WW-3058 Removes version from pom to use version from parent pom
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1418881 13f79535-47bb-0310-9956-ffa450edef68
2012-12-09 10:18:47 +00:00
Lukasz Lenart 3b8f2023c2 WW-3058 Upgrades only Velocity to 1.6.4 and cleans up poms a bit
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1418866 13f79535-47bb-0310-9956-ffa450edef68
2012-12-09 09:45:55 +00:00
Lukasz Lenart 35897a3c6c WW-3910 returns empty string list instead null and uses List instead of String[] array
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1417344 13f79535-47bb-0310-9956-ffa450edef68
2012-12-05 10:35:55 +00:00
Lukasz Lenart 58c919c5cb WW-3927 corrects developer notification
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1417339 13f79535-47bb-0310-9956-ffa450edef68
2012-12-05 10:17:35 +00:00
Lukasz Lenart 87feb01fd6 Adds Comparable to allow compile under JDK7
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1417321 13f79535-47bb-0310-9956-ffa450edef68
2012-12-05 09:08:10 +00:00
Lukasz Lenart d5108840a5 WW-3928 Rollbacks changes introduced with WW-2749 to allow work with mod_jk and so on
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1415770 13f79535-47bb-0310-9956-ffa450edef68
2012-11-30 17:58:41 +00:00
Lukasz Lenart 5c25eab9ef WW-3930 updates JavaDocs about static content loader
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1415524 13f79535-47bb-0310-9956-ffa450edef68
2012-11-30 07:25:53 +00:00
Lukasz Lenart cbe1d02cc5 Removes metadata as it's useless now
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1414891 13f79535-47bb-0310-9956-ffa450edef68
2012-11-28 20:12:49 +00:00
Lukasz Lenart c7eb0be7bf WW-3928 Adds deprecation warning to don't use ActionContextCleanUp any more
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1414400 13f79535-47bb-0310-9956-ffa450edef68
2012-11-27 21:06:08 +00:00
Lukasz Lenart 64c1753893 Excludes gxp and embedded jsp plugins from Maven build as theses plugins aren't Java5 complaint
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1412446 13f79535-47bb-0310-9956-ffa450edef68
2012-11-22 08:06:54 +00:00
Lukasz Lenart 0f2c049ef2 Adjusts code base to be compliant with Java 1.5
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1412443 13f79535-47bb-0310-9956-ffa450edef68
2012-11-22 07:49:20 +00:00
Lukasz Lenart 948cbd8679 Adjusts code base to be compliant with Java 1.5
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1412438 13f79535-47bb-0310-9956-ffa450edef68
2012-11-22 07:34:17 +00:00
Lukasz Lenart 0802b09ea1 Adjusts code base to be compliant with Java 1.7
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1412316 13f79535-47bb-0310-9956-ffa450edef68
2012-11-21 21:43:04 +00:00
Lukasz Lenart edbfa6716c Adjusts code base to be compliant with Java 1.5
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1412281 13f79535-47bb-0310-9956-ffa450edef68
2012-11-21 20:48:20 +00:00
Christian Grobmeier 7f83250dc3 fixed typo
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1412216 13f79535-47bb-0310-9956-ffa450edef68
2012-11-21 18:02:53 +00:00
Christian Grobmeier 6a0abf4387 Example should not use deprecated attributes. Added example showing evaluation of tag body
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1412215 13f79535-47bb-0310-9956-ffa450edef68
2012-11-21 18:02:17 +00:00
Lukasz Lenart b2428dbe78 WW-3884 reverts site target back to 2.x
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1411402 13f79535-47bb-0310-9956-ffa450edef68
2012-11-19 20:45:37 +00:00
Lukasz Lenart 7e3f60601b WW-3918 removes FileManager#isReloadConfigs() method and use @Inject("struts.configuration.xml.reload")
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1406190 13f79535-47bb-0310-9956-ffa450edef68
2012-11-06 15:45:57 +00:00
Lukasz Lenart 1011732ee2 WW-3918 removes FileManager#isReloadConfigs() method and use @Inject("struts.configuration.xml.reload")
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1406183 13f79535-47bb-0310-9956-ffa450edef68
2012-11-06 15:36:59 +00:00
Lukasz Lenart 60afb3aa82 WW-3918 removes FileManager#isReloadConfigs() method and use @Inject("struts.configuration.xml.reload")
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1406176 13f79535-47bb-0310-9956-ffa450edef68
2012-11-06 15:28:56 +00:00
Lukasz Lenart ac46437f21 WW-3907 upgrades to OGNL 3.0.6
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1406159 13f79535-47bb-0310-9956-ffa450edef68
2012-11-06 14:54:28 +00:00
Lukasz Lenart 68b0ac243d Does minor code refactoring and adds some additional logging
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1406154 13f79535-47bb-0310-9956-ffa450edef68
2012-11-06 14:44:10 +00:00
Lukasz Lenart f619eaefbf WW-3918 removes FileManager#isReloadConfigs() method and use @Inject("struts.configuration.xml.reload")
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1406145 13f79535-47bb-0310-9956-ffa450edef68
2012-11-06 14:23:51 +00:00
Lukasz Lenart 2f465f8daf WW-3917 removes FileManager dependency from UrlSet
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1406110 13f79535-47bb-0310-9956-ffa450edef68
2012-11-06 12:18:21 +00:00
Lukasz Lenart e0609a5fe8 WW-3916 adds the latest Jetty maven plugin to blank app
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1406109 13f79535-47bb-0310-9956-ffa450edef68
2012-11-06 12:10:41 +00:00
Lukasz Lenart a7443f0693 [maven-release-plugin] prepare for next development iteration
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1406062 13f79535-47bb-0310-9956-ffa450edef68
2012-11-06 07:06:02 +00:00
Lukasz Lenart 33ba783b04 [maven-release-plugin] prepare release STRUTS_2_3_7
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1406060 13f79535-47bb-0310-9956-ffa450edef68
2012-11-06 07:05:39 +00:00
Lukasz Lenart 1e87a79b7b WW-3884 upgrades version of archetypes
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1406057 13f79535-47bb-0310-9956-ffa450edef68
2012-11-06 06:50:13 +00:00
Lukasz Lenart 8a386b9e5d WW-3884 prepares Struts 2.3.7 release
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1406056 13f79535-47bb-0310-9956-ffa450edef68
2012-11-06 06:46:59 +00:00
Lukasz Lenart 881d0496a9 Reverts site target
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1406055 13f79535-47bb-0310-9956-ffa450edef68
2012-11-06 06:42:14 +00:00
Lukasz Lenart 4b890345e8 WW-3915 solves problem with reloading configs in devMode on each request
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1406052 13f79535-47bb-0310-9956-ffa450edef68
2012-11-06 06:19:04 +00:00
Lukasz Lenart 1716e17841 WW-3914 solves problem with returning always system implementation of FileManager
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1405930 13f79535-47bb-0310-9956-ffa450edef68
2012-11-05 20:04:35 +00:00
Lukasz Lenart 3538db6432 [maven-release-plugin] prepare for next development iteration
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1401040 13f79535-47bb-0310-9956-ffa450edef68
2012-10-22 19:35:49 +00:00
Lukasz Lenart 2d85737815 [maven-release-plugin] prepare release STRUTS_2_3_6
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1401038 13f79535-47bb-0310-9956-ffa450edef68
2012-10-22 19:35:24 +00:00
Lukasz Lenart 668e87878f WW-3884 updates version of archetypes
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1401020 13f79535-47bb-0310-9956-ffa450edef68
2012-10-22 19:18:16 +00:00
Lukasz Lenart d608492991 WW-3884 changes site target
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1401018 13f79535-47bb-0310-9956-ffa450edef68
2012-10-22 19:15:45 +00:00
Johannes Geppert 7ebc1d8b1c WW-3900 Refactor the Struts2 Showcase
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1400229 13f79535-47bb-0310-9956-ffa450edef68
2012-10-19 19:00:02 +00:00
Johannes Geppert 59f4f31a7f WW-3900 Refactor the Struts2 Showcase
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1400220 13f79535-47bb-0310-9956-ffa450edef68
2012-10-19 18:49:39 +00:00
Lukasz Lenart e6ca077e00 WW-3891 adds support for expression in specifying min and max constraints
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1399395 13f79535-47bb-0310-9956-ffa450edef68
2012-10-17 19:09:07 +00:00
Lukasz Lenart a25315b3d3 WW-3902 adds cache for BeanInfo to improve performance and avoid dead locks
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1399375 13f79535-47bb-0310-9956-ffa450edef68
2012-10-17 18:33:22 +00:00
Johannes Geppert ba0f11964b WW-3899 Person Manager Example in Struts2 Showcase does not work
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1398832 13f79535-47bb-0310-9956-ffa450edef68
2012-10-16 14:54:44 +00:00
Lukasz Lenart 964a01b4a6 WW-3881 allows new html input types
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1397712 13f79535-47bb-0310-9956-ffa450edef68
2012-10-12 20:07:22 +00:00
Lukasz Lenart b7d2e1f015 WW-2537 adds usage of generics and some minor code improvements
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1397705 13f79535-47bb-0310-9956-ffa450edef68
2012-10-12 19:56:30 +00:00
Lukasz Lenart 967b424dc8 WW-3896 Solves problem with reading result code from HttpHeaders
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1397694 13f79535-47bb-0310-9956-ffa450edef68
2012-10-12 19:12:17 +00:00
Johannes Geppert 506639be65 WW-3897 Refactor the Struts2 REST Showcase
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1397692 13f79535-47bb-0310-9956-ffa450edef68
2012-10-12 19:04:04 +00:00
Lukasz Lenart a33e2dc2ef WW-3888 updates documentation regarding expression evaluation
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1397257 13f79535-47bb-0310-9956-ffa450edef68
2012-10-11 19:40:52 +00:00
Lukasz Lenart 939cd00168 WW-3888 updates documentation regarding expression evaluation
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1397252 13f79535-47bb-0310-9956-ffa450edef68
2012-10-11 19:32:48 +00:00
Lukasz Lenart db96a28977 WW-3888 adds support for expression in specifying min and max constraints
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1397242 13f79535-47bb-0310-9956-ffa450edef68
2012-10-11 19:20:22 +00:00
Lukasz Lenart 7cd454ac96 WW-3609 changes how problem report is rendered and in case of exception sends simple error message
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1397027 13f79535-47bb-0310-9956-ffa450edef68
2012-10-11 12:55:53 +00:00
Lukasz Lenart 6e9bb24653 WW-3609 adds more logging when exception occurred
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1396976 13f79535-47bb-0310-9956-ffa450edef68
2012-10-11 10:25:36 +00:00
Lukasz Lenart f72cdce588 WW-3425 Improves if tests to simple test just one time
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1396971 13f79535-47bb-0310-9956-ffa450edef68
2012-10-11 10:06:26 +00:00
Lukasz Lenart 18ea7a70ef WW-3885 Updates regexp to improves e-mail validation support
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1396967 13f79535-47bb-0310-9956-ffa450edef68
2012-10-11 10:00:59 +00:00
Lukasz Lenart 2a833db4b2 [maven-release-plugin] prepare for next development iteration
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1394507 13f79535-47bb-0310-9956-ffa450edef68
2012-10-05 13:29:31 +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
721 changed files with 33410 additions and 14605 deletions
+8 -9
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.4</version>
<version>2.3.9</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_4/apps/blank</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/apps/blank</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_4/apps/blank</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_9/apps/blank</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_9/apps/blank</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_9/apps/blank</url>
</scm>
<dependencies>
@@ -65,15 +65,14 @@
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.0.1</version>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.7.v20120910</version>
<configuration>
<stopKey>CTRL+C</stopKey>
<stopPort>8999</stopPort>
<scanIntervalSeconds>10</scanIntervalSeconds>
<scanTargets>
<scanTarget>src/main/webapp/WEB-INF</scanTarget>
<scanTarget>src/main/webapp/WEB-INF/web.xml</scanTarget>
<scanTarget>src/main/resources/struts.xml</scanTarget>
<scanTarget>src/main/resources/example.xml</scanTarget>
</scanTargets>
</configuration>
</plugin>
+1 -1
View File
@@ -6,7 +6,7 @@
<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="false" />
<constant name="struts.devMode" value="true" />
<package name="default" namespace="/" extends="struts-default">
+4 -4
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.4</version>
<version>2.3.9</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_4/apps/jboss-blank</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/apps/jboss-blank</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_4/apps/jboss-blank</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_9/apps/jboss-blank</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_9/apps/jboss-blank</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_9/apps/jboss-blank</url>
</scm>
<dependencies>
+30 -6
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.4</version>
<version>2.3.9</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_4/apps/mailreader</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/apps/mailreader</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_4/apps/mailreader</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_9/apps/mailreader</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_9/apps/mailreader</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_9/apps/mailreader</url>
</scm>
<dependencies>
@@ -68,11 +68,35 @@
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.0.1</version>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.7.v20120910</version>
<configuration>
<stopKey>CTRL+C</stopKey>
<stopPort>8999</stopPort>
<systemProperties>
<systemProperty>
<name>log4j.configuration</name>
<value>file:${basedir}/src/main/resources/log4j.properties</value>
</systemProperty>
<systemProperty>
<name>slf4j</name>
<value>false</value>
</systemProperty>
</systemProperties>
<scanIntervalSeconds>10</scanIntervalSeconds>
<webAppSourceDirectory>${basedir}/src/main/webapp/</webAppSourceDirectory>
<webAppConfig>
<contextPath>/struts2-mailreader</contextPath>
<descriptor>${basedir}/src/main/webapp/WEB-INF/web.xml</descriptor>
</webAppConfig>
</configuration>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
@@ -0,0 +1,36 @@
#
# Log4J Settings for log4j 1.2.x (via jakarta-commons-logging)
#
# The five logging levels used by Log are (in order):
#
# 1. DEBUG (the least serious)
# 2. INFO
# 3. WARN
# 4. ERROR
# 5. FATAL (the most serious)
# Set root logger level to WARN and append to stdout
log4j.rootLogger=INFO, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%d %5p (%c:%L) - %m%n
# Print only messages of level ERROR or above in the package noModule.
log4j.logger.noModule=FATAL
# OpenSymphony Stuff
log4j.logger.freemarker=INFO
log4j.logger.com.opensymphony=INFO
log4j.logger.com.opensymphony.xwork2.ognl=ERROR
log4j.logger.org.apache.struts2=WARN
log4j.logger.org.apache.struts2.components=WARN
log4j.logger.org.apache.struts2.dispatcher=WARN
log4j.logger.org.apache.struts2.convention=INFO
# Spring Stuff
log4j.logger.org.springframework=WARN
@@ -1,13 +1,9 @@
<?xml version='1.0'?>
<database>
<user username="user" fromAddress="John.User@somewhere.com"
fullName="John Q. User" password="pass">
<subscription host="mail.hotmail.com" autoConnect="false"
password="bar" type="pop3" username="user1234">
</subscription>
<subscription host="mail.yahoo.com" autoConnect="false" password="foo"
type="imap" username="jquser">
</subscription>
</user>
<user username="user" fromAddress="John.User@somewhere.com" fullName="John Q. User" password="pass">
<subscription host="mail.yahoo.com" autoConnect="false" password="foo" type="imap" username="jquser">
</subscription>
<subscription host="mail.hotmail.com" autoConnect="false" password="bar" type="pop3" username="user1234">
</subscription>
</user>
</database>
+4 -4
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>2.3.4</version>
<version>2.3.9</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_4/apps</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/apps</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_4/apps</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_9/apps</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_9/apps</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_9/apps</url>
</scm>
<profiles>
+11 -19
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.4</version>
<version>2.3.9</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_4/apps/portlet</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/apps/portlet</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_4/apps/portlet</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_9/apps/portlet</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_9/apps/portlet</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_9/apps/portlet</url>
</scm>
<profiles>
@@ -118,22 +118,8 @@
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-tools</artifactId>
<version>1.3</version>
<exclusions>
<exclusion>
<groupId>velocity</groupId>
<artifactId>velocity</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>struts</groupId>
<artifactId>struts</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-digester</groupId>
<artifactId>commons-digester</artifactId>
@@ -193,6 +179,12 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
@@ -6,6 +6,7 @@
<validator name="required" class="com.opensymphony.xwork2.validator.validators.RequiredFieldValidator"/>
<validator name="requiredstring" class="com.opensymphony.xwork2.validator.validators.RequiredStringValidator"/>
<validator name="int" class="com.opensymphony.xwork2.validator.validators.IntRangeFieldValidator"/>
<validator name="short" class="com.opensymphony.xwork2.validator.validators.ShortRangeFieldValidator"/>
<validator name="double" class="com.opensymphony.xwork2.validator.validators.DoubleRangeFieldValidator"/>
<validator name="date" class="com.opensymphony.xwork2.validator.validators.DateRangeFieldValidator"/>
<validator name="expression" class="com.opensymphony.xwork2.validator.validators.ExpressionValidator"/>
+59 -55
View File
@@ -22,21 +22,21 @@
*/
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.4</version>
<version>2.3.9</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-rest-showcase</artifactId>
<packaging>war</packaging>
<version>2.3.4</version>
<name>Struts 2 Rest Showcase Example</name>
<description>Struts 2 Rest Showcase Example</description>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-rest-showcase</artifactId>
<packaging>war</packaging>
<version>2.3.9</version>
<name>Struts 2 Rest Showcase Example</name>
<description>Struts 2 Rest Showcase Example</description>
<dependencies>
<dependencies>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-rest-plugin</artifactId>
@@ -47,6 +47,11 @@
<artifactId>struts2-convention-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-config-browser-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@@ -59,12 +64,12 @@
<version>1.4.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -83,41 +88,50 @@
</dependencies>
<build>
<finalName>struts2-rest-showcase</finalName>
<plugins>
<plugin>
<finalName>struts2-rest-showcase</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.0.1</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
</configuration>
</plugin>
<!--
<plugin>
<groupId>org.twdata.maven</groupId>
<artifactId>maven-itblast-plugin</artifactId>
<version>0.3</version>
<executions>
<execution>
<phase>integration-test</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<containers>tomcat5x</containers>
</configuration>
</execution>
</executions>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.7.v20120910</version>
<configuration>
<stopKey>CTRL+C</stopKey>
<stopPort>8999</stopPort>
<systemProperties>
<systemProperty>
<name>log4j.configuration</name>
<value>file:${basedir}/src/main/resources/log4j.properties</value>
</systemProperty>
<systemProperty>
<name>slf4j</name>
<value>false</value>
</systemProperty>
</systemProperties>
<scanIntervalSeconds>10</scanIntervalSeconds>
<webAppSourceDirectory>${basedir}/src/main/webapp/</webAppSourceDirectory>
<webAppConfig>
<contextPath>/struts2-rest-showcase</contextPath>
<descriptor>${basedir}/src/main/webapp/WEB-INF/web.xml</descriptor>
</webAppConfig>
</configuration>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
</dependencies>
</plugin>
-->
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
@@ -127,16 +141,6 @@
</excludes>
</configuration>
</plugin>
</plugins>
</plugins>
</build>
<!--
<pluginRepositories>
<pluginRepository>
<id>twdata-m2-repository</id>
<name>twdata.org Maven Repository</name>
<url>http://twdata-m2-repository.googlecode.com/svn/</url>
</pluginRepository>
</pluginRepositories>
-->
</project>
@@ -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.*;
@@ -0,0 +1,29 @@
#
# Log4J Settings for log4j 1.2.x (via jakarta-commons-logging)
#
# The five logging levels used by Log are (in order):
#
# 1. DEBUG (the least serious)
# 2. INFO
# 3. WARN
# 4. ERROR
# 5. FATAL (the most serious)
# Set root logger level to WARN and append to stdout
log4j.rootLogger=WARN, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%d %5p (%c:%L) - %m%n
# Print only messages of level ERROR or above in the package noModule.
log4j.logger.noModule=ERROR
# OpenSymphony Stuff
log4j.logger.com.opensymphony=INFO
# Struts2 Stuff
log4j.logger.org.apache.struts2=INFO
@@ -1,23 +1,38 @@
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html>
<%@taglib prefix="s" uri="/struts-tags" %>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<html lang="en">
<head>
<title>Order ${id}</title>
<meta charset="utf-8">
<title>Order ${id}</title>
<link href="${pageContext.request.contextPath}/css/bootstrap.css" rel="stylesheet">
<link href="${pageContext.request.contextPath}/css/bootstrap-responsive.css" rel="stylesheet">
</head>
<body>
<form action="../${id}?_method=DELETE" method="post">
<p>
Are you sure you want to delete order ${id}?
</p>
<div>
<input type="submit" value="Delete" />
<input type="button" value="Cancel" onclick="window.location.href = '../../orders'" />
</div>
</form>
<br />
<a href="../../orders">Back to Orders</a>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div class="page-header">
<h1>Delete Order ${id}</h1>
</div>
<form action="../${id}?_method=DELETE" method="post">
<p>
Are you sure you want to delete order ${id}?
</p>
<div class="btn-group">
<input type="submit" value="Delete" class="btn btn-danger" />
<input type="button" value="Cancel" class="btn btn-success" onclick="window.location.href = '../../orders'" />
</div>
</form>
<br />
<a href="${pageContext.request.contextPath}/orders" class="btn btn-info">
<i class="icon icon-arrow-left"></i> Back to Orders
</a>
</div><!--/row-->
</div><!--/span-->
</div><!--/row-->
</body>
</html>
@@ -1,27 +1,55 @@
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html>
<%@taglib prefix="s" uri="/struts-tags" %>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<html lang="en">
<head>
<title>Order <s:property value="id" /></title>
<meta charset="utf-8">
<title>Order <s:property value="id" /></title>
<link href="${pageContext.request.contextPath}/css/bootstrap.css" rel="stylesheet">
<link href="${pageContext.request.contextPath}/css/bootstrap-responsive.css" rel="stylesheet">
</head>
<body>
<s:form method="post" action="%{#request.contextPath}/orders/%{id}">
<s:hidden name="_method" value="put" />
<table>
<s:textfield name="id" label="ID" disabled="true"/>
<s:textfield name="clientName" label="Client"/>
<s:textfield name="amount" label="Amount" />
<tr>
<td colspan="2">
<s:submit />
</td>
</table>
</s:form>
<a href="<%=request.getContextPath() %>/orders">Back to Orders</a>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div class="page-header">
<h1>Order <s:property value="id" /></h1>
</div>
<s:fielderror cssClass="alert alert-error"/>
<s:form method="post" action="%{#request.contextPath}/orders/%{id}" cssClass="form-horizontal" theme="simple">
<s:hidden name="_method" value="put" />
<div class="control-group">
<label class="control-label" for="id">ID</label>
<div class="controls">
<s:textfield id="id" name="id" disabled="true"/>
</div>
</div>
<div class="control-group">
<label class="control-label" for="clientName">Client</label>
<div class="controls">
<s:textfield id="clientName" name="clientName"/>
</div>
</div>
<div class="control-group">
<label class="control-label" for="amount">Amount</label>
<div class="controls">
<s:textfield id="amount" name="amount" />
</div>
</div>
<div class="form-actions">
<s:submit cssClass="btn btn-primary"/>
</div>
<table>
</s:form>
<a href="${pageContext.request.contextPath}/orders" class="btn btn-info">
<i class="icon icon-arrow-left"></i> Back to Orders
</a>
</div><!--/row-->
</div><!--/span-->
</div><!--/row-->
</body>
</html>
@@ -1,25 +1,47 @@
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html>
<%@taglib prefix="s" uri="/struts-tags" %>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<html lang="en">
<head>
<title>New Order</title>
<meta charset="utf-8">
<title>New Order</title>
<link href="${pageContext.request.contextPath}/css/bootstrap.css" rel="stylesheet">
<link href="${pageContext.request.contextPath}/css/bootstrap-responsive.css" rel="stylesheet">
</head>
<body>
<s:form method="post" action="%{#request.contextPath}/orders">
<table>
<s:textfield name="clientName" label="Client"/>
<s:textfield name="amount" label="Amount" />
<tr>
<td colspan="2">
<s:submit />
</td>
</table>
</s:form>
<a href="<%=request.getContextPath() %>/orders">Back to Orders</a>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div class="page-header">
<h1>New Order</h1>
</div>
<s:fielderror cssClass="alert alert-error"/>
<s:form method="post" action="%{#request.contextPath}/orders" cssClass="form-horizontal" theme="simple">
<div class="control-group">
<label class="control-label" for="clientName">Client</label>
<div class="controls">
<s:textfield id="clientName" name="clientName"/>
</div>
</div>
<div class="control-group">
<label class="control-label" for="amount">Amount</label>
<div class="controls">
<s:textfield id="amount" name="amount" />
</div>
</div>
<div class="form-actions">
<s:submit cssClass="btn btn-primary"/>
</div>
</s:form>
<a href="${pageContext.request.contextPath}/orders" class="btn btn-info">
<i class="icon icon-arrow-left"></i> Back to Orders
</a>
</div><!--/row-->
</div><!--/span-->
</div><!--/row-->
</body>
</html>
@@ -1,34 +1,48 @@
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html>
<%@taglib prefix="s" uri="/struts-tags" %>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<html lang="en">
<head>
<title>Orders</title>
<meta charset="utf-8">
<title>Orders</title>
<link href="${pageContext.request.contextPath}/css/bootstrap.css" rel="stylesheet">
<link href="${pageContext.request.contextPath}/css/bootstrap-responsive.css" rel="stylesheet">
</head>
<body>
<s:actionmessage />
<table>
<tr>
<th>ID</th>
<th>Client</th>
<th>Amount</th>
<th>Actions</th>
</tr>
<s:iterator value="model">
<tr>
<td>${id}</td>
<td><s:property value="clientName"/></td>
<td><s:property value="amount"/></td>
<td><a href="orders/${id}">View</a> |
<a href="orders/${id}/edit">Edit</a> |
<a href="orders/${id}/deleteConfirm">Delete</a></td>
</tr>
</s:iterator>
</table>
<a href="orders/new">Create a new order</a>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div class="page-header">
<h1>Orders</h1>
</div>
<s:actionmessage cssClass="alert alert-error"/>
<table class="table table-striped">
<tr>
<th>ID</th>
<th>Client</th>
<th>Amount</th>
<th>Actions</th>
</tr>
<s:iterator value="model">
<tr>
<td>${id}</td>
<td><s:property value="clientName"/></td>
<td><s:property value="amount"/></td>
<td>
<div class="btn-group">
<a href="orders/${id}" class="btn"><i class="icon icon-eye-open"></i> View</a>
<a href="orders/${id}/edit" class="btn"><i class="icon icon-edit"></i> Edit</a>
<a href="orders/${id}/deleteConfirm" class="btn btn-danger"><i class="icon icon-trash"></i> Delete</a>
</div>
</td>
</tr>
</s:iterator>
</table>
<a href="orders/new" class="btn btn-primary"><i class="icon icon-file"></i> Create a new order</a>
</div><!--/row-->
</div><!--/span-->
</div><!--/row-->
</body>
</html>
@@ -1,29 +1,40 @@
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html>
<%@taglib prefix="s" uri="/struts-tags" %>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<html lang="en">
<head>
<title>Order ${id}</title>
<meta charset="utf-8">
<title>Order ${id}</title>
<link href="${pageContext.request.contextPath}/css/bootstrap.css" rel="stylesheet">
<link href="${pageContext.request.contextPath}/css/bootstrap-responsive.css" rel="stylesheet">
</head>
<body>
<table>
<tr>
<th>ID</th>
<td>${id}</td>
</tr>
<tr>
<th>Client</th>
<td><s:property value="clientName"/></td>
</tr>
<tr>
<th>Amount</th>
<td><s:property value="amount"/></td>
</tr>
</table>
<a href="../orders">Back to Orders</a>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div class="page-header">
<h1>Order ${id}</h1>
</div>
<table class="table table-striped">
<tr>
<td class="span3">ID</td>
<td class="span9"><s:property value="id"/></td>
</tr>
<tr>
<td class="span3">Client</td>
<td class="span9"><s:property value="clientName"/></td>
</tr>
<tr>
<td class="span3">Amount</td>
<td class="span9"><s:property value="amount"/></td>
</tr>
</table>
<a href="${pageContext.request.contextPath}/orders" class="btn btn-info">
<i class="icon icon-arrow-left"></i> Back to Orders
</a>
</div><!--/row-->
</div><!--/span-->
</div><!--/row-->
</body>
</html>
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

+26 -60
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.4</version>
<version>2.3.9</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_4/apps/showcase</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/apps/showcase</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_4/apps/showcase</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_9/apps/showcase</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_9/apps/showcase</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_9/apps/showcase</url>
</scm>
@@ -134,23 +134,8 @@
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-tools</artifactId>
<exclusions>
<exclusion>
<groupId>velocity</groupId>
<artifactId>velocity</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>struts</groupId>
<artifactId>struts</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>opensymphony</groupId>
<artifactId>sitemesh</artifactId>
@@ -167,7 +152,7 @@
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<artifactId>commons-logging</artifactId>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
@@ -217,47 +202,37 @@
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.0.1</version>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.7.v20120910</version>
<configuration>
<stopKey>CTRL+C</stopKey>
<stopPort>8999</stopPort>
<systemProperties>
<systemProperty>
<name>log4j.configuration</name>
<value>file:${basedir}/src/main/resources/log4j.properties</value>
</systemProperty>
<systemProperty>
<name>slf4j</name>
<value>false</value>
</systemProperty>
</systemProperties>
<scanIntervalSeconds>10</scanIntervalSeconds>
<webAppSourceDirectory>${basedir}/src/main/webapp/</webAppSourceDirectory>
<webAppConfig>
<contextPath>/struts2-showcase</contextPath>
<descriptor>${basedir}/src/main/webapp/WEB-INF/web.xml</descriptor>
</webAppConfig>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.9</version>
<version>1.2.17</version>
</dependency>
</dependencies>
</plugin>
<!--
<plugin>
<groupId>org.twdata.maven</groupId>
<artifactId>maven-itblast-plugin</artifactId>
<version>0.3</version>
<executions>
<execution>
<phase>integration-test</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<containers>tomcat5x</containers>
</configuration>
</execution>
</executions>
</plugin>
-->
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
@@ -283,13 +258,4 @@
</resources>
</build>
<!--
<pluginRepositories>
<pluginRepository>
<id>twdata-m2-repository</id>
<name>twdata.org Maven Repository</name>
<url>http://twdata-m2-repository.googlecode.com/svn/</url>
</pluginRepository>
</pluginRepositories>
-->
</project>
@@ -20,87 +20,84 @@
*/
package org.apache.struts2.showcase;
import com.opensymphony.xwork2.ActionSupport;
import java.text.DateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import com.opensymphony.xwork2.ActionSupport;
/**
* <code>DateAction</code>
*
*/
public class DateAction extends ActionSupport {
private static DateFormat DF = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
private static DateFormat DF = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
private Date now;
private Date past;
private Date future;
private Date after;
private Date before;
private Date now;
private Date past;
private Date future;
private Date after;
private Date before;
public String getDate() {
return DF.format(new Date());
}
public String getDate() {
return DF.format(new Date());
}
/**
* @return Returns the future.
*/
public Date getFuture() {
return future;
}
/**
* @return Returns the future.
*/
public Date getFuture() {
return future;
}
/**
* @return Returns the now.
*/
public Date getNow() {
return now;
}
/**
* @return Returns the now.
*/
public Date getNow() {
return now;
}
/**
* @return Returns the past.
*/
public Date getPast() {
return past;
}
/**
* @return Returns the past.
*/
public Date getPast() {
return past;
}
/**
*
* @return Returns the before date.
*/
public Date getBefore() {
return before;
}
/**
* @return Returns the before date.
*/
public Date getBefore() {
return before;
}
/**
*
* @return Returns the after date.
*/
public Date getAfter() {
return after;
}
/**
* @return Returns the after date.
*/
public Date getAfter() {
return after;
}
/**
*/
public String browse() throws Exception {
Calendar cal = GregorianCalendar.getInstance();
now = cal.getTime();
cal.roll(Calendar.DATE, -1);
cal.roll(Calendar.HOUR, -3);
past = cal.getTime();
cal.roll(Calendar.DATE, 2);
future = cal.getTime();
/**
*/
public String browse() throws Exception {
Calendar cal = GregorianCalendar.getInstance();
now = cal.getTime();
cal.roll(Calendar.DATE, -1);
cal.roll(Calendar.HOUR, -3);
past = cal.getTime();
cal.roll(Calendar.DATE, 2);
future = cal.getTime();
cal.roll(Calendar.YEAR, -1);
before = cal.getTime();
cal.roll(Calendar.YEAR, -1);
before = cal.getTime();
cal.roll(Calendar.YEAR, 2);
after = cal.getTime();
return SUCCESS;
}
cal.roll(Calendar.YEAR, 2);
after = cal.getTime();
return SUCCESS;
}
}
@@ -20,35 +20,35 @@
*/
package org.apache.struts2.showcase;
import org.apache.struts2.showcase.ajax.tree.Category;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.showcase.ajax.tree.Category;
//START SNIPPET: treeExampleDynamicJavaSelected
public class DynamicTreeSelectAction extends ActionSupport {
private long nodeId;
private Category currentCategory;
private long nodeId;
private Category currentCategory;
public void setNodeId(long nodeId) {
this.nodeId = nodeId;
}
public long getNodeId() {
return nodeId;
}
public void setNodeId(long nodeId) {
this.nodeId = nodeId;
}
public long getNodeId() {
return nodeId;
}
public String execute() throws Exception {
currentCategory = Category.getById(nodeId);
return SUCCESS;
}
public String execute() throws Exception {
currentCategory = Category.getById(nodeId);
return SUCCESS;
}
public String getNodeName() {
return currentCategory != null ? currentCategory.getName() : "Node not found";
}
public String getNodeName() {
return currentCategory != null ? currentCategory.getName() : "Node not found";
}
}
//START SNIPPET: treeExampleDynamicJavaSelected
@@ -20,267 +20,261 @@
*/
package org.apache.struts2.showcase;
import com.opensymphony.xwork2.ActionSupport;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import com.opensymphony.xwork2.ActionSupport;
/**
*/
public class LotsOfOptiontransferselectAction extends ActionSupport {
private List _favouriteCartoonCharactersKeys;
private List _notFavouriteCartoonCharactersKeys;
private List _favouriteCartoonCharactersKeys;
private List _notFavouriteCartoonCharactersKeys;
private List _favouriteCarsKeys;
private List _notFavouriteCarsKeys;
private List _favouriteCarsKeys;
private List _notFavouriteCarsKeys;
private List _favouriteMotorcyclesKeys;
private List _notFavouriteMotorcyclesKeys;
private List _favouriteMotorcyclesKeys;
private List _notFavouriteMotorcyclesKeys;
private List _favouriteCountriesKeys;
private List _notFavouriteCountriesKeys;
private List _favouriteCountriesKeys;
private List _notFavouriteCountriesKeys;
private List _favouriteSportsKeys;
private List _nonFavouriteSportsKeys;
private List _favouriteSportsKeys;
private List _nonFavouriteSportsKeys;
private List _favouriteCities;
private List _favouriteCities;
private List _prioritisedFavouriteCartoonCharacters;
private List _prioritisedFavouriteCars;
private List _prioritisedFavouriteCountries;
private List _prioritisedFavouriteCartoonCharacters;
private List _prioritisedFavouriteCars;
private List _prioritisedFavouriteCountries;
// Cartoon Characters
public Map getDefaultFavouriteCartoonCharacters() {
Map m = new LinkedHashMap();
m.put("heMan", "He-Man");
m.put("popeye", "Popeye");
m.put("mockeyMouse", "Mickey Mouse");
return m;
}
// Cartoon Characters
public Map getDefaultFavouriteCartoonCharacters() {
Map m = new LinkedHashMap();
m.put("heMan", "He-Man");
m.put("popeye", "Popeye");
m.put("mockeyMouse", "Mickey Mouse");
return m;
}
public Map getDefaultNotFavouriteCartoonCharacters() {
Map m = new LinkedHashMap();
m.put("donaldDuck", "Donald Duck");
m.put("atomicAnt", "Atomic Ant");
m.put("pinkPainter", "Pink Painter");
return m;
}
public Map getDefaultNotFavouriteCartoonCharacters() {
Map m = new LinkedHashMap();
m.put("donaldDuck", "Donald Duck");
m.put("atomicAnt", "Atomic Ant");
m.put("pinkPainter", "Pink Painter");
return m;
}
public List getFavouriteCartoonCharacters() {
return _favouriteCartoonCharactersKeys;
}
public List getFavouriteCartoonCharacters() {
return _favouriteCartoonCharactersKeys;
}
public void setFavouriteCartoonCharacters(List favouriteCartoonCharacters) {
_favouriteCartoonCharactersKeys = favouriteCartoonCharacters;
}
public void setFavouriteCartoonCharacters(List favouriteCartoonCharacters) {
_favouriteCartoonCharactersKeys = favouriteCartoonCharacters;
}
public List getNotFavouriteCartoonCharacters() {
return _notFavouriteCartoonCharactersKeys;
}
public List getNotFavouriteCartoonCharacters() {
return _notFavouriteCartoonCharactersKeys;
}
public void setNotFavouriteCartoonCharacters(List notFavouriteCartoonCharacters) {
_notFavouriteCartoonCharactersKeys = notFavouriteCartoonCharacters;
}
public void setNotFavouriteCartoonCharacters(List notFavouriteCartoonCharacters) {
_notFavouriteCartoonCharactersKeys = notFavouriteCartoonCharacters;
}
// Cars
public Map getDefaultFavouriteCars() {
Map m = new LinkedHashMap();
m.put("alfaRomeo", "Alfa Romeo");
m.put("Toyota", "Toyota");
m.put("Mitsubitshi", "Mitsubitshi");
return m;
}
public Map getDefaultNotFavouriteCars() {
Map m = new LinkedHashMap();
m.put("ford", "Ford");
m.put("landRover", "Land Rover");
m.put("mercedes", "Mercedes");
return m;
}
public List getFavouriteCars() {
return _favouriteCarsKeys;
}
public void setFavouriteCars(List favouriteCars) {
_favouriteCarsKeys = favouriteCars;
}
public List getNotFavouriteCars() {
return _notFavouriteCarsKeys;
}
public void setNotFavouriteCars(List notFavouriteCars) {
_notFavouriteCarsKeys = notFavouriteCars;
}
// Motorcycles
public Map getDefaultFavouriteMotorcycles() {
Map m = new LinkedHashMap();
m.put("honda", "Honda");
m.put("yamaha", "Yamaha");
m.put("Aprillia", "Aprillia");
return m;
}
// Cars
public Map getDefaultFavouriteCars() {
Map m = new LinkedHashMap();
m.put("alfaRomeo", "Alfa Romeo");
m.put("Toyota", "Toyota");
m.put("Mitsubitshi", "Mitsubitshi");
return m;
}
public Map getDefaultNotFavouriteMotorcycles() {
Map m = new LinkedHashMap();
m.put("cagiva", "Cagiva");
m.put("harleyDavidson", "Harley Davidson");
m.put("suzuki", "Suzuki");
return m;
}
public Map getDefaultNotFavouriteCars() {
Map m = new LinkedHashMap();
m.put("ford", "Ford");
m.put("landRover", "Land Rover");
m.put("mercedes", "Mercedes");
return m;
}
public List getFavouriteMotorcycles() {
return _favouriteMotorcyclesKeys;
}
public List getFavouriteCars() {
return _favouriteCarsKeys;
}
public void setFavouriteMotorcycles(List favouriteMotorcycles) {
_favouriteMotorcyclesKeys = favouriteMotorcycles;
}
public void setFavouriteCars(List favouriteCars) {
_favouriteCarsKeys = favouriteCars;
}
public List getNotFavouriteMotorcycles() {
return _notFavouriteMotorcyclesKeys;
}
public List getNotFavouriteCars() {
return _notFavouriteCarsKeys;
}
public void setNotFavouriteCars(List notFavouriteCars) {
_notFavouriteCarsKeys = notFavouriteCars;
}
public void setNotFavouriteMotorcycles(List notFavouriteMotorcycles) {
_notFavouriteMotorcyclesKeys = notFavouriteMotorcycles;
}
// Countries
public Map getDefaultFavouriteCountries() {
Map m = new LinkedHashMap();
m.put("england", "England");
m.put("america", "America");
m.put("brazil", "Brazil");
return m;
}
// Motorcycles
public Map getDefaultFavouriteMotorcycles() {
Map m = new LinkedHashMap();
m.put("honda", "Honda");
m.put("yamaha", "Yamaha");
m.put("Aprillia", "Aprillia");
return m;
}
public Map getDefaultNotFavouriteCountries() {
Map m = new LinkedHashMap();
m.put("germany", "Germany");
m.put("china", "China");
m.put("russia", "Russia");
return m;
}
public Map getDefaultNotFavouriteMotorcycles() {
Map m = new LinkedHashMap();
m.put("cagiva", "Cagiva");
m.put("harleyDavidson", "Harley Davidson");
m.put("suzuki", "Suzuki");
return m;
}
public List getFavouriteCountries() {
return _favouriteCountriesKeys;
}
public List getFavouriteMotorcycles() {
return _favouriteMotorcyclesKeys;
}
public void setFavouriteCountries(List favouriteCountries) {
_favouriteCountriesKeys = favouriteCountries;
}
public void setFavouriteMotorcycles(List favouriteMotorcycles) {
_favouriteMotorcyclesKeys = favouriteMotorcycles;
}
public List getNotFavouriteCountries() {
return _notFavouriteCountriesKeys;
}
public List getNotFavouriteMotorcycles() {
return _notFavouriteMotorcyclesKeys;
}
public void setNotFavouriteCountries(List notFavouriteCountries) {
_notFavouriteCountriesKeys = notFavouriteCountries;
}
public void setNotFavouriteMotorcycles(List notFavouriteMotorcycles) {
_notFavouriteMotorcyclesKeys = notFavouriteMotorcycles;
}
// Sports
public Map getDefaultNonFavoriteSports() {
Map m = new LinkedHashMap();
m.put("basketball", "Basketball");
m.put("football", "Football");
m.put("baseball", "Baseball");
return m;
}
public Map getDefaultFavoriteSports() {
return new LinkedHashMap();
}
public List getFavouriteSports() {
return _favouriteSportsKeys;
}
public void setFavouriteSports(List favouriteSportsKeys) {
this._favouriteSportsKeys = favouriteSportsKeys;
}
public List getNonFavouriteSports() {
return _nonFavouriteSportsKeys;
}
public void setNonFavouriteSports(List notFavouriteSportsKeys) {
this._nonFavouriteSportsKeys = notFavouriteSportsKeys;
}
public List getPrioritisedFavouriteCartoonCharacters() {
return _prioritisedFavouriteCartoonCharacters;
}
// Countries
public Map getDefaultFavouriteCountries() {
Map m = new LinkedHashMap();
m.put("england", "England");
m.put("america", "America");
m.put("brazil", "Brazil");
return m;
}
public void setPrioritisedFavouriteCartoonCharacters(List prioritisedFavouriteCartoonCharacters) {
_prioritisedFavouriteCartoonCharacters = prioritisedFavouriteCartoonCharacters;
}
public Map getDefaultNotFavouriteCountries() {
Map m = new LinkedHashMap();
m.put("germany", "Germany");
m.put("china", "China");
m.put("russia", "Russia");
return m;
}
public List getPrioritisedFavouriteCars() {
return _prioritisedFavouriteCars;
}
public List getFavouriteCountries() {
return _favouriteCountriesKeys;
}
public void setFavouriteCountries(List favouriteCountries) {
_favouriteCountriesKeys = favouriteCountries;
}
public List getNotFavouriteCountries() {
return _notFavouriteCountriesKeys;
}
public void setNotFavouriteCountries(List notFavouriteCountries) {
_notFavouriteCountriesKeys = notFavouriteCountries;
}
// Sports
public Map getDefaultNonFavoriteSports() {
Map m = new LinkedHashMap();
m.put("basketball", "Basketball");
m.put("football", "Football");
m.put("baseball", "Baseball");
return m;
}
public Map getDefaultFavoriteSports() {
return new LinkedHashMap();
}
public List getFavouriteSports() {
return _favouriteSportsKeys;
}
public void setFavouriteSports(List favouriteSportsKeys) {
this._favouriteSportsKeys = favouriteSportsKeys;
}
public List getNonFavouriteSports() {
return _nonFavouriteSportsKeys;
}
public void setNonFavouriteSports(List notFavouriteSportsKeys) {
this._nonFavouriteSportsKeys = notFavouriteSportsKeys;
}
public void setPrioritisedFavouriteCars(List prioritisedFavouriteCars) {
_prioritisedFavouriteCars = prioritisedFavouriteCars;
}
public List getPrioritisedFavouriteCountries() {
return _prioritisedFavouriteCountries;
}
public List getPrioritisedFavouriteCartoonCharacters() {
return _prioritisedFavouriteCartoonCharacters;
}
public void setPrioritisedFavouriteCartoonCharacters(List prioritisedFavouriteCartoonCharacters) {
_prioritisedFavouriteCartoonCharacters = prioritisedFavouriteCartoonCharacters;
}
public List getPrioritisedFavouriteCars() {
return _prioritisedFavouriteCars;
}
public void setPrioritisedFavouriteCars(List prioritisedFavouriteCars) {
_prioritisedFavouriteCars = prioritisedFavouriteCars;
}
public void setPrioritisedFavouriteCountries(List prioritisedFavouriteCountries) {
_prioritisedFavouriteCountries = prioritisedFavouriteCountries;
}
public List getPrioritisedFavouriteCountries() {
return _prioritisedFavouriteCountries;
}
public void setPrioritisedFavouriteCountries(List prioritisedFavouriteCountries) {
_prioritisedFavouriteCountries = prioritisedFavouriteCountries;
}
public Map getAvailableCities() {
Map map = new LinkedHashMap();
map.put("boston", "Boston");
map.put("new york", "New York");
map.put("london", "London");
map.put("rome", "Rome");
return map;
}
public List getDefaultFavouriteCities() {
List list = new ArrayList();
list.add("boston");
list.add("rome");
return list;
}
public List getFavouriteCities() {
return _favouriteCities;
}
public Map getAvailableCities() {
Map map = new LinkedHashMap();
map.put("boston", "Boston");
map.put("new york", "New York");
map.put("london", "London");
map.put("rome", "Rome");
return map;
}
public void setFavouriteCities(List favouriteCities) {
this._favouriteCities = favouriteCities;
}
public List getDefaultFavouriteCities() {
List list = new ArrayList();
list.add("boston");
list.add("rome");
return list;
}
// actions
public List getFavouriteCities() {
return _favouriteCities;
}
public String input() throws Exception {
return SUCCESS;
}
public void setFavouriteCities(List favouriteCities) {
this._favouriteCities = favouriteCities;
}
// actions
public String input() throws Exception {
return SUCCESS;
}
public String submit() throws Exception {
return SUCCESS;
}
public String submit() throws Exception {
return SUCCESS;
}
}
@@ -27,52 +27,52 @@ import com.opensymphony.xwork2.ActionSupport;
*/
public class LotsOfRichtexteditorAction extends ActionSupport {
public String description1;
public String description2 = "This is Description 2";
public String description3;
public String description4 = "This is Description 4";
public String description1;
public String description2 = "This is Description 2";
public String description3;
public String description4 = "This is Description 4";
public String getDescription1() {
return this.description1;
}
public void setDescription1(String description1) {
this.description1 = description1;
}
public String getDescription1() {
return this.description1;
}
public void setDescription1(String description1) {
this.description1 = description1;
}
public String getDescription2() {
return this.description2;
}
public void setDescription2(String description2) {
this.description2 = description2;
}
public String getDescription2() {
return this.description2;
}
public void setDescription2(String description2) {
this.description2 = description2;
}
public String getDescription3() {
return this.description3;
}
public void setDescription3(String description3) {
this.description3 = description3;
}
public String getDescription3() {
return this.description3;
}
public void setDescription3(String description3) {
this.description3 = description3;
}
public String getDescription4() {
return this.description4;
}
public void setDescription4(String description4) {
this.description4 = description4;
}
public String getDescription4() {
return this.description4;
}
public void setDescription4(String description4) {
this.description4 = description4;
}
public String input() throws Exception {
return SUCCESS;
}
public String input() throws Exception {
return SUCCESS;
}
public String submit() throws Exception {
return SUCCESS;
}
public String submit() throws Exception {
return SUCCESS;
}
}
@@ -22,114 +22,115 @@ package org.apache.struts2.showcase;
import com.opensymphony.xwork2.ActionSupport;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.LinkedHashMap;
import java.util.ArrayList;
/**
*/
public class MoreSelectsAction extends ActionSupport {
private List _prioritisedFavouriteCartoonCharacters;
private List _prioritisedFavouriteCars;
private List _prioritisedFavouriteCountries;
private List favouriteNumbers;
private List _prioritisedFavouriteCartoonCharacters;
private List _prioritisedFavouriteCars;
private List _prioritisedFavouriteCountries;
private List favouriteNumbers;
// Cartoon Characters
public Map getDefaultFavouriteCartoonCharacters() {
Map m = new LinkedHashMap();
m.put("heMan", "He-Man");
m.put("popeye", "Popeye");
m.put("mockeyMouse", "Mickey Mouse");
return m;
}
// Cartoon Characters
public Map getDefaultFavouriteCartoonCharacters() {
Map m = new LinkedHashMap();
m.put("heMan", "He-Man");
m.put("popeye", "Popeye");
m.put("mockeyMouse", "Mickey Mouse");
return m;
}
// Cars
public Map getDefaultFavouriteCars() {
Map m = new LinkedHashMap();
m.put("alfaRomeo", "Alfa Romeo");
m.put("Toyota", "Toyota");
m.put("Mitsubitshi", "Mitsubitshi");
return m;
}
// Cars
public Map getDefaultFavouriteCars() {
Map m = new LinkedHashMap();
m.put("alfaRomeo", "Alfa Romeo");
m.put("Toyota", "Toyota");
m.put("Mitsubitshi", "Mitsubitshi");
return m;
}
// Countries
public Map getDefaultFavouriteCountries() {
Map m = new LinkedHashMap();
m.put("england", "England");
m.put("america", "America");
m.put("brazil", "Brazil");
return m;
}
// Countries
public Map getDefaultFavouriteCountries() {
Map m = new LinkedHashMap();
m.put("england", "England");
m.put("america", "America");
m.put("brazil", "Brazil");
return m;
}
public List getDefaultFavouriteNumbers() {
List list = new ArrayList();
list.add("Three");
list.add("Seven");
return list;
}
public List getDefaultFavouriteNumbers() {
List list = new ArrayList();
list.add("Three");
list.add("Seven");
return list;
}
public List getPrioritisedFavouriteCartoonCharacters() {
return _prioritisedFavouriteCartoonCharacters;
}
public List getPrioritisedFavouriteCartoonCharacters() {
return _prioritisedFavouriteCartoonCharacters;
}
public void setPrioritisedFavouriteCartoonCharacters(List prioritisedFavouriteCartoonCharacters) {
_prioritisedFavouriteCartoonCharacters = prioritisedFavouriteCartoonCharacters;
}
public void setPrioritisedFavouriteCartoonCharacters(List prioritisedFavouriteCartoonCharacters) {
_prioritisedFavouriteCartoonCharacters = prioritisedFavouriteCartoonCharacters;
}
public List getPrioritisedFavouriteCars() {
return _prioritisedFavouriteCars;
}
public void setPrioritisedFavouriteCars(List prioritisedFavouriteCars) {
_prioritisedFavouriteCars = prioritisedFavouriteCars;
}
public List getPrioritisedFavouriteCars() {
return _prioritisedFavouriteCars;
}
public void setPrioritisedFavouriteCars(List prioritisedFavouriteCars) {
_prioritisedFavouriteCars = prioritisedFavouriteCars;
}
public List getPrioritisedFavouriteCountries() {
return _prioritisedFavouriteCountries;
}
public void setPrioritisedFavouriteCountries(List prioritisedFavouriteCountries) {
_prioritisedFavouriteCountries = prioritisedFavouriteCountries;
}
public List getPrioritisedFavouriteCountries() {
return _prioritisedFavouriteCountries;
}
public List getFavouriteNumbers() {
return favouriteNumbers;
}
public void setPrioritisedFavouriteCountries(List prioritisedFavouriteCountries) {
_prioritisedFavouriteCountries = prioritisedFavouriteCountries;
}
public void setFavouriteNumbers(List favouriteNumbers) {
this.favouriteNumbers = favouriteNumbers;
}
public List getFavouriteNumbers() {
return favouriteNumbers;
}
public Map getAvailableCities() {
Map map = new LinkedHashMap();
map.put("boston", "Boston");
map.put("new york", "New York");
map.put("london", "London");
map.put("rome", "Rome");
return map;
}
public void setFavouriteNumbers(List favouriteNumbers) {
this.favouriteNumbers = favouriteNumbers;
}
public List getDefaultFavouriteCities() {
List list = new ArrayList();
list.add("boston");
list.add("rome");
return list;
}
public Map getAvailableCities() {
Map map = new LinkedHashMap();
map.put("boston", "Boston");
map.put("new york", "New York");
map.put("london", "London");
map.put("rome", "Rome");
return map;
}
// actions
public List getDefaultFavouriteCities() {
List list = new ArrayList();
list.add("boston");
list.add("rome");
return list;
}
public String input() throws Exception {
return SUCCESS;
}
// actions
public String submit() throws Exception {
return SUCCESS;
}
public String input() throws Exception {
return SUCCESS;
}
public String submit() throws Exception {
return SUCCESS;
}
}
@@ -20,22 +20,21 @@
*/
package org.apache.struts2.showcase;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.showcase.ajax.tree.Category;
import com.opensymphony.xwork2.ActionSupport;
public class ShowAjaxDynamicTreeAction extends ActionSupport {
private int nodeId = 1;
private int nodeId = 1;
public Category getCategory() {
return Category.getById(nodeId);
}
public Category getCategory() {
return Category.getById(nodeId);
}
public int getNodeId() {
return nodeId;
}
public int getNodeId() {
return nodeId;
}
public void setNodeId(int nodeId) {
this.nodeId = nodeId;
}
public void setNodeId(int nodeId) {
this.nodeId = nodeId;
}
}
@@ -20,17 +20,16 @@
*/
package org.apache.struts2.showcase;
import org.apache.struts2.showcase.ajax.tree.Category;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.showcase.ajax.tree.Category;
// START SNIPPET: treeExampleDynamicJavaShow
public class ShowDynamicTreeAction extends ActionSupport {
public Category getTreeRootNode() {
return Category.getById(1);
}
public Category getTreeRootNode() {
return Category.getById(1);
}
}
// END SNIPPET: treeExampleDynamicJavaShow
@@ -26,312 +26,324 @@ 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.*;
/**
*/
public class UITagExample extends ActionSupport implements Validateable {
private static final long serialVersionUID = -94044809860988047L;
String name;
Date birthday;
Date wakeup;
String bio;
String favouriteColor;
List friends;
String bestFriend;
boolean legalAge;
String state;
String region;
File picture;
String pictureContentType;
String pictureFileName;
String favouriteLanguage;
String favouriteVehicalType = "MotorcycleKey";
String favouriteVehicalSpecific = "YamahaKey";
List leftSideCartoonCharacters;
List rightSideCartoonCharacters;
List favouriteLanguages = new ArrayList();
List vehicalTypeList = new ArrayList();
Map vehicalSpecificMap = new HashMap();
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"));
VehicalType car = new VehicalType("CarKey", "Car");
VehicalType motorcycle = new VehicalType("MotorcycleKey", "Motorcycle");
vehicalTypeList.add(car);
vehicalTypeList.add(motorcycle);
List cars = new ArrayList();
cars.add(new VehicalSpecific("MercedesKey", "Mercedes"));
cars.add(new VehicalSpecific("HondaKey", "Honda"));
cars.add(new VehicalSpecific("FordKey", "Ford"));
List motorcycles = new ArrayList();
motorcycles.add(new VehicalSpecific("SuzukiKey", "Suzuki"));
motorcycles.add(new VehicalSpecific("YamahaKey", "Yamaha"));
vehicalSpecificMap.put(car, cars);
vehicalSpecificMap.put(motorcycle, motorcycles);
}
public List getLeftSideCartoonCharacters() {
return leftSideCartoonCharacters;
}
public void setLeftSideCartoonCharacters(List leftSideCartoonCharacters) {
this.leftSideCartoonCharacters = leftSideCartoonCharacters;
}
public List getRightSideCartoonCharacters() {
return rightSideCartoonCharacters;
}
public void setRightSideCartoonCharacters(List rightSideCartoonCharacters) {
this.rightSideCartoonCharacters = rightSideCartoonCharacters;
}
public String getFavouriteVehicalType() {
return favouriteVehicalType;
}
public void setFavouriteVehicalType(String favouriteVehicalType) {
this.favouriteVehicalType = favouriteVehicalType;
}
public String getFavouriteVehicalSpecific() {
return favouriteVehicalSpecific;
}
public void setFavouriteVehicalSpecific(String favouriteVehicalSpecific) {
this.favouriteVehicalSpecific = favouriteVehicalSpecific;
}
public List getVehicalTypeList() {
return vehicalTypeList;
}
public List getVehicalSpecificList() {
ValueStack stack = ServletActionContext.getValueStack(ServletActionContext.getRequest());
Object vehicalType = stack.findValue("top");
if (vehicalType != null && vehicalType instanceof VehicalType) {
List l = (List) vehicalSpecificMap.get(vehicalType);
return l;
}
return Collections.EMPTY_LIST;
}
public List getFavouriteLanguages() {
return favouriteLanguages;
}
public String execute() throws Exception {
return SUCCESS;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Date getBirthday() {
return birthday;
}
private static final long serialVersionUID = -94044809860988047L;
String name;
Date birthday;
Date wakeup;
String bio;
String favouriteColor;
List friends;
String bestFriend;
boolean legalAge;
String state;
String region;
File picture;
String pictureContentType;
String pictureFileName;
String favouriteLanguage;
String favouriteVehicalType = "MotorcycleKey";
String favouriteVehicalSpecific = "YamahaKey";
List leftSideCartoonCharacters;
List rightSideCartoonCharacters;
List favouriteLanguages = new ArrayList();
List vehicalTypeList = new ArrayList();
Map vehicalSpecificMap = new HashMap();
String thoughts;
public UITagExample() {
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");
vehicalTypeList.add(car);
vehicalTypeList.add(motorcycle);
List cars = new ArrayList();
cars.add(new VehicalSpecific("MercedesKey", "Mercedes"));
cars.add(new VehicalSpecific("HondaKey", "Honda"));
cars.add(new VehicalSpecific("FordKey", "Ford"));
List motorcycles = new ArrayList();
motorcycles.add(new VehicalSpecific("SuzukiKey", "Suzuki"));
motorcycles.add(new VehicalSpecific("YamahaKey", "Yamaha"));
vehicalSpecificMap.put(car, cars);
vehicalSpecificMap.put(motorcycle, motorcycles);
}
public List getLeftSideCartoonCharacters() {
return leftSideCartoonCharacters;
}
public void setLeftSideCartoonCharacters(List leftSideCartoonCharacters) {
this.leftSideCartoonCharacters = leftSideCartoonCharacters;
}
public List getRightSideCartoonCharacters() {
return rightSideCartoonCharacters;
}
public void setRightSideCartoonCharacters(List rightSideCartoonCharacters) {
this.rightSideCartoonCharacters = rightSideCartoonCharacters;
}
public String getFavouriteVehicalType() {
return favouriteVehicalType;
}
public void setFavouriteVehicalType(String favouriteVehicalType) {
this.favouriteVehicalType = favouriteVehicalType;
}
public String getFavouriteVehicalSpecific() {
return favouriteVehicalSpecific;
}
public void setFavouriteVehicalSpecific(String favouriteVehicalSpecific) {
this.favouriteVehicalSpecific = favouriteVehicalSpecific;
}
public List getVehicalTypeList() {
return vehicalTypeList;
}
public List getVehicalSpecificList() {
ValueStack stack = ServletActionContext.getValueStack(ServletActionContext.getRequest());
Object vehicalType = stack.findValue("top");
if (vehicalType != null && vehicalType instanceof VehicalType) {
List l = (List) vehicalSpecificMap.get(vehicalType);
return l;
}
return Collections.EMPTY_LIST;
}
public List getFavouriteLanguages() {
return favouriteLanguages;
}
public String execute() throws Exception {
return SUCCESS;
}
public String getName() {
return name;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public String getBio() {
return bio;
}
public void setName(String name) {
this.name = name;
}
public void setBio(String bio) {
this.bio = bio;
}
public Date getBirthday() {
return birthday;
}
public String getFavouriteColor() {
return favouriteColor;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public void setFavouriteColor(String favoriteColor) {
this.favouriteColor = favoriteColor;
}
public String getBio() {
return bio;
}
public List getFriends() {
return friends;
}
public void setBio(String bio) {
this.bio = bio;
}
public void setFriends(List friends) {
this.friends = friends;
}
public String getFavouriteColor() {
return favouriteColor;
}
public String getBestFriend() {
return bestFriend;
}
public void setFavouriteColor(String favoriteColor) {
this.favouriteColor = favoriteColor;
}
public void setBestFriend(String bestFriend) {
this.bestFriend = bestFriend;
}
public boolean isLegalAge() {
return legalAge;
}
public List getFriends() {
return friends;
}
public void setLegalAge(boolean legalAge) {
this.legalAge = legalAge;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getRegion() {
return region;
}
public void setRegion(String region) {
this.region = region;
}
public void setPicture(File picture) {
this.picture = picture;
}
public File getPicture() {
return this.picture;
}
public void setPictureContentType(String pictureContentType) {
this.pictureContentType = pictureContentType;
}
public void setPictureFileName(String pictureFileName) {
this.pictureFileName = pictureFileName;
}
public void setFavouriteLanguage(String favouriteLanguage) {
this.favouriteLanguage = favouriteLanguage;
}
public String getFavouriteLanguage() {
return favouriteLanguage;
}
public void setThoughts(String thoughts) {
this.thoughts = thoughts;
}
public String getThoughts() {
return this.thoughts;
}
public Date getWakeup() {
return wakeup;
}
public void setWakeup(Date wakeup) {
this.wakeup = wakeup;
}
public String doSubmit() {
return SUCCESS;
}
// === inner class
public static class Language {
String description;
String key;
public Language(String key, String description) {
this.key = key;
this.description = description;
}
public String getKey() {
return key;
}
public String getDescription() {
return description;
}
}
public static class VehicalType {
String key;
String description;
public VehicalType(String key, String description) {
this.key = key;
this.description = description;
}
public String getKey() { return this.key; }
public String getDescription() { return this.description; }
public boolean equals(Object obj) {
if (! (obj instanceof VehicalType)) {
return false;
}
else {
return key.equals(((VehicalType)obj).getKey());
}
}
public int hashCode() {
return key.hashCode();
}
}
public static class VehicalSpecific {
String key;
String description;
public VehicalSpecific(String key, String description) {
this.key = key;
this.description = description;
}
public String getKey() { return this.key; }
public String getDescription() { return this.description; }
public boolean equals(Object obj) {
if (! (obj instanceof VehicalSpecific)) {
return false;
}
else {
return key.equals(((VehicalSpecific)obj).getKey());
}
}
public int hashCode() {
return key.hashCode();
}
}
public void setFriends(List friends) {
this.friends = friends;
}
public String getBestFriend() {
return bestFriend;
}
public void setBestFriend(String bestFriend) {
this.bestFriend = bestFriend;
}
public boolean isLegalAge() {
return legalAge;
}
public void setLegalAge(boolean legalAge) {
this.legalAge = legalAge;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getRegion() {
return region;
}
public void setRegion(String region) {
this.region = region;
}
public void setPicture(File picture) {
this.picture = picture;
}
public File getPicture() {
return this.picture;
}
public void setPictureContentType(String pictureContentType) {
this.pictureContentType = pictureContentType;
}
public void setPictureFileName(String pictureFileName) {
this.pictureFileName = pictureFileName;
}
public void setFavouriteLanguage(String favouriteLanguage) {
this.favouriteLanguage = favouriteLanguage;
}
public String getFavouriteLanguage() {
return favouriteLanguage;
}
public void setThoughts(String thoughts) {
this.thoughts = thoughts;
}
public String getThoughts() {
return this.thoughts;
}
public Date getWakeup() {
return wakeup;
}
public void setWakeup(Date wakeup) {
this.wakeup = wakeup;
}
public String doSubmit() {
return SUCCESS;
}
// === inner class
public static class Language {
String description;
String key;
String style;
public Language(String key, String description, String style) {
this.key = key;
this.description = description;
this.style = style;
}
public String getKey() {
return key;
}
public String getDescription() {
return description;
}
public String getStyle() {
return style;
}
}
public static class VehicalType {
String key;
String description;
public VehicalType(String key, String description) {
this.key = key;
this.description = description;
}
public String getKey() {
return this.key;
}
public String getDescription() {
return this.description;
}
public boolean equals(Object obj) {
if (!(obj instanceof VehicalType)) {
return false;
} else {
return key.equals(((VehicalType) obj).getKey());
}
}
public int hashCode() {
return key.hashCode();
}
}
public static class VehicalSpecific {
String key;
String description;
public VehicalSpecific(String key, String description) {
this.key = key;
this.description = description;
}
public String getKey() {
return this.key;
}
public String getDescription() {
return this.description;
}
public boolean equals(Object obj) {
if (!(obj instanceof VehicalSpecific)) {
return false;
} else {
return key.equals(((VehicalSpecific) obj).getKey());
}
}
public int hashCode() {
return key.hashCode();
}
}
}
@@ -20,78 +20,76 @@
*/
package org.apache.struts2.showcase.action;
import java.io.Serializable;
import java.util.Collection;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.log4j.Logger;
import org.apache.struts2.showcase.dao.Dao;
import org.apache.struts2.showcase.model.IdEntity;
import com.opensymphony.xwork2.ActionSupport;
import java.io.Serializable;
import java.util.Collection;
/**
* AbstractCRUDAction.
*
*/
public abstract class AbstractCRUDAction extends ActionSupport {
private static final Logger log = Logger.getLogger(AbstractCRUDAction.class);
private static final Logger log = Logger.getLogger(AbstractCRUDAction.class);
private Collection availableItems;
private String[] toDelete;
private Collection availableItems;
private String[] toDelete;
protected abstract Dao getDao();
protected abstract Dao getDao();
public Collection getAvailableItems() {
return availableItems;
}
public Collection getAvailableItems() {
return availableItems;
}
public String[] getToDelete() {
return toDelete;
}
public String[] getToDelete() {
return toDelete;
}
public void setToDelete(String[] toDelete) {
this.toDelete = toDelete;
}
public void setToDelete(String[] toDelete) {
this.toDelete = toDelete;
}
public String list() throws Exception {
this.availableItems = getDao().findAll();
if (log.isDebugEnabled()) {
log.debug("AbstractCRUDAction - [list]: " + (availableItems !=null?""+availableItems.size():"no") + " items found");
}
return execute();
}
public String list() throws Exception {
this.availableItems = getDao().findAll();
if (log.isDebugEnabled()) {
log.debug("AbstractCRUDAction - [list]: " + (availableItems != null ? "" + availableItems.size() : "no") + " items found");
}
return execute();
}
public String delete() throws Exception {
if (toDelete != null) {
int count=0;
for (int i = 0, j=toDelete.length; i < j; i++) {
count = count + getDao().delete(toDelete[i]);
}
if (log.isDebugEnabled()) {
log.debug("AbstractCRUDAction - [delete]: " + count + " items deleted.");
}
}
return SUCCESS;
}
public String delete() throws Exception {
if (toDelete != null) {
int count = 0;
for (int i = 0, j = toDelete.length; i < j; i++) {
count = count + getDao().delete(toDelete[i]);
}
if (log.isDebugEnabled()) {
log.debug("AbstractCRUDAction - [delete]: " + count + " items deleted.");
}
}
return SUCCESS;
}
/**
* Utility method for fetching already persistent object from storage for usage in params-prepare-params cycle.
*
* @param tryId The id to try to get persistent object for
* @param tryObject The object, induced by first params invocation, possibly containing id to try to get persistent
* object for
* @return The persistent object, if found. <tt>null</tt> otherwise.
*/
protected IdEntity fetch(Serializable tryId, IdEntity tryObject) {
IdEntity result = null;
if (tryId != null) {
result = getDao().get(tryId);
} else if (tryObject != null) {
result = getDao().get(tryObject.getId());
}
return result;
}
/**
* Utility method for fetching already persistent object from storage for usage in params-prepare-params cycle.
*
* @param tryId The id to try to get persistent object for
* @param tryObject The object, induced by first params invocation, possibly containing id to try to get persistent
* object for
* @return The persistent object, if found. <tt>null</tt> otherwise.
*/
protected IdEntity fetch(Serializable tryId, IdEntity tryObject) {
IdEntity result = null;
if (tryId != null) {
result = getDao().get(tryId);
} else if (tryObject != null) {
result = getDao().get(tryObject.getId());
}
return result;
}
}
@@ -20,19 +20,19 @@
*/
package org.apache.struts2.showcase.action;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import com.opensymphony.xwork2.Preparable;
import org.apache.log4j.Logger;
import org.apache.struts2.showcase.application.TestDataProvider;
import org.apache.struts2.showcase.dao.Dao;
import org.apache.struts2.showcase.dao.EmployeeDao;
import org.apache.struts2.showcase.model.Employee;
import org.apache.struts2.showcase.model.Skill;
import org.springframework.beans.factory.annotation.Autowired;
import com.opensymphony.xwork2.Preparable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
/**
* JsfEmployeeAction.
@@ -40,87 +40,82 @@ import com.opensymphony.xwork2.Preparable;
public class EmployeeAction extends AbstractCRUDAction implements Preparable {
private static final long serialVersionUID = 7047317819789938957L;
private static final long serialVersionUID = 7047317819789938957L;
private static final Logger log = Logger.getLogger(EmployeeAction.class);
private static final Logger log = Logger.getLogger(EmployeeAction.class);
private Long empId;
protected EmployeeDao employeeDao;
private Employee currentEmployee;
private List selectedSkills;
@Autowired
private EmployeeDao employeeDao;
public Long getEmpId() {
return empId;
}
private Long empId;
private Employee currentEmployee;
private List<String> selectedSkills;
public void setEmpId(Long empId) {
this.empId = empId;
}
public String execute() throws Exception {
if (getCurrentEmployee() != null && getCurrentEmployee().getOtherSkills() != null) {
setSelectedSkills(new ArrayList<String>());
Iterator it = getCurrentEmployee().getOtherSkills().iterator();
while (it.hasNext()) {
getSelectedSkills().add(((Skill) it.next()).getName());
}
}
return super.execute();
}
public Employee getCurrentEmployee() {
return currentEmployee;
}
public String save() throws Exception {
if (getCurrentEmployee() != null) {
setEmpId((Long) employeeDao.merge(getCurrentEmployee()));
employeeDao.setSkills(getEmpId(), getSelectedSkills());
}
return SUCCESS;
}
public void setCurrentEmployee(Employee currentEmployee) {
this.currentEmployee = currentEmployee;
}
public Long getEmpId() {
return empId;
}
public String[] getAvailablePositions() {
return TestDataProvider.POSITIONS;
}
public void setEmpId(Long empId) {
this.empId = empId;
}
public List getAvailableLevels() {
return Arrays.asList(TestDataProvider.LEVELS);
}
public Employee getCurrentEmployee() {
return currentEmployee;
}
public List getSelectedSkills() {
return selectedSkills;
}
public void setCurrentEmployee(Employee currentEmployee) {
this.currentEmployee = currentEmployee;
}
public void setSelectedSkills(List selectedSkills) {
this.selectedSkills = selectedSkills;
}
public String[] getAvailablePositions() {
return TestDataProvider.POSITIONS;
}
protected Dao getDao() {
return employeeDao;
}
public List getAvailableLevels() {
return Arrays.asList(TestDataProvider.LEVELS);
}
public void setEmployeeDao(EmployeeDao employeeDao) {
if (log.isDebugEnabled()) {
log.debug("JsfEmployeeAction - [setEmployeeDao]: employeeDao injected.");
}
this.employeeDao = employeeDao;
}
public List<String> getSelectedSkills() {
return selectedSkills;
}
/**
* This method is called to allow the action to prepare itself.
*
* @throws Exception thrown if a system level exception occurs.
*/
public void prepare() throws Exception {
Employee preFetched = (Employee) fetch(getEmpId(), getCurrentEmployee());
if (preFetched != null) {
setCurrentEmployee(preFetched);
}
}
public void setSelectedSkills(List<String> selectedSkills) {
this.selectedSkills = selectedSkills;
}
public String execute() throws Exception {
if (getCurrentEmployee() != null && getCurrentEmployee().getOtherSkills() != null) {
setSelectedSkills(new ArrayList());
Iterator it = getCurrentEmployee().getOtherSkills().iterator();
while (it.hasNext()) {
getSelectedSkills().add(((Skill) it.next()).getName());
}
}
return super.execute();
}
protected Dao getDao() {
return employeeDao;
}
public String save() throws Exception {
if (getCurrentEmployee() != null) {
setEmpId((Long) employeeDao.merge(getCurrentEmployee()));
employeeDao.setSkills(getEmpId(), getSelectedSkills());
}
return SUCCESS;
}
/**
* This method is called to allow the action to prepare itself.
*
* @throws Exception thrown if a system level exception occurs.
*/
public void prepare() throws Exception {
Employee preFetched = (Employee) fetch(getEmpId(), getCurrentEmployee());
if (preFetched != null) {
setCurrentEmployee(preFetched);
}
}
}
@@ -20,69 +20,65 @@
*/
package org.apache.struts2.showcase.action;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.opensymphony.xwork2.ActionSupport;
import java.util.*;
public class ExampleAction extends ActionSupport {
public static final String CONSTANT = "Struts Rocks!";
public static Date getCurrentDate() {
return new Date();
}
public String getName() {
return "John Galt";
}
public static final String CONSTANT = "Struts Rocks!";
public String[] getBands() {
return new String[] { "Pink Floyd", "Metallica", "Guns & Roses" };
}
public static Date getCurrentDate() {
return new Date();
}
public List<String> getMovies() {
return Arrays.asList("Lord of the Rings", "Matrix");
}
public String getName() {
return "John Galt";
}
public Book getBook() {
return new Book("Iliad", "Homer");
}
public String[] getBands() {
return new String[]{"Pink Floyd", "Metallica", "Guns & Roses"};
}
public Map<String, Book> getBooks() {
Map<String, Book> books = new HashMap<String, Book>();
books.put("Iliad", new Book("Iliad", "Homer"));
books.put("The Republic", new Book("The Replublic", "Plato"));
books.put("Thus Spake Zarathustra", new Book("Thus Spake Zarathustra",
"Friedrich Nietzsche"));
return books;
}
public List<String> getMovies() {
return Arrays.asList("Lord of the Rings", "Matrix");
}
public Book getBook() {
return new Book("Iliad", "Homer");
}
public Map<String, Book> getBooks() {
Map<String, Book> books = new HashMap<String, Book>();
books.put("Iliad", new Book("Iliad", "Homer"));
books.put("The Republic", new Book("The Replublic", "Plato"));
books.put("Thus Spake Zarathustra", new Book("Thus Spake Zarathustra",
"Friedrich Nietzsche"));
return books;
}
}
class Book {
private String title;
private String author;
private String title;
private String author;
public Book(String title, String author) {
this.title = title;
this.author = author;
}
public Book(String title, String author) {
this.title = title;
this.author = author;
}
public String getTitle() {
return title;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public void setTitle(String title) {
this.title = title;
}
public String getAuthor() {
return author;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public void setAuthor(String author) {
this.author = author;
}
}
@@ -20,58 +20,52 @@
*/
package org.apache.struts2.showcase.action;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.net.URL;
import org.apache.struts2.ServletActionContext;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.interceptor.annotations.After;
import org.apache.struts2.ServletActionContext;
import java.io.*;
import java.net.URL;
/**
* Will only work on containers that unzip war files
*
*/
public class JSPEvalAction extends ExampleAction {
private String jsp;
private final static String FILE = "/interactive/demo.jsp";
private String jsp;
private final static String FILE = "/interactive/demo.jsp";
public String execute() throws IOException {
if (jsp != null) {
//write it to file
URL url = ServletActionContext.getServletContext().getResource(FILE);
BufferedWriter writer = new BufferedWriter(new FileWriter(new File(url
.getFile())));
try {
//directive
writer.write("<%@ taglib prefix=\"s\" uri=\"/struts-tags\" %>");
writer.write(jsp);
} finally {
if (writer != null)
writer.close();
}
}
return Action.SUCCESS;
}
public String execute() throws IOException {
if (jsp != null) {
//write it to file
URL url = ServletActionContext.getServletContext().getResource(FILE);
BufferedWriter writer = new BufferedWriter(new FileWriter(new File(url
.getFile())));
try {
//directive
writer.write("<%@ taglib prefix=\"s\" uri=\"/struts-tags\" %>");
writer.write(jsp);
} finally {
if (writer != null)
writer.close();
}
}
return Action.SUCCESS;
}
@After
public void cleanUp() throws IOException {
URL url = ServletActionContext.getServletContext().getResource(FILE);
FileOutputStream out = new FileOutputStream(new File(url.getFile()));
try {
out.getChannel().truncate(0);
} finally {
if (out != null)
out.close();
}
}
@After
public void cleanUp() throws IOException {
URL url = ServletActionContext.getServletContext().getResource(FILE);
FileOutputStream out = new FileOutputStream(new File(url.getFile()));
try {
out.getChannel().truncate(0);
} finally {
if (out != null)
out.close();
}
}
public void setJsp(String jsp) {
this.jsp = jsp;
}
public void setJsp(String jsp) {
this.jsp = jsp;
}
}
@@ -20,70 +20,64 @@
*/
package org.apache.struts2.showcase.action;
import com.opensymphony.xwork2.Preparable;
import org.apache.log4j.Logger;
import org.apache.struts2.showcase.dao.Dao;
import org.apache.struts2.showcase.dao.SkillDao;
import org.apache.struts2.showcase.model.Skill;
import com.opensymphony.xwork2.Preparable;
import org.springframework.beans.factory.annotation.Autowired;
/**
* SkillAction.
*
*/
public class SkillAction extends AbstractCRUDAction implements Preparable {
private static final Logger log = Logger.getLogger(SkillAction.class);
private static final Logger log = Logger.getLogger(SkillAction.class);
private String skillName;
protected SkillDao skillDao;
private Skill currentSkill;
@Autowired
private SkillDao skillDao;
public String getSkillName() {
return skillName;
}
private String skillName;
private Skill currentSkill;
public void setSkillName(String skillName) {
this.skillName = skillName;
}
/**
* This method is called to allow the action to prepare itself.
*
* @throws Exception thrown if a system level exception occurs.
*/
public void prepare() throws Exception {
Skill preFetched = (Skill) fetch(getSkillName(), getCurrentSkill());
if (preFetched != null) {
setCurrentSkill(preFetched);
}
}
protected Dao getDao() {
return skillDao;
}
public String save() throws Exception {
if (getCurrentSkill() != null) {
setSkillName((String) skillDao.merge(getCurrentSkill()));
}
return SUCCESS;
}
public void setSkillDao(SkillDao skillDao) {
if (log.isDebugEnabled()) {
log.debug("SkillAction - [setSkillDao]: skillDao injected.");
}
this.skillDao = skillDao;
}
public String getSkillName() {
return skillName;
}
public Skill getCurrentSkill() {
return currentSkill;
}
public void setSkillName(String skillName) {
this.skillName = skillName;
}
public void setCurrentSkill(Skill currentSkill) {
this.currentSkill = currentSkill;
}
protected Dao getDao() {
return skillDao;
}
/**
* This method is called to allow the action to prepare itself.
*
* @throws Exception thrown if a system level exception occurs.
*/
public void prepare() throws Exception {
Skill preFetched = (Skill) fetch(getSkillName(), getCurrentSkill());
if (preFetched != null) {
setCurrentSkill(preFetched);
}
}
public Skill getCurrentSkill() {
return currentSkill;
}
public String save() throws Exception {
if (getCurrentSkill() != null) {
setSkillName((String) skillDao.merge(getCurrentSkill()));
}
return SUCCESS;
}
public void setCurrentSkill(Skill currentSkill) {
this.currentSkill = currentSkill;
}
}
@@ -22,24 +22,21 @@ package org.apache.struts2.showcase.actionchaining;
import com.opensymphony.xwork2.ActionSupport;
/**
*
*/
public class ActionChain1 extends ActionSupport {
private static final long serialVersionUID = -6811701750042275153L;
private static final long serialVersionUID = -6811701750042275153L;
private String actionChain1Property1 = "Property Set In Action Chain 1";
private String actionChain1Property1 = "Property Set In Action Chain 1";
public String getActionChain1Property1() {
return actionChain1Property1;
}
public void setActionChain1Property1(String actionChain1Property1) {
this.actionChain1Property1 = actionChain1Property1;
}
public String input() throws Exception {
return SUCCESS;
}
public String getActionChain1Property1() {
return actionChain1Property1;
}
public String input() throws Exception {
return SUCCESS;
}
public void setActionChain1Property1(String actionChain1Property1) {
this.actionChain1Property1 = actionChain1Property1;
}
}
@@ -22,37 +22,31 @@ package org.apache.struts2.showcase.actionchaining;
import com.opensymphony.xwork2.ActionSupport;
/**
*
*/
public class ActionChain2 extends ActionSupport {
private static final long serialVersionUID = 3951745956044674809L;
private static final long serialVersionUID = 3951745956044674809L;
private String actionChain1Property1;
private String actionChain2Property1 = "Property Set in Action Chain 2";
private String actionChain1Property1;
private String actionChain2Property1 = "Property Set in Action Chain 2";
public String execute() throws Exception {
return SUCCESS;
}
public String getActionChain1Property1() {
return actionChain1Property1;
}
public void setActionChain1Property1(String actionChain1Property1) {
this.actionChain1Property1 = actionChain1Property1;
}
public String getActionChain1Property1() {
return actionChain1Property1;
}
public void setActionChain1Property1(String actionChain1Property1) {
this.actionChain1Property1 = actionChain1Property1;
}
public String getActionChain2Property1() {
return actionChain2Property1;
}
public String getActionChain2Property1() {
return actionChain2Property1;
}
public void setActionChain2Property1(String actionChain2Property1) {
this.actionChain2Property1 = actionChain2Property1;
}
public String execute() throws Exception {
return SUCCESS;
}
public void setActionChain2Property1(String actionChain2Property1) {
this.actionChain2Property1 = actionChain2Property1;
}
}
@@ -22,47 +22,42 @@ package org.apache.struts2.showcase.actionchaining;
import com.opensymphony.xwork2.ActionSupport;
/**
*
*/
public class ActionChain3 extends ActionSupport {
private static final long serialVersionUID = -1456568865075250621L;
private static final long serialVersionUID = -1456568865075250621L;
private String actionChain1Property1;
private String actionChain2Property1;
private String actionChain3Property1 = "Property set in Action Chain 3";
private String actionChain1Property1;
private String actionChain2Property1;
private String actionChain3Property1 = "Property set in Action Chain 3";
public String getActionChain1Property1() {
return actionChain1Property1;
}
public void setActionChain1Property1(String actionChain1Property1) {
this.actionChain1Property1 = actionChain1Property1;
}
public String execute() throws Exception {
return SUCCESS;
}
public String getActionChain1Property1() {
return actionChain1Property1;
}
public void setActionChain1Property1(String actionChain1Property1) {
this.actionChain1Property1 = actionChain1Property1;
}
public String getActionChain2Property1() {
return actionChain2Property1;
}
public String getActionChain2Property1() {
return actionChain2Property1;
}
public void setActionChain2Property1(String actionChain2Property1) {
this.actionChain2Property1 = actionChain2Property1;
}
public void setActionChain2Property1(String actionChain2Property1) {
this.actionChain2Property1 = actionChain2Property1;
}
public String getActionChain3Property1() {
return actionChain3Property1;
}
public String getActionChain3Property1() {
return actionChain3Property1;
}
public void setActionChain3Property1(String actionChain3Property1) {
this.actionChain3Property1 = actionChain3Property1;
}
public String execute() throws Exception {
return SUCCESS;
}
public void setActionChain3Property1(String actionChain3Property1) {
this.actionChain3Property1 = actionChain3Property1;
}
}
@@ -25,30 +25,28 @@ import com.opensymphony.xwork2.Action;
import java.io.Serializable;
/**
*/
public class AjaxTestAction implements Action, Serializable {
private static int counter = 0;
private String data;
private static int counter = 0;
private String data;
public long getServerTime() {
return System.currentTimeMillis();
}
public String execute() throws Exception {
return SUCCESS;
}
public int getCount() {
return ++counter;
}
public long getServerTime() {
return System.currentTimeMillis();
}
public String getData() {
return data;
}
public int getCount() {
return ++counter;
}
public void setData(String data) {
this.data = data;
}
public String getData() {
return data;
}
public String execute() throws Exception {
return SUCCESS;
}
public void setData(String data) {
this.data = data;
}
}
@@ -20,40 +20,40 @@
*/
package org.apache.struts2.showcase.ajax;
import com.opensymphony.xwork2.ActionSupport;
import java.util.ArrayList;
import java.util.List;
import com.opensymphony.xwork2.ActionSupport;
public class AutocompleterExampleAction extends ActionSupport {
private String select;
private List<String> options = new ArrayList<String>();
private String select;
private List<String> options = new ArrayList<String>();
private static final long serialVersionUID = -8481638176160014396L;
private static final long serialVersionUID = -8481638176160014396L;
public String execute() throws Exception {
if ("fruits".equals(select)) {
options.add("apple");
options.add("banana");
options.add("grape");
options.add("pear");
} else if ("colors".equals(select)) {
options.add("red");
options.add("green");
options.add("blue");
}
return SUCCESS;
}
public String execute() throws Exception {
if ("fruits".equals(select)) {
options.add("apple");
options.add("banana");
options.add("grape");
options.add("pear");
} else if ("colors".equals(select)) {
options.add("red");
options.add("green");
options.add("blue");
}
return SUCCESS;
}
public String getSelect() {
return select;
}
public String getSelect() {
return select;
}
public void setSelect(String select) {
this.select = select;
}
public void setSelect(String select) {
this.select = select;
}
public List<String> getOptions() {
return options;
}
public List<String> getOptions() {
return options;
}
}
@@ -20,56 +20,56 @@
*/
package org.apache.struts2.showcase.ajax;
import com.opensymphony.xwork2.ActionSupport;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.opensymphony.xwork2.ActionSupport;
/**
* @version $Date$ $Id$
*/
public class Example4ShowPanelAction extends ActionSupport {
private String name;
private String gender;
private String name;
private String gender;
private static final long serialVersionUID = 7751976335066456596L;
private static final long serialVersionUID = 7751976335066456596L;
public String panel1() throws Exception {
return SUCCESS;
}
public String panel1() throws Exception {
return SUCCESS;
}
public String panel2() throws Exception {
return SUCCESS;
}
public String panel2() throws Exception {
return SUCCESS;
}
public String panel3() throws Exception {
return SUCCESS;
}
public String panel3() throws Exception {
return SUCCESS;
}
public String getGender() {
return gender;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getName() {
return name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public void setName(String name) {
this.name = name;
}
public String getTodayDate() {
SimpleDateFormat sdf = new SimpleDateFormat("dd-MMMM-yyyy");
return sdf.format(new Date());
}
public String getTodayDate() {
SimpleDateFormat sdf = new SimpleDateFormat("dd-MMMM-yyyy");
return sdf.format(new Date());
}
public String getTodayTime() {
SimpleDateFormat sdf = new SimpleDateFormat("kk:mm:ss");
return sdf.format(new Date());
}
public String getTodayTime() {
SimpleDateFormat sdf = new SimpleDateFormat("kk:mm:ss");
return sdf.format(new Date());
}
}
@@ -24,20 +24,28 @@ import com.opensymphony.xwork2.ActionSupport;
public class Example5Action extends ActionSupport {
private static final long serialVersionUID = 2111967621952300611L;
private static final long serialVersionUID = 2111967621952300611L;
private String name;
private Integer age;
private String name;
private Integer age;
public String execute() throws Exception {
return SUCCESS;
}
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public String getName() {
return name;
}
public Integer getAge() { return age; }
public void setAge(Integer age) { this.age = age; }
public void setName(String name) {
this.name = name;
}
@Override
public String execute() throws Exception {
return SUCCESS;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
}
@@ -28,77 +28,77 @@ import java.util.Map;
/**
*/
public class Category {
private static Map<Long, Category> catMap = new HashMap<Long, Category>();
private static Map<Long, Category> catMap = new HashMap<Long, Category>();
static {
new Category(1, "Root",
new Category(2, "Java",
new Category(3, "Web Frameworks",
new Category(4, "Struts"),
new Category(7, "Stripes"),
new Category(8, "Rife")),
new Category(9, "Persistence",
new Category(10, "iBatis"),
new Category(11, "Hibernate"),
new Category(12, "JDO"),
new Category(13, "JDBC"))),
new Category(14, "JavaScript",
new Category(15, "Dojo"),
new Category(16, "Prototype"),
new Category(17, "Scriptaculous"),
new Category(18, "OpenRico"),
new Category(19, "DWR")));
}
static {
new Category(1, "Root",
new Category(2, "Java",
new Category(3, "Web Frameworks",
new Category(4, "Struts"),
new Category(7, "Stripes"),
new Category(8, "Rife")),
new Category(9, "Persistence",
new Category(10, "iBatis"),
new Category(11, "Hibernate"),
new Category(12, "JDO"),
new Category(13, "JDBC"))),
new Category(14, "JavaScript",
new Category(15, "Dojo"),
new Category(16, "Prototype"),
new Category(17, "Scriptaculous"),
new Category(18, "OpenRico"),
new Category(19, "DWR")));
}
public static Category getById(long id) {
return catMap.get(id);
}
public static Category getById(long id) {
return catMap.get(id);
}
private long id;
private String name;
private List<Category> children;
private boolean toggle;
private long id;
private String name;
private List<Category> children;
private boolean toggle;
public Category(long id, String name, Category... children) {
this.id = id;
this.name = name;
this.children = new ArrayList<Category>();
for (Category child : children) {
this.children.add(child);
}
public Category(long id, String name, Category... children) {
this.id = id;
this.name = name;
this.children = new ArrayList<Category>();
for (Category child : children) {
this.children.add(child);
}
catMap.put(id, this);
}
catMap.put(id, this);
}
public long getId() {
return id;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public void setName(String name) {
this.name = name;
}
public List<Category> getChildren() {
return children;
}
public List<Category> getChildren() {
return children;
}
public void setChildren(List<Category> children) {
this.children = children;
}
public void setChildren(List<Category> children) {
this.children = children;
}
public void toggle() {
toggle = !toggle;
}
public void toggle() {
toggle = !toggle;
}
public boolean isToggle() {
return toggle;
}
public boolean isToggle() {
return toggle;
}
}
@@ -25,25 +25,25 @@ import com.opensymphony.xwork2.ActionSupport;
/**
*/
public class GetCategory extends ActionSupport {
private long catId;
private Category category;
private long catId;
private Category category;
public String execute() throws Exception {
if (catId < 1) {
// force the root
catId = 1;
}
public String execute() throws Exception {
if (catId < 1) {
// force the root
catId = 1;
}
category = Category.getById(catId);
category = Category.getById(catId);
return SUCCESS;
}
return SUCCESS;
}
public void setCatId(long catId) {
this.catId = catId;
}
public void setCatId(long catId) {
this.catId = catId;
}
public Category getCategory() {
return category;
}
public Category getCategory() {
return category;
}
}
@@ -24,11 +24,11 @@ package org.apache.struts2.showcase.ajax.tree;
/**
*/
public class Toggle extends GetCategory {
public String execute() throws Exception {
super.execute();
public String execute() throws Exception {
super.execute();
getCategory().toggle();
getCategory().toggle();
return SUCCESS;
}
return SUCCESS;
}
}
@@ -20,123 +20,126 @@
*/
package org.apache.struts2.showcase.application;
import org.apache.struts2.showcase.exception.CreateException;
import org.apache.struts2.showcase.exception.DuplicateKeyException;
import org.apache.struts2.showcase.exception.StorageException;
import org.apache.struts2.showcase.exception.UpdateException;
import org.apache.struts2.showcase.model.IdEntity;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Repository;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import org.apache.struts2.showcase.exception.CreateException;
import org.apache.struts2.showcase.exception.DuplicateKeyException;
import org.apache.struts2.showcase.exception.StorageException;
import org.apache.struts2.showcase.exception.UpdateException;
import org.apache.struts2.showcase.model.IdEntity;
/**
* MemoryStorage.
* Very simple in-memory persistence emulation.
*
*/
@Repository
@Scope("singleton")
public class MemoryStorage implements Storage {
private static final long serialVersionUID = 8611213748834904125L;
private static final long serialVersionUID = 8611213748834904125L;
private Map memory = new HashMap();
private Map memory = new HashMap();
private Map getEntityMap ( Class entityClass ) {
if (entityClass != null) {
Map tryMap = (Map) memory.get(entityClass);
if (tryMap == null) {
synchronized(memory) {
tryMap = new HashMap();
memory.put(entityClass, tryMap);
}
}
return tryMap;
} else {
return null;
}
}
private Map getEntityMap(Class entityClass) {
if (entityClass != null) {
Map tryMap = (Map) memory.get(entityClass);
if (tryMap == null) {
synchronized (memory) {
tryMap = new HashMap();
memory.put(entityClass, tryMap);
}
}
return tryMap;
} else {
return null;
}
}
private IdEntity intStore( Class entityClass, IdEntity object ) {
getEntityMap(entityClass).put(object.getId(), object);
return object;
}
private IdEntity intStore(Class entityClass, IdEntity object) {
getEntityMap(entityClass).put(object.getId(), object);
return object;
}
public IdEntity get( Class entityClass, Serializable id ) {
if (entityClass != null && id != null) {
return (IdEntity) getEntityMap(entityClass).get(id);
} else {
return null;
}
}
public IdEntity get(Class entityClass, Serializable id) {
if (entityClass != null && id != null) {
return (IdEntity) getEntityMap(entityClass).get(id);
} else {
return null;
}
}
public Serializable create ( IdEntity object ) throws CreateException {
if (object == null) {
throw new CreateException("Either given class or object was null");
}
if (object.getId() == null) {
throw new CreateException("Cannot store object with null id");
}
if (get(object.getClass(), object.getId()) != null) {
throw new DuplicateKeyException("Object with this id already exists.");
}
return intStore(object.getClass(), object).getId();
}
public Serializable create(IdEntity object) throws CreateException {
if (object == null) {
throw new CreateException("Either given class or object was null");
}
if (object.getId() == null) {
throw new CreateException("Cannot store object with null id");
}
if (get(object.getClass(), object.getId()) != null) {
throw new DuplicateKeyException("Object with this id already exists.");
}
return intStore(object.getClass(), object).getId();
}
public IdEntity update ( IdEntity object ) throws UpdateException {
if (object == null) {
throw new UpdateException("Cannot update null object.");
}
if ( get(object.getClass(), object.getId())==null ) {
throw new UpdateException("Object to update not found.");
}
return intStore(object.getClass(), object);
}
public IdEntity update(IdEntity object) throws UpdateException {
if (object == null) {
throw new UpdateException("Cannot update null object.");
}
if (get(object.getClass(), object.getId()) == null) {
throw new UpdateException("Object to update not found.");
}
return intStore(object.getClass(), object);
}
public Serializable merge ( IdEntity object ) throws StorageException {
if (object == null) {
throw new StorageException("Cannot merge null object");
}
if (object.getId() == null || get(object.getClass(), object.getId())==null) {
return create(object);
} else {
return update(object).getId();
}
}
public Serializable merge(IdEntity object) throws StorageException {
if (object == null) {
throw new StorageException("Cannot merge null object");
}
if (object.getId() == null || get(object.getClass(), object.getId()) == null) {
return create(object);
} else {
return update(object).getId();
}
}
public int delete( Class entityClass, Serializable id ) throws CreateException {
try {
if (get(entityClass, id) != null) {
getEntityMap(entityClass).remove(id);
return 1;
} else {
return 0;
}
} catch (Exception e) {
throw new CreateException(e);
}
}
public int delete(Class entityClass, Serializable id) throws CreateException {
try {
if (get(entityClass, id) != null) {
getEntityMap(entityClass).remove(id);
return 1;
} else {
return 0;
}
} catch (Exception e) {
throw new CreateException(e);
}
}
public int delete( IdEntity object ) throws CreateException {
if (object == null) {
throw new CreateException("Cannot delete null object");
}
return delete(object.getClass(), object.getId());
}
public int delete(IdEntity object) throws CreateException {
if (object == null) {
throw new CreateException("Cannot delete null object");
}
return delete(object.getClass(), object.getId());
}
public Collection findAll( Class entityClass ) {
if (entityClass != null) {
return getEntityMap(entityClass).values();
} else {
return new ArrayList();
}
}
public Collection findAll(Class entityClass) {
if (entityClass != null) {
return getEntityMap(entityClass).values();
} else {
return new ArrayList();
}
}
public void reset() {
this.memory = new HashMap();
}
public void reset() {
this.memory = new HashMap();
}
}
@@ -20,31 +20,30 @@
*/
package org.apache.struts2.showcase.application;
import java.io.Serializable;
import java.util.Collection;
import org.apache.struts2.showcase.exception.CreateException;
import org.apache.struts2.showcase.exception.StorageException;
import org.apache.struts2.showcase.exception.UpdateException;
import org.apache.struts2.showcase.model.IdEntity;
import java.io.Serializable;
import java.util.Collection;
/**
* Storage. Interface.
*
*/
public interface Storage extends Serializable {
IdEntity get( Class entityClass, Serializable id );
IdEntity get(Class entityClass, Serializable id);
Serializable create ( IdEntity object ) throws CreateException;
Serializable create(IdEntity object) throws CreateException;
IdEntity update ( IdEntity object ) throws UpdateException;
IdEntity update(IdEntity object) throws UpdateException;
Serializable merge ( IdEntity object ) throws StorageException;
Serializable merge(IdEntity object) throws StorageException;
int delete( Class entityClass, Serializable id ) throws CreateException;
int delete(Class entityClass, Serializable id) throws CreateException;
int delete( IdEntity object ) throws CreateException;
int delete(IdEntity object) throws CreateException;
Collection findAll( Class entityClass );
Collection findAll(Class entityClass);
}
@@ -20,10 +20,6 @@
*/
package org.apache.struts2.showcase.application;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Date;
import org.apache.log4j.Logger;
import org.apache.struts2.showcase.dao.EmployeeDao;
import org.apache.struts2.showcase.dao.SkillDao;
@@ -31,88 +27,87 @@ import org.apache.struts2.showcase.exception.StorageException;
import org.apache.struts2.showcase.model.Employee;
import org.apache.struts2.showcase.model.Skill;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Date;
/**
* TestDataProvider.
*
*/
@Service
public class TestDataProvider implements Serializable, InitializingBean {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
private static final Logger log = Logger.getLogger(TestDataProvider.class);
private static final Logger log = Logger.getLogger(TestDataProvider.class);
public static final String[] POSITIONS = {
"Developer",
"System Architect",
"Sales Manager",
"CEO"
};
public static final String[] POSITIONS = {
"Developer",
"System Architect",
"Sales Manager",
"CEO"
};
public static final String[] LEVELS = {
"Junior",
"Senior",
"Master"
};
public static final String[] LEVELS = {
"Junior",
"Senior",
"Master"
};
private static final Skill[] TEST_SKILLS = {
new Skill("WW-SEN", "Struts Senior Developer"),
new Skill("WW-JUN", "Struts Junior Developer"),
new Skill("SPRING-DEV", "Spring Developer")
};
private static final Skill[] TEST_SKILLS = {
new Skill("WW-SEN", "Struts Senior Developer"),
new Skill("WW-JUN", "Struts Junior Developer"),
new Skill("SPRING-DEV", "Spring Developer")
};
public static final Employee[] TEST_EMPLOYEES = {
new Employee(new Long(1), "Alan", "Smithee", new Date(), new Float(2000f), true, POSITIONS[0],
TEST_SKILLS[0], null, "alan", LEVELS[0], "Nice guy"),
new Employee(new Long(2), "Robert", "Robson", new Date(), new Float(10000f), false, POSITIONS[1],
TEST_SKILLS[1], Arrays.asList(TEST_SKILLS).subList(1, TEST_SKILLS.length), "rob", LEVELS[1], "Smart guy")
};
public static final Employee[] TEST_EMPLOYEES = {
new Employee(new Long(1), "Alan", "Smithee", new Date(), new Float(2000f), true, POSITIONS[0],
TEST_SKILLS[0], null, "alan", LEVELS[0], "Nice guy"),
new Employee(new Long(2), "Robert", "Robson", new Date(), new Float(10000f), false, POSITIONS[1],
TEST_SKILLS[1], Arrays.asList(TEST_SKILLS).subList(1,TEST_SKILLS.length), "rob", LEVELS[1], "Smart guy")
};
@Autowired
private SkillDao skillDao;
private SkillDao skillDao;
private EmployeeDao employeeDao;
@Autowired
private EmployeeDao employeeDao;
public void setSkillDao(SkillDao skillDao) {
this.skillDao = skillDao;
}
protected void addTestSkills() {
try {
for (int i = 0, j = TEST_SKILLS.length; i < j; i++) {
skillDao.merge(TEST_SKILLS[i]);
}
if (log.isInfoEnabled()) {
log.info("TestDataProvider - [addTestSkills]: Added test skill data.");
}
} catch (StorageException e) {
log.error("TestDataProvider - [addTestSkills]: Exception catched: " + e.getMessage());
}
}
public void setEmployeeDao(EmployeeDao employeeDao) {
this.employeeDao = employeeDao;
}
protected void addTestEmployees() {
try {
for (int i = 0, j = TEST_EMPLOYEES.length; i < j; i++) {
employeeDao.merge(TEST_EMPLOYEES[i]);
}
if (log.isInfoEnabled()) {
log.info("TestDataProvider - [addTestEmployees]: Added test employee data.");
}
} catch (StorageException e) {
log.error("TestDataProvider - [addTestEmployees]: Exception catched: " + e.getMessage());
}
}
protected void addTestSkills() {
try {
for (int i = 0, j = TEST_SKILLS.length; i < j; i++) {
skillDao.merge(TEST_SKILLS[i]);
}
if (log.isInfoEnabled()) {
log.info("TestDataProvider - [addTestSkills]: Added test skill data.");
}
} catch (StorageException e) {
log.error("TestDataProvider - [addTestSkills]: Exception catched: " + e.getMessage());
}
}
protected void addTestData() {
addTestSkills();
addTestEmployees();
}
protected void addTestEmployees() {
try {
for (int i = 0, j = TEST_EMPLOYEES.length; i < j; i++) {
employeeDao.merge(TEST_EMPLOYEES[i]);
}
if (log.isInfoEnabled()) {
log.info("TestDataProvider - [addTestEmployees]: Added test employee data.");
}
} catch (StorageException e) {
log.error("TestDataProvider - [addTestEmployees]: Exception catched: " + e.getMessage());
}
}
protected void addTestData() {
addTestSkills();
addTestEmployees();
}
public void afterPropertiesSet() throws Exception {
addTestData();
}
public void afterPropertiesSet() throws Exception {
addTestData();
}
}
@@ -21,40 +21,37 @@
package org.apache.struts2.showcase.chat;
import org.apache.struts2.dispatcher.SessionMap;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import org.apache.struts2.dispatcher.SessionMap;
public class ChatAuthenticationInterceptor implements Interceptor {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
private static final Logger LOG = LoggerFactory.getLogger(ChatAuthenticationInterceptor.class);
public static final String USER_SESSION_KEY = "chatUserSessionKey";
private static final Logger LOG = LoggerFactory.getLogger(ChatAuthenticationInterceptor.class);
public void destroy() {
}
public static final String USER_SESSION_KEY = "chatUserSessionKey";
public void init() {
}
public void destroy() {
}
public String intercept(ActionInvocation invocation) throws Exception {
public void init() {
}
LOG.debug("Authenticating chat user");
public String intercept(ActionInvocation invocation) throws Exception {
SessionMap session = (SessionMap) ActionContext.getContext().get(ActionContext.SESSION);
User user = (User) session.get(USER_SESSION_KEY);
LOG.debug("Authenticating chat user");
SessionMap session = (SessionMap) ActionContext.getContext().get(ActionContext.SESSION);
User user = (User) session.get(USER_SESSION_KEY);
if (user == null) {
return Action.LOGIN;
}
return invocation.invoke();
}
if (user == null) {
return Action.LOGIN;
}
return invocation.invoke();
}
}
@@ -22,15 +22,15 @@ package org.apache.struts2.showcase.chat;
public class ChatException extends RuntimeException {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
public enum ErrorType {
ROOM_ALREADY_EXISTS,
USER_ALREADY_EXISTS,
NO_SUCH_ROOM_EXISTS
}
public enum ErrorType {
ROOM_ALREADY_EXISTS,
USER_ALREADY_EXISTS,
NO_SUCH_ROOM_EXISTS
}
public ChatException(String description, ErrorType type) {
super(description);
}
public ChatException(String description, ErrorType type) {
super(description);
}
}
@@ -20,8 +20,6 @@
*/
package org.apache.struts2.showcase.chat;
import javax.servlet.http.HttpSession;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
@@ -29,32 +27,34 @@ import com.opensymphony.xwork2.interceptor.Interceptor;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import javax.servlet.http.HttpSession;
/**
* Authenticate showcase chat example, make sure everyone have a username.
*/
public class ChatInterceptor implements Interceptor {
private static final Logger LOG = LoggerFactory.getLogger(ChatInterceptor.class);
private static final Logger LOG = LoggerFactory.getLogger(ChatInterceptor.class);
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
public static final String CHAT_USER_SESSION_KEY = "ChatUserSessionKey";
public static final String CHAT_USER_SESSION_KEY = "ChatUserSessionKey";
public void destroy() {
}
public void destroy() {
}
public void init() {
}
public void init() {
}
public String intercept(ActionInvocation invocation) throws Exception {
HttpSession session = (HttpSession) ActionContext.getContext().get(ActionContext.SESSION);
User chatUser = (User) session.getAttribute(CHAT_USER_SESSION_KEY);
if (chatUser == null) {
LOG.debug("Chat user not logged in");
return Action.LOGIN;
}
return invocation.invoke();
}
public String intercept(ActionInvocation invocation) throws Exception {
HttpSession session = (HttpSession) ActionContext.getContext().get(ActionContext.SESSION);
User chatUser = (User) session.getAttribute(CHAT_USER_SESSION_KEY);
if (chatUser == null) {
LOG.debug("Chat user not logged in");
return Action.LOGIN;
}
return invocation.invoke();
}
}
@@ -20,49 +20,48 @@
*/
package org.apache.struts2.showcase.chat;
import java.util.Map;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.interceptor.SessionAware;
import com.opensymphony.xwork2.ActionSupport;
import java.util.Map;
public class ChatLoginAction extends ActionSupport implements SessionAware {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
private ChatService chatService;
private Map session;
private ChatService chatService;
private Map session;
private String name;
private String name;
public ChatLoginAction(ChatService chatService) {
this.chatService = chatService;
}
public ChatLoginAction(ChatService chatService) {
this.chatService = chatService;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String execute() throws Exception {
try {
chatService.login(new User(name));
session.put(ChatAuthenticationInterceptor.USER_SESSION_KEY, new User(name));
}
catch(ChatException e) {
e.printStackTrace();
addActionError(e.getMessage());
return INPUT;
}
return SUCCESS;
}
public String execute() throws Exception {
try {
chatService.login(new User(name));
session.put(ChatAuthenticationInterceptor.USER_SESSION_KEY, new User(name));
} catch (ChatException e) {
e.printStackTrace();
addActionError(e.getMessage());
return INPUT;
}
return SUCCESS;
}
// === SessionAware ===
public void setSession(Map session) {
this.session = session;
}
// === SessionAware ===
public void setSession(Map session) {
this.session = session;
}
}
@@ -20,39 +20,38 @@
*/
package org.apache.struts2.showcase.chat;
import java.util.Map;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.interceptor.SessionAware;
import com.opensymphony.xwork2.ActionSupport;
import java.util.Map;
public class ChatLogoutAction extends ActionSupport implements SessionAware {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
private ChatService chatService;
private ChatService chatService;
private Map session;
private Map session;
public ChatLogoutAction(ChatService chatService) {
this.chatService = chatService;
}
public ChatLogoutAction(ChatService chatService) {
this.chatService = chatService;
}
public String execute() throws Exception {
public String execute() throws Exception {
User user = (User) session.get(ChatAuthenticationInterceptor.USER_SESSION_KEY);
if (user != null) {
chatService.logout(user.getName());
session.remove(ChatAuthenticationInterceptor.USER_SESSION_KEY);
}
User user = (User) session.get(ChatAuthenticationInterceptor.USER_SESSION_KEY);
if (user != null) {
chatService.logout(user.getName());
session.remove(ChatAuthenticationInterceptor.USER_SESSION_KEY);
}
return SUCCESS;
}
return SUCCESS;
}
// === SessionAware ===
public void setSession(Map session) {
this.session = session;
}
// === SessionAware ===
public void setSession(Map session) {
this.session = session;
}
}
@@ -24,26 +24,28 @@ import java.util.Date;
public class ChatMessage {
private Date creationDate;
private String message;
private User creator;
private Date creationDate;
private String message;
private User creator;
public ChatMessage(String message, User creator) {
assert(message != null);
assert(creator != null);
public ChatMessage(String message, User creator) {
assert (message != null);
assert (creator != null);
this.creationDate = new Date(System.currentTimeMillis());
this.message = message;
this.creator = creator;
}
this.creationDate = new Date(System.currentTimeMillis());
this.message = message;
this.creator = creator;
}
public Date getCreationDate() {
return creationDate;
}
public User getCreator() {
return creator;
}
public String getMessage() {
return message;
}
public Date getCreationDate() {
return creationDate;
}
public User getCreator() {
return creator;
}
public String getMessage() {
return message;
}
}
@@ -23,15 +23,23 @@ package org.apache.struts2.showcase.chat;
import java.util.List;
public interface ChatService {
List<User> getAvailableUsers();
void login(User user);
void logout(String name);
List<User> getAvailableUsers();
List<Room> getAvailableRooms();
void addRoom(Room room);
void enterRoom(User user, String roomName);
void exitRoom(String userName, String roomName);
List<ChatMessage> getMessagesInRoom(String roomName);
void sendMessageToRoom(String roomName, User user, String message);
List<User> getUsersAvailableInRoom(String roomName);
void login(User user);
void logout(String name);
List<Room> getAvailableRooms();
void addRoom(Room room);
void enterRoom(User user, String roomName);
void exitRoom(String userName, String roomName);
List<ChatMessage> getMessagesInRoom(String roomName);
void sendMessageToRoom(String roomName, User user, String message);
List<User> getUsersAvailableInRoom(String roomName);
}
@@ -27,89 +27,89 @@ import java.util.Map;
public class ChatServiceImpl implements ChatService {
private Map<String, User> availableUsers = new LinkedHashMap<String, User>();
private Map<String, Room> availableRooms = new LinkedHashMap<String, Room>();
private Map<String, User> availableUsers = new LinkedHashMap<String, User>();
private Map<String, Room> availableRooms = new LinkedHashMap<String, Room>();
public List<User> getAvailableUsers() {
return new ArrayList<User>(availableUsers.values());
}
public List<User> getAvailableUsers() {
return new ArrayList<User>(availableUsers.values());
}
public List<Room> getAvailableRooms() {
return new ArrayList<Room>(availableRooms.values());
}
public List<Room> getAvailableRooms() {
return new ArrayList<Room>(availableRooms.values());
}
public void addRoom(Room room) {
if (availableRooms.containsKey(room.getName())) {
throw new ChatException("room ["+room.getName()+"] is already available", ChatException.ErrorType.valueOf("ROOM_ALREADY_EXISTS"));
}
availableRooms.put(room.getName(), room);
}
public void addRoom(Room room) {
if (availableRooms.containsKey(room.getName())) {
throw new ChatException("room [" + room.getName() + "] is already available", ChatException.ErrorType.valueOf("ROOM_ALREADY_EXISTS"));
}
availableRooms.put(room.getName(), room);
}
public void login(User user) {
assert(user != null);
if (availableUsers.containsKey(user.getName())) {
throw new ChatException("User ["+user.getName()+"] already exists", ChatException.ErrorType.valueOf("USER_ALREADY_EXISTS"));
}
availableUsers.put(user.getName(), user);
}
public void login(User user) {
assert (user != null);
if (availableUsers.containsKey(user.getName())) {
throw new ChatException("User [" + user.getName() + "] already exists", ChatException.ErrorType.valueOf("USER_ALREADY_EXISTS"));
}
availableUsers.put(user.getName(), user);
}
public void logout(String name) {
assert(name != null);
assert(name.trim().length() > 0);
availableUsers.remove(name);
for (Room room : availableRooms.values()) {
if (room.hasMember(name)) {
room.memberExit(name);
}
}
}
public void logout(String name) {
assert (name != null);
assert (name.trim().length() > 0);
availableUsers.remove(name);
for (Room room : availableRooms.values()) {
if (room.hasMember(name)) {
room.memberExit(name);
}
}
}
public void exitRoom(String userName, String roomName) {
assert(roomName != null);
assert(roomName.trim().length()> 0);
public void exitRoom(String userName, String roomName) {
assert (roomName != null);
assert (roomName.trim().length() > 0);
if (availableRooms.containsKey(roomName)) {
Room room = availableRooms.get(roomName);
room.memberExit(userName);
}
}
if (availableRooms.containsKey(roomName)) {
Room room = availableRooms.get(roomName);
room.memberExit(userName);
}
}
public void enterRoom(User user, String roomName) {
assert(roomName != null);
assert(roomName.trim().length() > 0);
if (! availableRooms.containsKey(roomName)) {
throw new ChatException("No such room exists ["+roomName+"]", ChatException.ErrorType.NO_SUCH_ROOM_EXISTS);
}
Room room = availableRooms.get(roomName);
room.memberEnter(user);
}
public void enterRoom(User user, String roomName) {
assert (roomName != null);
assert (roomName.trim().length() > 0);
if (!availableRooms.containsKey(roomName)) {
throw new ChatException("No such room exists [" + roomName + "]", ChatException.ErrorType.NO_SUCH_ROOM_EXISTS);
}
Room room = availableRooms.get(roomName);
room.memberEnter(user);
}
public List<ChatMessage> getMessagesInRoom(String roomName) {
assert(roomName != null);
assert(roomName.trim().length() > 0);
if (! availableRooms.containsKey(roomName)) {
throw new ChatException("No such room exists ["+roomName+"]", ChatException.ErrorType.NO_SUCH_ROOM_EXISTS);
}
Room room = availableRooms.get(roomName);
return room.getChatMessages();
}
public List<ChatMessage> getMessagesInRoom(String roomName) {
assert (roomName != null);
assert (roomName.trim().length() > 0);
if (!availableRooms.containsKey(roomName)) {
throw new ChatException("No such room exists [" + roomName + "]", ChatException.ErrorType.NO_SUCH_ROOM_EXISTS);
}
Room room = availableRooms.get(roomName);
return room.getChatMessages();
}
public void sendMessageToRoom(String roomName, User user, String message) {
assert(roomName != null);
if (! availableRooms.containsKey(roomName)) {
throw new ChatException("No such room exists ["+roomName+"]", ChatException.ErrorType.NO_SUCH_ROOM_EXISTS);
}
Room room = availableRooms.get(roomName);
room.addMessage(new ChatMessage(message, user));
}
public void sendMessageToRoom(String roomName, User user, String message) {
assert (roomName != null);
if (!availableRooms.containsKey(roomName)) {
throw new ChatException("No such room exists [" + roomName + "]", ChatException.ErrorType.NO_SUCH_ROOM_EXISTS);
}
Room room = availableRooms.get(roomName);
room.addMessage(new ChatMessage(message, user));
}
public List<User> getUsersAvailableInRoom(String roomName) {
assert(roomName != null);
if (! availableRooms.containsKey(roomName)) {
throw new ChatException("No such room exists ["+roomName+"]", ChatException.ErrorType.NO_SUCH_ROOM_EXISTS);
}
Room room = availableRooms.get(roomName);
return room.getMembers();
}
public List<User> getUsersAvailableInRoom(String roomName) {
assert (roomName != null);
if (!availableRooms.containsKey(roomName)) {
throw new ChatException("No such room exists [" + roomName + "]", ChatException.ErrorType.NO_SUCH_ROOM_EXISTS);
}
Room room = availableRooms.get(roomName);
return room.getMembers();
}
}
@@ -20,35 +20,34 @@
*/
package org.apache.struts2.showcase.chat;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
public class ChatSessionListener implements HttpSessionListener {
private static final Logger LOG = LoggerFactory.getLogger(ChatSessionListener.class);
private static final Logger LOG = LoggerFactory.getLogger(ChatSessionListener.class);
public void sessionCreated(HttpSessionEvent event) {
}
public void sessionCreated(HttpSessionEvent event) {
}
public void sessionDestroyed(HttpSessionEvent event) {
HttpSession session = event.getSession();
WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(session.getServletContext());
if (context != null) {
User user = (User) session.getAttribute(ChatInterceptor.CHAT_USER_SESSION_KEY);
if (user != null) {
ChatService service = (ChatService) context.getBean("chatService");
service.logout(user.getName());
public void sessionDestroyed(HttpSessionEvent event) {
HttpSession session = event.getSession();
WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(session.getServletContext());
if (context != null) {
User user = (User) session.getAttribute(ChatInterceptor.CHAT_USER_SESSION_KEY);
if (user != null) {
ChatService service = (ChatService) context.getBean("chatService");
service.logout(user.getName());
LOG.info("session expired, logged user ["+user.getName()+"] out");
}
}
}
LOG.info("session expired, logged user [" + user.getName() + "] out");
}
}
}
}
@@ -21,5 +21,5 @@
package org.apache.struts2.showcase.chat;
public class Constants {
public static String UPDATE_FREQ = "5000";
public static String UPDATE_FREQ = "5000";
}
@@ -24,41 +24,40 @@ import com.opensymphony.xwork2.ActionSupport;
public class CrudRoomAction extends ActionSupport {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
private ChatService chatService;
private ChatService chatService;
private String name;
private String description;
private String name;
private String description;
public String getDescription() {
return description;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public void setDescription(String description) {
this.description = description;
}
public String getName() {
return name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public void setName(String name) {
this.name = name;
}
public CrudRoomAction(ChatService chatService) {
this.chatService = chatService;
}
public CrudRoomAction(ChatService chatService) {
this.chatService = chatService;
}
public String create() throws Exception {
try {
chatService.addRoom(new Room(name, description));
}
catch(ChatException e) {
addActionError(e.getMessage());
}
return SUCCESS;
}
public String create() throws Exception {
try {
chatService.addRoom(new Room(name, description));
} catch (ChatException e) {
addActionError(e.getMessage());
}
return SUCCESS;
}
}
@@ -20,41 +20,39 @@
*/
package org.apache.struts2.showcase.chat;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import org.apache.struts2.util.StrutsTypeConverter;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
import org.apache.struts2.util.StrutsTypeConverter;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
public class DateConverter extends StrutsTypeConverter {
private static final Logger LOG = LoggerFactory.getLogger(DateConverter.class);
private static final Logger LOG = LoggerFactory.getLogger(DateConverter.class);
public Object convertFromString(Map context, String[] values, Class toClass) {
public Object convertFromString(Map context, String[] values, Class toClass) {
if (values.length > 0 && values[0] != null && values[0].trim().length() > 0) {
SimpleDateFormat sdf = new SimpleDateFormat();
try {
return sdf.parse(values[0]);
}
catch(ParseException e) {
LOG.error("error converting value ["+values[0]+"] to Date ", e);
}
}
return null;
}
if (values.length > 0 && values[0] != null && values[0].trim().length() > 0) {
SimpleDateFormat sdf = new SimpleDateFormat();
try {
return sdf.parse(values[0]);
} catch (ParseException e) {
LOG.error("error converting value [" + values[0] + "] to Date ", e);
}
}
return null;
}
public String convertToString(Map context, Object o) {
public String convertToString(Map context, Object o) {
if (o instanceof Date) {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
return sdf.format((Date) o);
}
return "";
}
if (o instanceof Date) {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
return sdf.format((Date) o);
}
return "";
}
}
@@ -20,43 +20,46 @@
*/
package org.apache.struts2.showcase.chat;
import java.util.Map;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.interceptor.SessionAware;
import com.opensymphony.xwork2.ActionSupport;
import java.util.Map;
public class EnterRoomAction extends ActionSupport implements SessionAware {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
private ChatService chatService;
private Map session;
private String roomName;
private ChatService chatService;
private Map session;
private String roomName;
public String getRoomName() { return this.roomName; }
public void setRoomName(String roomName) { this.roomName = roomName; }
public String getRoomName() {
return this.roomName;
}
public EnterRoomAction(ChatService chatService) {
this.chatService = chatService;
}
public void setRoomName(String roomName) {
this.roomName = roomName;
}
public String execute() throws Exception {
public EnterRoomAction(ChatService chatService) {
this.chatService = chatService;
}
User user = (User) session.get(ChatAuthenticationInterceptor.USER_SESSION_KEY);
try {
chatService.enterRoom(user, roomName);
}
catch(Exception e) {
addActionError(e.getMessage());
}
return SUCCESS;
}
public String execute() throws Exception {
User user = (User) session.get(ChatAuthenticationInterceptor.USER_SESSION_KEY);
try {
chatService.enterRoom(user, roomName);
} catch (Exception e) {
addActionError(e.getMessage());
}
return SUCCESS;
}
// === SessionAware ===
public void setSession(Map session) {
this.session = session;
}
// === SessionAware ===
public void setSession(Map session) {
this.session = session;
}
}
@@ -20,39 +20,43 @@
*/
package org.apache.struts2.showcase.chat;
import java.util.Map;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.interceptor.SessionAware;
import com.opensymphony.xwork2.ActionSupport;
import java.util.Map;
public class ExitRoomAction extends ActionSupport implements SessionAware {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
private String roomName;
private String roomName;
private Map session;
private Map session;
public String getRoomName() { return roomName; }
public void setRoomName(String roomName) { this.roomName = roomName; }
public String getRoomName() {
return roomName;
}
private ChatService chatService;
public void setRoomName(String roomName) {
this.roomName = roomName;
}
public ExitRoomAction(ChatService chatService) {
this.chatService = chatService;
}
private ChatService chatService;
public String execute() throws Exception {
User user = (User) session.get(ChatAuthenticationInterceptor.USER_SESSION_KEY);
chatService.exitRoom(user.getName(), roomName);
public ExitRoomAction(ChatService chatService) {
this.chatService = chatService;
}
return SUCCESS;
}
public String execute() throws Exception {
User user = (User) session.get(ChatAuthenticationInterceptor.USER_SESSION_KEY);
chatService.exitRoom(user.getName(), roomName);
// === SessionAware ===
public void setSession(Map session) {
this.session = session;
}
return SUCCESS;
}
// === SessionAware ===
public void setSession(Map session) {
this.session = session;
}
}
@@ -20,40 +20,42 @@
*/
package org.apache.struts2.showcase.chat;
import com.opensymphony.xwork2.ActionSupport;
import java.util.ArrayList;
import java.util.List;
import com.opensymphony.xwork2.ActionSupport;
public class MessagesAvailableInRoomAction extends ActionSupport {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
private String roomName;
private ChatService chatService;
private List<ChatMessage> messagesAvailableInRoom = new ArrayList<ChatMessage>();
private String roomName;
private ChatService chatService;
private List<ChatMessage> messagesAvailableInRoom = new ArrayList<ChatMessage>();
public String getRoomName() { return this.roomName; }
public void setRoomName(String roomName) {
this.roomName = roomName;
}
public String getRoomName() {
return this.roomName;
}
public List<ChatMessage> getMessagesAvailableInRoom() {
return messagesAvailableInRoom;
}
public void setRoomName(String roomName) {
this.roomName = roomName;
}
public MessagesAvailableInRoomAction(ChatService chatService) {
this.chatService = chatService;
}
public List<ChatMessage> getMessagesAvailableInRoom() {
return messagesAvailableInRoom;
}
public String execute() throws Exception {
try {
messagesAvailableInRoom = chatService.getMessagesInRoom(roomName);
}
catch(ChatException e) {
addActionError(e.getMessage());
}
return SUCCESS;
}
public MessagesAvailableInRoomAction(ChatService chatService) {
this.chatService = chatService;
}
public String execute() throws Exception {
try {
messagesAvailableInRoom = chatService.getMessagesInRoom(roomName);
} catch (ChatException e) {
addActionError(e.getMessage());
}
return SUCCESS;
}
}
@@ -20,82 +20,81 @@
*/
package org.apache.struts2.showcase.chat;
import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
public class Room {
private static final int MAX_CHAT_MESSAGES = 10;
private static final int MAX_CHAT_MESSAGES = 10;
private String name;
private String description;
private Date creationDate;
private String name;
private String description;
private Date creationDate;
private List<ChatMessage> messages = new ArrayList<ChatMessage>();
private List<ChatMessage> messages = new ArrayList<ChatMessage>();
private Map<String, User> members = new LinkedHashMap<String, User>();
private Map<String, User> members = new LinkedHashMap<String, User>();
public Room(String name, String description) {
this.name = name;
this.description = description;
this.creationDate = new Date(System.currentTimeMillis());
}
public Room(String name, String description) {
this.name = name;
this.description = description;
this.creationDate = new Date(System.currentTimeMillis());
}
// properties
public Date getCreationDate() {
return creationDate;
}
// properties
public Date getCreationDate() {
return creationDate;
}
public String getDescription() {
return description;
}
public String getDescription() {
return description;
}
public String getName() {
return name;
}
public String getName() {
return name;
}
// (behaviour) members
public List<User> getMembers() {
return new ArrayList<User>(members.values());
}
public User findMember(String name) {
assert(name != null);
return members.get(name);
}
public boolean hasMember(String name) {
assert(name != null);
return members.containsKey(name);
}
public void memberEnter(User member) {
assert(member != null);
if (! hasMember(member.getName())) {
members.put(member.getName(), member);
}
}
// (behaviour) members
public List<User> getMembers() {
return new ArrayList<User>(members.values());
}
public void memberExit(String memberName) {
assert(memberName != null);
assert(memberName.trim().length() > 0);
members.remove(memberName);
}
public User findMember(String name) {
assert (name != null);
return members.get(name);
}
public boolean hasMember(String name) {
assert (name != null);
return members.containsKey(name);
}
public void memberEnter(User member) {
assert (member != null);
if (!hasMember(member.getName())) {
members.put(member.getName(), member);
}
}
public void memberExit(String memberName) {
assert (memberName != null);
assert (memberName.trim().length() > 0);
members.remove(memberName);
}
// (behaviour) chat messags
public void addMessage(ChatMessage chatMessage) {
if (messages.size() > MAX_CHAT_MESSAGES) {
// messages.remove(messages.size() - 1);
messages.remove(0);
}
messages.add(chatMessage);
}
// (behaviour) chat messags
public void addMessage(ChatMessage chatMessage) {
if (messages.size() > MAX_CHAT_MESSAGES) {
// messages.remove(messages.size() - 1);
messages.remove(0);
}
messages.add(chatMessage);
}
public List<ChatMessage> getChatMessages() {
return new ArrayList<ChatMessage>(messages);
}
public List<ChatMessage> getChatMessages() {
return new ArrayList<ChatMessage>(messages);
}
}
@@ -20,29 +20,29 @@
*/
package org.apache.struts2.showcase.chat;
import com.opensymphony.xwork2.ActionSupport;
import java.util.ArrayList;
import java.util.List;
import com.opensymphony.xwork2.ActionSupport;
public class RoomsAvailableAction extends ActionSupport {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
private List<Room> availableRooms = new ArrayList<Room>();
private List<Room> availableRooms = new ArrayList<Room>();
private ChatService chatService;
private ChatService chatService;
public RoomsAvailableAction(ChatService chatService) {
this.chatService = chatService;
}
public RoomsAvailableAction(ChatService chatService) {
this.chatService = chatService;
}
public String execute() throws Exception {
availableRooms = chatService.getAvailableRooms();
return SUCCESS;
}
public String execute() throws Exception {
availableRooms = chatService.getAvailableRooms();
return SUCCESS;
}
public List<Room> getAvailableRooms() {
return availableRooms;
}
public List<Room> getAvailableRooms() {
return availableRooms;
}
}
@@ -20,51 +20,56 @@
*/
package org.apache.struts2.showcase.chat;
import java.util.Map;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.interceptor.SessionAware;
import com.opensymphony.xwork2.ActionSupport;
import java.util.Map;
public class SendMessageToRoomAction extends ActionSupport implements SessionAware {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
private ChatService chatService;
private ChatService chatService;
private String roomName;
private String message;
private Map session;
private String roomName;
private String message;
private Map session;
public SendMessageToRoomAction(ChatService chatService) {
this.chatService = chatService;
}
public SendMessageToRoomAction(ChatService chatService) {
this.chatService = chatService;
}
public String getRoomName() { return this.roomName; }
public void setRoomName(String roomName) {
this.roomName = roomName;
}
public String getRoomName() {
return this.roomName;
}
public String getMessage() { return this.message; }
public void setMessage(String message) {
this.message = message;
}
public void setRoomName(String roomName) {
this.roomName = roomName;
}
public String getMessage() {
return this.message;
}
public void setMessage(String message) {
this.message = message;
}
public String execute() throws Exception {
User user = (User) session.get(ChatAuthenticationInterceptor.USER_SESSION_KEY);
try {
chatService.sendMessageToRoom(roomName, user, message);
}catch(ChatException e) {
addActionError(e.getMessage());
}
return SUCCESS;
}
public String execute() throws Exception {
User user = (User) session.get(ChatAuthenticationInterceptor.USER_SESSION_KEY);
try {
chatService.sendMessageToRoom(roomName, user, message);
} catch (ChatException e) {
addActionError(e.getMessage());
}
return SUCCESS;
}
public void setSession(Map session) {
this.session = session;
}
public void setSession(Map session) {
this.session = session;
}
}
@@ -26,23 +26,24 @@ import java.util.Date;
/**
* Represends a user in the Chat example.
*/
public class User implements Serializable {
public class User implements Serializable {
private static final long serialVersionUID = -1434958919516089297L;
private static final long serialVersionUID = -1434958919516089297L;
private String name;
private Date creationDate;
private String name;
private Date creationDate;
public User(String name) {
this.name = name;
this.creationDate = new Date(System.currentTimeMillis());
}
public User(String name) {
this.name = name;
this.creationDate = new Date(System.currentTimeMillis());
}
public Date getCreationDate() {
return creationDate;
}
public String getName() {
return name;
}
public Date getCreationDate() {
return creationDate;
}
public String getName() {
return name;
}
}
@@ -20,30 +20,30 @@
*/
package org.apache.struts2.showcase.chat;
import com.opensymphony.xwork2.ActionSupport;
import java.util.ArrayList;
import java.util.List;
import com.opensymphony.xwork2.ActionSupport;
public class UsersAvailableAction extends ActionSupport {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
private List<User> availableUsers = new ArrayList<User>();
private ChatService chatService;
private List<User> availableUsers = new ArrayList<User>();
private ChatService chatService;
public UsersAvailableAction(ChatService chatService) {
this.chatService = chatService;
}
public UsersAvailableAction(ChatService chatService) {
this.chatService = chatService;
}
public String execute() throws Exception {
public String execute() throws Exception {
availableUsers = chatService.getAvailableUsers();
availableUsers = chatService.getAvailableUsers();
return SUCCESS;
}
return SUCCESS;
}
public List<User> getAvailableUsers() {
return availableUsers;
}
public List<User> getAvailableUsers() {
return availableUsers;
}
}
@@ -20,42 +20,44 @@
*/
package org.apache.struts2.showcase.chat;
import com.opensymphony.xwork2.ActionSupport;
import java.util.ArrayList;
import java.util.List;
import com.opensymphony.xwork2.ActionSupport;
public class UsersAvailableInRoomAction extends ActionSupport {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
private ChatService chatService;
private List<User> usersAvailableInRoom = new ArrayList<User>();
private ChatService chatService;
private List<User> usersAvailableInRoom = new ArrayList<User>();
private String roomName;
private String roomName;
public UsersAvailableInRoomAction(ChatService chatService) {
this.chatService = chatService;
}
public UsersAvailableInRoomAction(ChatService chatService) {
this.chatService = chatService;
}
public String getRoomName() { return this.roomName; }
public void setRoomName(String roomName) {
this.roomName = roomName;
}
public String getRoomName() {
return this.roomName;
}
public List<User> getUsersAvailableInRoom() {
return usersAvailableInRoom;
}
public void setRoomName(String roomName) {
this.roomName = roomName;
}
public String execute() throws Exception {
try {
usersAvailableInRoom = chatService.getUsersAvailableInRoom(roomName);
}
catch(ChatException e) {
addActionError(e.getMessage());
}
return SUCCESS;
}
public List<User> getUsersAvailableInRoom() {
return usersAvailableInRoom;
}
public String execute() throws Exception {
try {
usersAvailableInRoom = chatService.getUsersAvailableInRoom(roomName);
} catch (ChatException e) {
addActionError(e.getMessage());
}
return SUCCESS;
}
}
@@ -26,13 +26,23 @@ package org.apache.struts2.showcase.conversion;
*/
public class Address {
private String id;
private String address;
private String id;
private String address;
public String getId() { return id; }
public void setId(String id) { this.id = id; }
public String getId() {
return id;
}
public String getAddress() { return address; }
public void setAddress(String address) { this.address = address; }
public void setId(String id) {
this.id = id;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
}
@@ -20,28 +20,32 @@
*/
package org.apache.struts2.showcase.conversion;
import com.opensymphony.xwork2.ActionSupport;
import java.util.LinkedHashSet;
import java.util.Set;
import com.opensymphony.xwork2.ActionSupport;
/**
* @version $Date$ $Id$
*/
public class AddressAction extends ActionSupport {
private Set addresses = new LinkedHashSet();
private Set<Address> addresses = new LinkedHashSet<Address>();
public Set getAddresses() { return addresses; }
public void setAddresses(Set addresses) { this.addresses = addresses; }
public String input() throws Exception {
return SUCCESS;
}
public String submit() throws Exception {
System.out.println(addresses);
return SUCCESS;
}
public String input() throws Exception {
return SUCCESS;
}
public Set<Address> getAddresses() {
return addresses;
}
public String submit() throws Exception {
System.out.println(addresses);
return SUCCESS;
}
public void setAddresses(Set<Address> addresses) {
this.addresses = addresses;
}
}
@@ -20,39 +20,39 @@
*/
package org.apache.struts2.showcase.conversion;
import org.apache.struts2.util.StrutsTypeConverter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.struts2.util.StrutsTypeConverter;
/**
* @version $Date$ $Id$
*/
public class EnumTypeConverter extends StrutsTypeConverter {
@Override
public Object convertFromString(Map context, String[] values, Class toClass) {
List<Enum> result = new ArrayList<Enum>();
for (int a=0; a< values.length; a++) {
Enum e = Enum.valueOf(OperationsEnum.class, values[a]);
if (e != null)
result.add(e);
}
return result;
}
@Override
public Object convertFromString(Map context, String[] values, Class toClass) {
List<Enum> result = new ArrayList<Enum>();
for (int a = 0; a < values.length; a++) {
Enum e = Enum.valueOf(OperationsEnum.class, values[a]);
if (e != null)
result.add(e);
}
return result;
}
@Override
public String convertToString(Map context, Object o) {
List l = (List) o;
String result ="<";
for (Iterator i = l.iterator(); i.hasNext(); ) {
result = result + "["+ i.next() +"]";
}
result = result+">";
return result;
}
@Override
public String convertToString(Map context, Object o) {
List l = (List) o;
String result = "<";
for (Iterator i = l.iterator(); i.hasNext(); ) {
result = result + "[" + i.next() + "]";
}
result = result + ">";
return result;
}
}
@@ -21,13 +21,12 @@
package org.apache.struts2.showcase.conversion;
/**
*
* @version $Date$ $Id$
*/
public enum OperationsEnum {
ADD,
MINUS,
DIVIDE,
MULTIPLY,
REMAINDER;
ADD,
MINUS,
DIVIDE,
MULTIPLY,
REMAINDER;
}
@@ -20,37 +20,40 @@
*/
package org.apache.struts2.showcase.conversion;
import com.opensymphony.xwork2.ActionSupport;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import com.opensymphony.xwork2.ActionSupport;
/**
*
* @version $Date$ $Id$
*/
public class OperationsEnumAction extends ActionSupport {
private static final long serialVersionUID = -2229489704988870318L;
private static final long serialVersionUID = -2229489704988870318L;
private List<OperationsEnum> selectedOperations = new LinkedList<OperationsEnum>();
private List<OperationsEnum> selectedOperations = new LinkedList<OperationsEnum>();
public List<OperationsEnum> getSelectedOperations() { return this.selectedOperations; }
public void setSelectedOperations(List<OperationsEnum> selectedOperations) {
this.selectedOperations = selectedOperations;
}
public String input() throws Exception {
return SUCCESS;
}
public String submit() throws Exception {
return SUCCESS;
}
public List<OperationsEnum> getSelectedOperations() {
return this.selectedOperations;
}
public void setSelectedOperations(List<OperationsEnum> selectedOperations) {
this.selectedOperations = selectedOperations;
}
public List<OperationsEnum> getAvailableOperations() {
return Arrays.asList(OperationsEnum.values());
}
public String input() throws Exception {
return SUCCESS;
}
public String submit() throws Exception {
return SUCCESS;
}
public List<OperationsEnum> getAvailableOperations() {
return Arrays.asList(OperationsEnum.values());
}
}
@@ -22,16 +22,23 @@ package org.apache.struts2.showcase.conversion;
import java.io.Serializable;
/**
*
*/
public class Person implements Serializable {
private String name;
private Integer age;
private String name;
private Integer age;
public void setName(String name) { this.name = name; }
public String getName() { return this.name; }
public void setName(String name) {
this.name = name;
}
public void setAge(Integer age) { this.age = age; }
public Integer getAge() { return this.age; }
public String getName() {
return this.name;
}
public void setAge(Integer age) {
this.age = age;
}
public Integer getAge() {
return this.age;
}
}
@@ -20,27 +20,28 @@
*/
package org.apache.struts2.showcase.conversion;
import java.util.List;
import com.opensymphony.xwork2.ActionSupport;
/**
*
*/
import java.util.List;
public class PersonAction extends ActionSupport {
private List persons;
private List<Person> persons;
public List getPersons() { return persons; }
public void setPersons(List persons) { this.persons = persons; }
public String input() throws Exception {
return SUCCESS;
}
public String submit() throws Exception {
return SUCCESS;
}
public List<Person> getPersons() {
return persons;
}
public String input() throws Exception {
return SUCCESS;
}
public void setPersons(List<Person> persons) {
this.persons = persons;
}
public String submit() throws Exception {
return SUCCESS;
}
}
@@ -20,58 +20,59 @@
*/
package org.apache.struts2.showcase.dao;
import java.io.Serializable;
import java.util.Collection;
import org.apache.struts2.showcase.application.Storage;
import org.apache.struts2.showcase.exception.CreateException;
import org.apache.struts2.showcase.exception.StorageException;
import org.apache.struts2.showcase.exception.UpdateException;
import org.apache.struts2.showcase.model.IdEntity;
import org.springframework.beans.factory.annotation.Autowired;
import java.io.Serializable;
import java.util.Collection;
/**
* AbstractDao.
*
*/
public abstract class AbstractDao implements Serializable, Dao {
private Storage storage;
@Autowired
private Storage storage;
public Storage getStorage() {
return storage;
}
public Storage getStorage() {
return storage;
}
public void setStorage(Storage storage) {
this.storage = storage;
}
public void setStorage(Storage storage) {
this.storage = storage;
}
public IdEntity get(Serializable id) {
return getStorage().get(getFeaturedClass(), id);
}
public IdEntity get(Serializable id) {
return getStorage().get(getFeaturedClass(), id);
}
public Serializable create(IdEntity object) throws CreateException {
return getStorage().create(object);
}
public Serializable create(IdEntity object) throws CreateException {
return getStorage().create(object);
}
public IdEntity update(IdEntity object) throws UpdateException {
return getStorage().update(object);
}
public IdEntity update(IdEntity object) throws UpdateException {
return getStorage().update(object);
}
public Serializable merge(IdEntity object) throws StorageException {
return getStorage().merge(object);
}
public Serializable merge(IdEntity object) throws StorageException {
return getStorage().merge(object);
}
public int delete(Serializable id) throws CreateException {
return getStorage().delete(getFeaturedClass(), id);
}
public int delete(Serializable id) throws CreateException {
return getStorage().delete(getFeaturedClass(), id);
}
public int delete(IdEntity object) throws CreateException {
return getStorage().delete(object);
}
public int delete(IdEntity object) throws CreateException {
return getStorage().delete(object);
}
public Collection findAll() {
return getStorage().findAll(getFeaturedClass());
}
public Collection findAll() {
return getStorage().findAll(getFeaturedClass());
}
}
@@ -20,34 +20,33 @@
*/
package org.apache.struts2.showcase.dao;
import java.io.Serializable;
import java.util.Collection;
import org.apache.struts2.showcase.exception.CreateException;
import org.apache.struts2.showcase.exception.StorageException;
import org.apache.struts2.showcase.exception.UpdateException;
import org.apache.struts2.showcase.model.IdEntity;
import java.io.Serializable;
import java.util.Collection;
/**
* Dao. Interface.
*
*/
public interface Dao {
Class getFeaturedClass();
Class getFeaturedClass();
IdEntity get(Serializable id);
IdEntity get(Serializable id);
Serializable create(IdEntity object) throws CreateException;
Serializable create(IdEntity object) throws CreateException;
IdEntity update(IdEntity object) throws UpdateException;
IdEntity update(IdEntity object) throws UpdateException;
Serializable merge(IdEntity object) throws StorageException;
Serializable merge(IdEntity object) throws StorageException;
int delete(Serializable id) throws CreateException;
int delete(Serializable id) throws CreateException;
int delete(IdEntity object) throws CreateException;
int delete(IdEntity object) throws CreateException;
Collection findAll();
Collection findAll();
}
@@ -20,48 +20,50 @@
*/
package org.apache.struts2.showcase.dao;
import org.apache.struts2.showcase.model.Employee;
import org.apache.struts2.showcase.model.Skill;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.ArrayList;
import java.util.List;
import org.apache.struts2.showcase.model.Employee;
import org.apache.struts2.showcase.model.Skill;
/**
* EmployeeDao.
*
*/
@Repository
public class EmployeeDao extends AbstractDao {
private static final long serialVersionUID = -6615310540042830594L;
private static final long serialVersionUID = -6615310540042830594L;
protected SkillDao skillDao;
@Autowired
protected SkillDao skillDao;
public void setSkillDao(SkillDao skillDao) {
this.skillDao = skillDao;
}
public void setSkillDao(SkillDao skillDao) {
this.skillDao = skillDao;
}
public Class getFeaturedClass() {
return Employee.class;
}
public Class getFeaturedClass() {
return Employee.class;
}
public Employee getEmployee( Long id ) {
return (Employee) get(id);
}
public Employee getEmployee(Long id) {
return (Employee) get(id);
}
public Employee setSkills(Employee employee, List skillNames) {
if (employee!= null && skillNames != null) {
employee.setOtherSkills(new ArrayList());
for (int i = 0, j = skillNames.size(); i < j; i++) {
Skill skill = (Skill) skillDao.get((String) skillNames.get(i));
employee.getOtherSkills().add(skill);
}
}
return employee;
}
public Employee setSkills(Employee employee, List<String> skillNames) {
if (employee != null && skillNames != null) {
employee.setOtherSkills(new ArrayList());
for (int i = 0, j = skillNames.size(); i < j; i++) {
Skill skill = (Skill) skillDao.get(skillNames.get(i));
employee.getOtherSkills().add(skill);
}
}
return employee;
}
public Employee setSkills(Long empId, List skillNames) {
return setSkills((Employee) get(empId), skillNames);
}
public Employee setSkills(Long empId, List skillNames) {
return setSkills((Employee) get(empId), skillNames);
}
}
@@ -21,21 +21,22 @@
package org.apache.struts2.showcase.dao;
import org.apache.struts2.showcase.model.Skill;
import org.springframework.stereotype.Repository;
/**
* SkillDao.
*
*/
@Repository
public class SkillDao extends AbstractDao {
private static final long serialVersionUID = -8160406514074630866L;
private static final long serialVersionUID = -8160406514074630866L;
public Class getFeaturedClass() {
return Skill.class;
}
public Class getFeaturedClass() {
return Skill.class;
}
public Skill getSkill( String name ) {
return (Skill) get(name);
}
public Skill getSkill(String name) {
return (Skill) get(name);
}
}
@@ -22,22 +22,21 @@ package org.apache.struts2.showcase.exception;
/**
* CreateException.
*
*/
public class CreateException extends StorageException {
private static final long serialVersionUID = 6734349565111633783L;
private static final long serialVersionUID = 6734349565111633783L;
public CreateException(String message) {
super(message);
}
public CreateException(String message) {
super(message);
}
public CreateException(String message, Throwable cause) {
super(message, cause);
}
public CreateException(String message, Throwable cause) {
super(message, cause);
}
public CreateException(Throwable cause) {
super(cause);
}
public CreateException(Throwable cause) {
super(cause);
}
}
@@ -22,23 +22,22 @@ package org.apache.struts2.showcase.exception;
/**
* DeleteException.
*
*/
public class DeleteException extends StorageException {
private static final long serialVersionUID = -5286362812955627352L;
private static final long serialVersionUID = -5286362812955627352L;
public DeleteException(String message) {
super(message);
}
public DeleteException(String message) {
super(message);
}
public DeleteException(Throwable cause) {
super(cause);
}
public DeleteException(Throwable cause) {
super(cause);
}
public DeleteException(String message, Throwable cause) {
super(message, cause);
}
public DeleteException(String message, Throwable cause) {
super(message, cause);
}
}
@@ -22,23 +22,22 @@ package org.apache.struts2.showcase.exception;
/**
* DuplicateKeyException.
*
*/
public class DuplicateKeyException extends CreateException {
private static final long serialVersionUID = 989620752592415898L;
private static final long serialVersionUID = 989620752592415898L;
public DuplicateKeyException(String message) {
super(message);
}
public DuplicateKeyException(String message) {
super(message);
}
public DuplicateKeyException(Throwable cause) {
super(cause);
}
public DuplicateKeyException(Throwable cause) {
super(cause);
}
public DuplicateKeyException(String message, Throwable cause) {
super(message, cause);
}
public DuplicateKeyException(String message, Throwable cause) {
super(message, cause);
}
}
@@ -22,23 +22,22 @@ package org.apache.struts2.showcase.exception;
/**
* StorageException.
*
*/
public class StorageException extends Exception {
private static final long serialVersionUID = -2528721270540362905L;
private static final long serialVersionUID = -2528721270540362905L;
public StorageException(String message) {
super(message);
}
public StorageException(String message) {
super(message);
}
public StorageException(Throwable cause) {
super(cause);
}
public StorageException(Throwable cause) {
super(cause);
}
public StorageException(String message, Throwable cause) {
super(message, cause);
}
public StorageException(String message, Throwable cause) {
super(message, cause);
}
}
@@ -23,23 +23,22 @@ package org.apache.struts2.showcase.exception;
/**
* UpdateException.
*
*/
public class UpdateException extends StorageException {
private static final long serialVersionUID = -4728238600375630452L;
private static final long serialVersionUID = -4728238600375630452L;
public UpdateException(String message) {
super(message);
}
public UpdateException(String message) {
super(message);
}
public UpdateException(Throwable cause) {
super(cause);
}
public UpdateException(Throwable cause) {
super(cause);
}
public UpdateException(String message, Throwable cause) {
super(message, cause);
}
public UpdateException(String message, Throwable cause) {
super(message, cause);
}
}
@@ -20,31 +20,29 @@
*/
package org.apache.struts2.showcase.filedownload;
import java.io.InputStream;
import com.opensymphony.xwork2.Action;
import org.apache.struts2.ServletActionContext;
import com.opensymphony.xwork2.Action;
import java.io.InputStream;
/**
* Demonstrates file resource download.
* Set filePath to the local file resource to download,
* relative to the application root ("/images/struts.gif").
*
*/
public class FileDownloadAction implements Action {
private String inputPath;
public void setInputPath(String value) {
inputPath = value;
}
private String inputPath;
public InputStream getInputStream() throws Exception {
return ServletActionContext.getServletContext().getResourceAsStream(inputPath);
}
public String execute() throws Exception {
return SUCCESS;
}
public String execute() throws Exception {
return SUCCESS;
}
public void setInputPath(String value) {
inputPath = value;
}
public InputStream getInputStream() throws Exception {
return ServletActionContext.getServletContext().getResourceAsStream(inputPath);
}
}
@@ -20,66 +20,68 @@
*/
package org.apache.struts2.showcase.fileupload;
import java.io.File;
import com.opensymphony.xwork2.ActionSupport;
import java.io.File;
/**
* Show case File Upload example's action. <code>FileUploadAction</code>
*
*/
public class FileUploadAction extends ActionSupport {
private static final long serialVersionUID = 5156288255337069381L;
private static final long serialVersionUID = 5156288255337069381L;
private String contentType;
private File upload;
private String fileName;
private String caption;
private String contentType;
private File upload;
private String fileName;
private String caption;
// since we are using <s:file name="upload" .../> the file name will be
// obtained through getter/setter of <file-tag-name>FileName
public String getUploadFileName() {
return fileName;
}
public void setUploadFileName(String fileName) {
this.fileName = fileName;
}
public String input() throws Exception {
return SUCCESS;
}
public String upload() throws Exception {
return SUCCESS;
}
// since we are using <s:file name="upload" .../> the file name will be
// obtained through getter/setter of <file-tag-name>FileName
public String getUploadFileName() {
return fileName;
}
public void setUploadFileName(String fileName) {
this.fileName = fileName;
}
// since we are using <s:file name="upload" ... /> the content type will be
// obtained through getter/setter of <file-tag-name>ContentType
public String getUploadContentType() {
return contentType;
}
public void setUploadContentType(String contentType) {
this.contentType = contentType;
}
// since we are using <s:file name="upload" ... /> the content type will be
// obtained through getter/setter of <file-tag-name>ContentType
public String getUploadContentType() {
return contentType;
}
public void setUploadContentType(String contentType) {
this.contentType = contentType;
}
// since we are using <s:file name="upload" ... /> the File itself will be
// obtained through getter/setter of <file-tag-name>
public File getUpload() {
return upload;
}
public void setUpload(File upload) {
this.upload = upload;
}
// since we are using <s:file name="upload" ... /> the File itself will be
// obtained through getter/setter of <file-tag-name>
public File getUpload() {
return upload;
}
public void setUpload(File upload) {
this.upload = upload;
}
public String getCaption() {
return caption;
}
public void setCaption(String caption) {
this.caption = caption;
}
public String input() throws Exception {
return SUCCESS;
}
public String upload() throws Exception {
return SUCCESS;
}
public String getCaption() {
return caption;
}
public void setCaption(String caption) {
this.caption = caption;
}
}
@@ -21,10 +21,10 @@
// START SNIPPET: entire-file
package org.apache.struts2.showcase.fileupload;
import java.io.File;
import com.opensymphony.xwork2.ActionSupport;
import java.io.File;
/**
* Showcase action - mutiple file upload using array.
*
@@ -32,35 +32,51 @@ import com.opensymphony.xwork2.ActionSupport;
*/
public class MultipleFileUploadUsingArrayAction extends ActionSupport {
private File[] uploads;
private String[] uploadFileNames;
private String[] uploadContentTypes;
private File[] uploads;
private String[] uploadFileNames;
private String[] uploadContentTypes;
public File[] getUpload() { return this.uploads; }
public void setUpload(File[] upload) { this.uploads = upload; }
public String[] getUploadFileName() { return this.uploadFileNames; }
public void setUploadFileName(String[] uploadFileName) { this.uploadFileNames = uploadFileName; }
public String upload() throws Exception {
System.out.println("\n\n upload2");
System.out.println("files:");
for (File u : uploads) {
System.out.println("*** " + u + "\t" + u.length());
}
System.out.println("filenames:");
for (String n : uploadFileNames) {
System.out.println("*** " + n);
}
System.out.println("content types:");
for (String c : uploadContentTypes) {
System.out.println("*** " + c);
}
System.out.println("\n\n");
return SUCCESS;
}
public String[] getUploadContentType() { return this.uploadContentTypes; }
public void setUploadContentType(String[] uploadContentType) { this.uploadContentTypes = uploadContentType; }
public File[] getUpload() {
return this.uploads;
}
public String upload() throws Exception {
System.out.println("\n\n upload2");
System.out.println("files:");
for (File u: uploads) {
System.out.println("*** "+u+"\t"+u.length());
}
System.out.println("filenames:");
for (String n: uploadFileNames) {
System.out.println("*** "+n);
}
System.out.println("content types:");
for (String c: uploadContentTypes) {
System.out.println("*** "+c);
}
System.out.println("\n\n");
return SUCCESS;
}
public void setUpload(File[] upload) {
this.uploads = upload;
}
public String[] getUploadFileName() {
return this.uploadFileNames;
}
public void setUploadFileName(String[] uploadFileName) {
this.uploadFileNames = uploadFileName;
}
public String[] getUploadContentType() {
return this.uploadContentTypes;
}
public void setUploadContentType(String[] uploadContentType) {
this.uploadContentTypes = uploadContentType;
}
}
// END SNIPPET: entire-file
@@ -20,61 +20,66 @@
*/
// START SNIPPET: entire-file
package org.apache.struts2.showcase.fileupload;
import com.opensymphony.xwork2.ActionSupport;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import com.opensymphony.xwork2.ActionSupport;
/**
* Showcase action - multiple file upload using List
*
* @version $Date$ $Id$
*/
public class MultipleFileUploadUsingListAction extends ActionSupport {
private List<File> uploads = new ArrayList<File>();
private List<String> uploadFileNames = new ArrayList<String>();
private List<String> uploadContentTypes = new ArrayList<String>();
private List<File> uploads = new ArrayList<File>();
private List<String> uploadFileNames = new ArrayList<String>();
private List<String> uploadContentTypes = new ArrayList<String>();
public List<File> getUpload() {
return this.uploads;
}
public void setUpload(List<File> uploads) {
this.uploads = uploads;
}
public List<File> getUpload() {
return this.uploads;
}
public List<String> getUploadFileName() {
return this.uploadFileNames;
}
public void setUploadFileName(List<String> uploadFileNames) {
this.uploadFileNames = uploadFileNames;
}
public void setUpload(List<File> uploads) {
this.uploads = uploads;
}
public List<String> getUploadContentType() {
return this.uploadContentTypes;
}
public void setUploadContentType(List<String> contentTypes) {
this.uploadContentTypes = contentTypes;
}
public List<String> getUploadFileName() {
return this.uploadFileNames;
}
public String upload() throws Exception {
public void setUploadFileName(List<String> uploadFileNames) {
this.uploadFileNames = uploadFileNames;
}
System.out.println("\n\n upload1");
System.out.println("files:");
for (File u: uploads) {
System.out.println("*** "+u+"\t"+u.length());
}
System.out.println("filenames:");
for (String n: uploadFileNames) {
System.out.println("*** "+n);
}
System.out.println("content types:");
for (String c: uploadContentTypes) {
System.out.println("*** "+c);
}
System.out.println("\n\n");
return SUCCESS;
}
public List<String> getUploadContentType() {
return this.uploadContentTypes;
}
public void setUploadContentType(List<String> contentTypes) {
this.uploadContentTypes = contentTypes;
}
public String upload() throws Exception {
System.out.println("\n\n upload1");
System.out.println("files:");
for (File u : uploads) {
System.out.println("*** " + u + "\t" + u.length());
}
System.out.println("filenames:");
for (String n : uploadFileNames) {
System.out.println("*** " + n);
}
System.out.println("content types:");
for (String c : uploadContentTypes) {
System.out.println("*** " + c);
}
System.out.println("\n\n");
return SUCCESS;
}
}
// END SNIPPET: entire-file
@@ -20,39 +20,37 @@
*/
package org.apache.struts2.showcase.freemarker;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.opensymphony.xwork2.util.ValueStack;
import org.apache.struts2.views.freemarker.FreemarkerManager;
import org.apache.struts2.views.freemarker.ScopesHashModel;
import com.opensymphony.xwork2.ognl.OgnlValueStack;
import com.opensymphony.xwork2.util.ValueStack;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* This is an example of a custom FreemarkerManager, mean to be
* instantiated through Spring.
* <p/>
*
* <p/>
* It will add into Freemarker's model
* an utility class called {@link CustomFreemarkerManagerUtil} as a simple
* example demonstrating how to extends FreemarkerManager.
* <p/>
*
* <p/>
* The {@link CustomFreemarkerManagerUtil} will be created by Spring and
* injected through constructor injection.
* <p/>
*/
public class CustomFreemarkerManager extends FreemarkerManager {
private CustomFreemarkerManagerUtil util;
private CustomFreemarkerManagerUtil util;
public CustomFreemarkerManager(CustomFreemarkerManagerUtil util) {
this.util = util;
}
public CustomFreemarkerManager(CustomFreemarkerManagerUtil util) {
this.util = util;
}
protected void populateContext(ScopesHashModel model, ValueStack stack, Object action, HttpServletRequest request, HttpServletResponse response) {
super.populateContext(model, stack, action, request, response);
model.put("customFreemarkerManagerUtil", util);
}
protected void populateContext(ScopesHashModel model, ValueStack stack, Object action, HttpServletRequest request, HttpServletResponse response) {
super.populateContext(model, stack, action, request, response);
model.put("customFreemarkerManagerUtil", util);
}
}
@@ -30,13 +30,13 @@ import java.util.Date;
*/
public class CustomFreemarkerManagerUtil {
public String getTodayDate() {
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
return sdf.format(new Date());
}
public String getTodayDate() {
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
return sdf.format(new Date());
}
public String getTimeNow() {
SimpleDateFormat sdf = new SimpleDateFormat("hh:mm:ss");
return sdf.format(new Date());
}
public String getTimeNow() {
SimpleDateFormat sdf = new SimpleDateFormat("hh:mm:ss");
return sdf.format(new Date());
}
}
@@ -30,38 +30,38 @@ import java.text.DateFormatSymbols;
*/
public class StandardTagsAction extends ActionSupport implements Preparable {
private String name;
private String[] gender;
private String[] months;
private String name;
private String[] gender;
private String[] months;
public void prepare() {
months = new DateFormatSymbols().getMonths();
name = StandardTagsAction.class.getName().substring(StandardTagsAction.class.getName().lastIndexOf(".")+1);
gender = new String[] { "Male", "Femal" };
}
public void prepare() {
months = new DateFormatSymbols().getMonths();
name = StandardTagsAction.class.getName().substring(StandardTagsAction.class.getName().lastIndexOf(".") + 1);
gender = new String[]{"Male", "Femal"};
}
public String getName() {
return name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public void setName(String name) {
this.name = name;
}
public String[] getMonths() {
return months;
}
public String[] getMonths() {
return months;
}
public void setMonths(String[] months) {
this.months = months;
}
public void setMonths(String[] months) {
this.months = months;
}
public String[] getGender() {
return gender;
}
public String[] getGender() {
return gender;
}
public void setGender(String[] gender) {
this.gender = gender;
}
public void setGender(String[] gender) {
this.gender = gender;
}
}
@@ -20,40 +20,40 @@
*/
package org.apache.struts2.showcase.hangman;
import java.util.Map;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.interceptor.SessionAware;
import com.opensymphony.xwork2.ActionSupport;
import java.util.Map;
public class GetUpdatedHangmanAction extends ActionSupport implements SessionAware {
private static final long serialVersionUID = 5506025785406043027L;
private static final long serialVersionUID = 5506025785406043027L;
private Map session;
private Hangman hangman;
private Map session;
private Hangman hangman;
public String execute() throws Exception {
hangman = (Hangman) session.get(HangmanConstants.HANGMAN_SESSION_KEY);
public String execute() throws Exception {
hangman = (Hangman) session.get(HangmanConstants.HANGMAN_SESSION_KEY);
System.out.println("\n\n\n");
System.out.println("hangman="+hangman);
System.out.println("available = "+hangman.getCharactersAvailable().size());
System.out.println("guess left="+hangman.guessLeft());
System.out.println("\n\n\n");
System.out.println("\n\n\n");
System.out.println("hangman=" + hangman);
System.out.println("available = " + hangman.getCharactersAvailable().size());
System.out.println("guess left=" + hangman.guessLeft());
System.out.println("\n\n\n");
return SUCCESS;
}
return SUCCESS;
}
public void setSession(Map session) {
this.session = session;
}
public void setSession(Map session) {
this.session = session;
}
public Hangman getHangman() {
return hangman;
}
public void setHangman(Hangman hangman) {
this.hangman = hangman;
}
public Hangman getHangman() {
return hangman;
}
public void setHangman(Hangman hangman) {
this.hangman = hangman;
}
}
@@ -20,40 +20,39 @@
*/
package org.apache.struts2.showcase.hangman;
import java.util.Map;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.interceptor.SessionAware;
import com.opensymphony.xwork2.ActionSupport;
import java.util.Map;
public class GuessCharacterAction extends ActionSupport implements SessionAware {
private static final long serialVersionUID = 9050915577007590674L;
private static final long serialVersionUID = 9050915577007590674L;
private Map session;
private Character character;
private Hangman hangman;
private Map session;
private Character character;
private Hangman hangman;
public String execute() throws Exception {
hangman = (Hangman) session.get(HangmanConstants.HANGMAN_SESSION_KEY);
hangman.guess(character);
public String execute() throws Exception {
hangman = (Hangman) session.get(HangmanConstants.HANGMAN_SESSION_KEY);
hangman.guess(character);
return SUCCESS;
}
return SUCCESS;
}
public Hangman getHangman() {
return hangman;
}
public Hangman getHangman() {
return hangman;
}
public void setSession(Map session) {
this.session = session;
}
public void setSession(Map session) {
this.session = session;
}
public void setCharacter(Character character) {
this.character = character;
}
public void setCharacter(Character character) {
this.character = character;
}
public Character getCharacter() {
return this.character;
}
public Character getCharacter() {
return this.character;
}
}
@@ -27,83 +27,83 @@ import java.util.List;
public class Hangman implements Serializable {
private static final long serialVersionUID = 8566954355839652509L;
private static final long serialVersionUID = 8566954355839652509L;
private Vocab vocab;
private Vocab vocab;
private Boolean win = false;
private Boolean win = false;
private int guessLeft = 5;
public List<Character> charactersAvailable;
public List<Character> charactersGuessed;
private int guessLeft = 5;
public List<Character> charactersAvailable;
public List<Character> charactersGuessed;
public Hangman(Vocab vocab) {
// Arrays.asList(...) returns List that doesn't support remove(), hence
// we wrap it with an ArrayList to avoid UnsupportedOperationException
// when doing a remove()
charactersAvailable = new ArrayList<Character>(Arrays.asList(
new Character[] {
Character.valueOf('A'), Character.valueOf('B'), Character.valueOf('C'),
Character.valueOf('D'), Character.valueOf('E'), Character.valueOf('F'),
Character.valueOf('G'), Character.valueOf('H'), Character.valueOf('I'),
Character.valueOf('J'), Character.valueOf('K'), Character.valueOf('L'),
Character.valueOf('M'), Character.valueOf('N'), Character.valueOf('O'),
Character.valueOf('P'), Character.valueOf('Q'), Character.valueOf('R'),
Character.valueOf('S'), Character.valueOf('T'), Character.valueOf('U'),
Character.valueOf('V'), Character.valueOf('W'), Character.valueOf('X'),
Character.valueOf('Y'), Character.valueOf('Z')
}));
charactersGuessed = new ArrayList<Character>();
this.vocab = vocab;
}
public Hangman(Vocab vocab) {
// Arrays.asList(...) returns List that doesn't support remove(), hence
// we wrap it with an ArrayList to avoid UnsupportedOperationException
// when doing a remove()
charactersAvailable = new ArrayList<Character>(Arrays.asList(
new Character[]{
Character.valueOf('A'), Character.valueOf('B'), Character.valueOf('C'),
Character.valueOf('D'), Character.valueOf('E'), Character.valueOf('F'),
Character.valueOf('G'), Character.valueOf('H'), Character.valueOf('I'),
Character.valueOf('J'), Character.valueOf('K'), Character.valueOf('L'),
Character.valueOf('M'), Character.valueOf('N'), Character.valueOf('O'),
Character.valueOf('P'), Character.valueOf('Q'), Character.valueOf('R'),
Character.valueOf('S'), Character.valueOf('T'), Character.valueOf('U'),
Character.valueOf('V'), Character.valueOf('W'), Character.valueOf('X'),
Character.valueOf('Y'), Character.valueOf('Z')
}));
charactersGuessed = new ArrayList<Character>();
this.vocab = vocab;
}
public void guess(Character character) {
assert(character != null);
public void guess(Character character) {
assert (character != null);
synchronized(charactersAvailable) {
if (guessLeft < 0) {
throw new HangmanException(
HangmanException.Type.valueOf("GAME_ENDED"), "Game already eneded");
}
Character characterInUpperCase = Character.toUpperCase(character);
boolean ok = charactersAvailable.remove(characterInUpperCase);
if (ok) {
charactersGuessed.add(characterInUpperCase);
if (! vocab.containCharacter(characterInUpperCase)) {
guessLeft = guessLeft - 1;
}
}
if (vocab.containsAllCharacter(charactersGuessed)) {
win = true;
}
System.out.println(" *********************************** "+win);
}
}
synchronized (charactersAvailable) {
if (guessLeft < 0) {
throw new HangmanException(
HangmanException.Type.valueOf("GAME_ENDED"), "Game already eneded");
}
Character characterInUpperCase = Character.toUpperCase(character);
boolean ok = charactersAvailable.remove(characterInUpperCase);
if (ok) {
charactersGuessed.add(characterInUpperCase);
if (!vocab.containCharacter(characterInUpperCase)) {
guessLeft = guessLeft - 1;
}
}
if (vocab.containsAllCharacter(charactersGuessed)) {
win = true;
}
System.out.println(" *********************************** " + win);
}
}
public Boolean isWin() {
return this.win;
}
public Boolean isWin() {
return this.win;
}
public Vocab getVocab() {
return vocab;
}
public Vocab getVocab() {
return vocab;
}
public Boolean gameEnded() {
return ((guessLeft < 0) || win);
}
public Boolean gameEnded() {
return ((guessLeft < 0) || win);
}
public Integer guessLeft() {
return guessLeft;
}
public Integer guessLeft() {
return guessLeft;
}
public List<Character> getCharactersAvailable() {
synchronized(charactersAvailable) {
return new ArrayList<Character>(charactersAvailable);
//return charactersAvailable;
}
}
public List<Character> getCharactersAvailable() {
synchronized (charactersAvailable) {
return new ArrayList<Character>(charactersAvailable);
//return charactersAvailable;
}
}
public boolean characterGuessedBefore(Character character) {
return charactersGuessed.contains(character);
}
public boolean characterGuessedBefore(Character character) {
return charactersGuessed.contains(character);
}
}
@@ -21,6 +21,6 @@
package org.apache.struts2.showcase.hangman;
public class HangmanConstants {
// keeps a Hangman object in HttpSession
public static final String HANGMAN_SESSION_KEY = "Hangman_Session_Key";
// keeps a Hangman object in HttpSession
public static final String HANGMAN_SESSION_KEY = "Hangman_Session_Key";
}

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