mirror of
https://github.com/apache/struts.git
synced 2026-08-09 08:36:54 +00:00
Compare commits
63 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 17e14ef42b | |||
| d75a890482 | |||
| d06689120d | |||
| fb92c67d13 | |||
| 6e07a63797 | |||
| b462286589 | |||
| 4f07433626 | |||
| cd13846e19 | |||
| f096dd611e | |||
| cfcefcf589 | |||
| 8dfe178585 | |||
| d5e0fe9207 | |||
| a2de255697 | |||
| e8aa825f21 | |||
| a0fdca138f | |||
| 7621c2bc92 | |||
| b866e0e880 | |||
| 08360cb916 | |||
| 1afb48aa76 | |||
| ca256a74e9 | |||
| e60119436a | |||
| 7da4ef3902 | |||
| ce294b48df | |||
| 04e5e9dde8 | |||
| e28e5f03a6 | |||
| 39cc611d72 | |||
| dd3b80f2be | |||
| 0d92fd0ee5 | |||
| 7985fd191a | |||
| e0b13a5b0b | |||
| 8fea9566a9 | |||
| 2cd28b160e | |||
| 30b74a3f01 | |||
| dce6d3e110 | |||
| c70f2409f2 | |||
| 175d0d42db | |||
| 095960b569 | |||
| 9b34a28190 | |||
| 880c1d54a4 | |||
| 9e11b2c2b1 | |||
| d06c71d68e | |||
| ffdacf1b60 | |||
| f9e4a5e676 | |||
| b4facc8e06 | |||
| 6b360108e5 | |||
| 104bd92b88 | |||
| a44c7bc13d | |||
| dbf744f54b | |||
| 27ca165ddb | |||
| d16aa65098 | |||
| 8b688cc38d | |||
| 3a78fd1a11 | |||
| ca74ac36fc | |||
| 47cf4ff84b | |||
| 379b75292e | |||
| 6bb1ec67ad | |||
| a5d7163939 | |||
| da8b13a87e | |||
| 8b8135af79 | |||
| 2fada1ec05 | |||
| bab451c6d8 | |||
| 0d49050381 | |||
| fab687a07e |
@@ -11,6 +11,9 @@
|
||||
.metadata/
|
||||
Servers/
|
||||
|
||||
#VSCode
|
||||
.vscode
|
||||
|
||||
# OSX
|
||||
.DS_Store
|
||||
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-parent</artifactId>
|
||||
<version>2.5</version>
|
||||
<version>2.5.2</version>
|
||||
</parent>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
<version>2.5</version>
|
||||
<version>2.5.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-portlet</artifactId>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="edit" extends="struts-portlet-default"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="eventing" extends="struts-portlet-default" namespace="/eventing">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="help" extends="struts-portlet-default"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="tiles" extends="struts-portlet-tiles-default" namespace="/tiles">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="view" extends="struts-portlet-default"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
<include file="struts-view.xml"/>
|
||||
|
||||
@@ -26,12 +26,12 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
<version>2.5</version>
|
||||
<version>2.5.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-rest-showcase</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>2.5</version>
|
||||
<version>2.5.2</version>
|
||||
<name>Struts 2 Rest Showcase Webapp</name>
|
||||
<description>Struts 2 Rest Showcase Example</description>
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
<version>2.5</version>
|
||||
<version>2.5.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-showcase</artifactId>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="actionchaining" extends="struts-default" namespace="/actionchaining">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="conversion" namespace="/conversion" extends="struts-default">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="filedownload" extends="struts-default" namespace="/filedownload">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="fileupload" extends="struts-default" namespace="/fileupload">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="freemarker" namespace="/freemarker" extends="struts-default">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="hangman" extends="struts-default" namespace="/hangman">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="interactive" namespace="/interactive" extends="struts-default">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="modelDriven" extends="struts-default" namespace="/modelDriven">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<!-- START SNIPPET: xworkSample -->
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="ui-tags" extends="struts-default" namespace="/tags/ui">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
<include file="struts-tags-ui.xml"/>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="tiles" extends="tiles-default" namespace="/tiles">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
<struts>
|
||||
<package name="token" extends="struts-default" namespace="/token">
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="wait" extends="struts-default" namespace="/wait">
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="xslt" extends="struts-default" namespace="/xslt">
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<!-- START SNIPPET: xworkSample -->
|
||||
<struts>
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-parent</artifactId>
|
||||
<version>2.5</version>
|
||||
<version>2.5.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-archetypes</artifactId>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-archetypes</artifactId>
|
||||
<version>2.5</version>
|
||||
<version>2.5.2</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
<struts>
|
||||
|
||||
<constant name="struts.enable.DynamicMethodInvocation" value="false"/>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-archetypes</artifactId>
|
||||
<version>2.5</version>
|
||||
<version>2.5.2</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
<!--
|
||||
- This file is included by the struts.xml file as an example
|
||||
- of how to break up the configuration file into multiple files.
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
<struts>
|
||||
<constant name="struts.enable.DynamicMethodInvocation" value="false"/>
|
||||
<constant name="struts.devMode" value="true"/>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-archetypes</artifactId>
|
||||
<version>2.5</version>
|
||||
<version>2.5.2</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
<struts>
|
||||
|
||||
<constant name="struts.enable.DynamicMethodInvocation" value="false"/>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-archetypes</artifactId>
|
||||
<version>2.5</version>
|
||||
<version>2.5.2</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
<constant name="struts.convention.default.parent.package" value="struts-portlet-default" />
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-archetypes</artifactId>
|
||||
<version>2.5</version>
|
||||
<version>2.5.2</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-archetypes</artifactId>
|
||||
<version>2.5</version>
|
||||
<version>2.5.2</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="default" extends="struts-portlet-default" namespace="/view">
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-archetypes</artifactId>
|
||||
<version>2.5</version>
|
||||
<version>2.5.2</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-parent</artifactId>
|
||||
<version>2.5</version>
|
||||
<version>2.5.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-assembly</artifactId>
|
||||
|
||||
+3
-8
@@ -10,7 +10,7 @@
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-bom</artifactId>
|
||||
<version>2.5</version>
|
||||
<version>2.5.2</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>Struts 2 Bill of Materials</name>
|
||||
@@ -25,7 +25,7 @@
|
||||
</licenses>
|
||||
|
||||
<properties>
|
||||
<struts-version.version>2.5</struts-version.version>
|
||||
<struts-version.version>2.5.2</struts-version.version>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
@@ -43,11 +43,6 @@
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.struts.xwork</groupId>
|
||||
<artifactId>xwork-core</artifactId>
|
||||
<version>${struts-version.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-core</artifactId>
|
||||
@@ -177,6 +172,6 @@
|
||||
</dependencyManagement>
|
||||
|
||||
<scm>
|
||||
<tag>STRUTS_2_5</tag>
|
||||
<tag>STRUTS_2_5_2</tag>
|
||||
</scm>
|
||||
</project>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-osgi-bundles</artifactId>
|
||||
<version>2.5</version>
|
||||
<version>2.5.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-osgi-admin-bundle</artifactId>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-osgi-bundles</artifactId>
|
||||
<version>2.5</version>
|
||||
<version>2.5.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-osgi-demo-bundle</artifactId>
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-parent</artifactId>
|
||||
<version>2.5</version>
|
||||
<version>2.5.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-osgi-bundles</artifactId>
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-parent</artifactId>
|
||||
<version>2.5</version>
|
||||
<version>2.5.2</version>
|
||||
</parent>
|
||||
<artifactId>struts2-core</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
@@ -156,10 +156,6 @@ public class ActionSupport implements Action, Validateable, ValidationAware, Tex
|
||||
return INPUT;
|
||||
}
|
||||
|
||||
public String doDefault() throws Exception {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* A default implementation that does nothing an returns "success".
|
||||
*
|
||||
|
||||
@@ -419,7 +419,7 @@ public class DefaultActionInvocation implements ActionInvocation {
|
||||
|
||||
Object methodResult;
|
||||
try {
|
||||
methodResult = ognlUtil.getValue(methodName + "()", getStack().getContext(), action);
|
||||
methodResult = ognlUtil.callMethod(methodName + "()", getStack().getContext(), action);
|
||||
} catch (MethodFailedException e) {
|
||||
// if reason is missing method, try checking UnknownHandlers
|
||||
if (e.getReason() instanceof NoSuchMethodException) {
|
||||
|
||||
@@ -197,22 +197,30 @@ public class DefaultActionProxy implements ActionProxy, Serializable {
|
||||
if (config.isAllowedMethod(method)) {
|
||||
invocation.init(this);
|
||||
} else {
|
||||
throw new ConfigurationException("This method: " + method + " for action " + actionName + " is not allowed!");
|
||||
throw new ConfigurationException(prepareNotAllowedErrorMessage());
|
||||
}
|
||||
} finally {
|
||||
UtilTimerStack.pop(profileKey);
|
||||
}
|
||||
}
|
||||
|
||||
protected String prepareNotAllowedErrorMessage() {
|
||||
return LocalizedTextUtil.findDefaultText(
|
||||
"struts.exception.method-not-allowed",
|
||||
Locale.getDefault(),
|
||||
new String[]{method, actionName}
|
||||
);
|
||||
}
|
||||
|
||||
protected String getErrorMessage() {
|
||||
if ((namespace != null) && (namespace.trim().length() > 0)) {
|
||||
return LocalizedTextUtil.findDefaultText(
|
||||
XWorkMessages.MISSING_PACKAGE_ACTION_EXCEPTION,
|
||||
"xwork.exception.missing-package-action",
|
||||
Locale.getDefault(),
|
||||
new String[]{namespace, actionName});
|
||||
} else {
|
||||
return LocalizedTextUtil.findDefaultText(
|
||||
XWorkMessages.MISSING_ACTION_EXCEPTION,
|
||||
"xwork.exception.missing-action",
|
||||
Locale.getDefault(),
|
||||
new String[]{actionName});
|
||||
}
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2006,2009 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.opensymphony.xwork2;
|
||||
|
||||
|
||||
/**
|
||||
* Contains constants for some default XWork messages.
|
||||
*
|
||||
* @author Jason Carreira
|
||||
*/
|
||||
public interface XWorkMessages {
|
||||
|
||||
public static final String ACTION_EXECUTION_ERROR = "xwork.error.action.execution";
|
||||
public static final String MISSING_ACTION_EXCEPTION = "xwork.exception.missing-action";
|
||||
public static final String MISSING_PACKAGE_ACTION_EXCEPTION = "xwork.exception.missing-package-action";
|
||||
public static final String DEFAULT_INVALID_FIELDVALUE = "xwork.default.invalid.fieldvalue";
|
||||
|
||||
}
|
||||
@@ -346,6 +346,13 @@ public class PackageConfig extends Located implements Comparable, Serializable,
|
||||
return globalExceptionMappingConfigs;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the GlobalAllowedMethods local to this package
|
||||
*
|
||||
* @return a Set of method names allowed to be executed if strict method invocation is enabled
|
||||
*/
|
||||
public Set<String> getGlobalAllowedMethods() { return Collections.unmodifiableSet(globalAllowedMethods); }
|
||||
|
||||
public boolean isStrictMethodInvocation() {
|
||||
return strictMethodInvocation;
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ public class XWorkConverter extends DefaultTypeConverter {
|
||||
}
|
||||
|
||||
public static String getConversionErrorMessage(String propertyName, ValueStack stack) {
|
||||
String defaultMessage = LocalizedTextUtil.findDefaultText(XWorkMessages.DEFAULT_INVALID_FIELDVALUE,
|
||||
String defaultMessage = LocalizedTextUtil.findDefaultText("xwork.default.invalid.fieldvalue",
|
||||
ActionContext.getContext().getLocale(),
|
||||
new Object[]{
|
||||
propertyName
|
||||
|
||||
+1
-1
@@ -205,7 +205,7 @@ public class StaticParametersInterceptor extends AbstractInterceptor {
|
||||
|
||||
/**
|
||||
* Adds the parameters into context's ParameterMap.
|
||||
* As default, static parameters will not overwrite existing paramaters from other sources.
|
||||
* As default, static parameters will not overwrite existing parameters from other sources.
|
||||
* If you want the static parameters as successor over already existing parameters, set overwrite to <tt>true</tt>.
|
||||
*
|
||||
* @param ac The action context
|
||||
|
||||
@@ -289,6 +289,9 @@ public class OgnlUtil {
|
||||
if (isEvalExpression(tree, context)) {
|
||||
throw new OgnlException("Eval expression/chained expressions cannot be used as parameter name");
|
||||
}
|
||||
if (isArithmeticExpression(tree, context)) {
|
||||
throw new OgnlException("Arithmetic expressions cannot be used as parameter name");
|
||||
}
|
||||
Ognl.setValue(tree, context, root, value);
|
||||
return null;
|
||||
}
|
||||
@@ -308,6 +311,32 @@ public class OgnlUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isArithmeticExpression(Object tree, Map<String, Object> context) throws OgnlException {
|
||||
if (tree instanceof SimpleNode) {
|
||||
SimpleNode node = (SimpleNode) tree;
|
||||
OgnlContext ognlContext = null;
|
||||
|
||||
if (context!=null && context instanceof OgnlContext) {
|
||||
ognlContext = (OgnlContext) context;
|
||||
}
|
||||
return node.isOperation(ognlContext);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isSimpleMethod(Object tree, Map<String, Object> context) throws OgnlException {
|
||||
if (tree instanceof SimpleNode) {
|
||||
SimpleNode node = (SimpleNode) tree;
|
||||
OgnlContext ognlContext = null;
|
||||
|
||||
if (context!=null && context instanceof OgnlContext) {
|
||||
ognlContext = (OgnlContext) context;
|
||||
}
|
||||
return node.isSimpleMethod(ognlContext) && !node.isChain(ognlContext);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public Object getValue(final String name, final Map<String, Object> context, final Object root) throws OgnlException {
|
||||
return compileAndExecute(name, context, new OgnlTask<Object>() {
|
||||
public Object execute(Object tree) throws OgnlException {
|
||||
@@ -316,6 +345,14 @@ public class OgnlUtil {
|
||||
});
|
||||
}
|
||||
|
||||
public Object callMethod(final String name, final Map<String, Object> context, final Object root) throws OgnlException {
|
||||
return compileAndExecuteMethod(name, context, new OgnlTask<Object>() {
|
||||
public Object execute(Object tree) throws OgnlException {
|
||||
return Ognl.getValue(tree, context, root);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public Object getValue(final String name, final Map<String, Object> context, final Object root, final Class resultType) throws OgnlException {
|
||||
return compileAndExecute(name, context, new OgnlTask<Object>() {
|
||||
public Object execute(Object tree) throws OgnlException {
|
||||
@@ -350,6 +387,27 @@ public class OgnlUtil {
|
||||
return exec;
|
||||
}
|
||||
|
||||
private <T> Object compileAndExecuteMethod(String expression, Map<String, Object> context, OgnlTask<T> task) throws OgnlException {
|
||||
Object tree;
|
||||
if (enableExpressionCache) {
|
||||
tree = expressions.get(expression);
|
||||
if (tree == null) {
|
||||
tree = Ognl.parseExpression(expression);
|
||||
checkSimpleMethod(tree, context);
|
||||
}
|
||||
} else {
|
||||
tree = Ognl.parseExpression(expression);
|
||||
checkSimpleMethod(tree, context);
|
||||
}
|
||||
|
||||
final T exec = task.execute(tree);
|
||||
// if cache is enabled and it's a valid expression, puts it in
|
||||
if(enableExpressionCache) {
|
||||
expressions.putIfAbsent(expression, tree);
|
||||
}
|
||||
return exec;
|
||||
}
|
||||
|
||||
public Object compile(String expression, Map<String, Object> context) throws OgnlException {
|
||||
return compileAndExecute(expression,context,new OgnlTask<Object>() {
|
||||
public Object execute(Object tree) throws OgnlException {
|
||||
@@ -364,6 +422,12 @@ public class OgnlUtil {
|
||||
}
|
||||
}
|
||||
|
||||
private void checkSimpleMethod(Object tree, Map<String, Object> context) throws OgnlException {
|
||||
if (!isSimpleMethod(tree, context)) {
|
||||
throw new OgnlException("It isn't a simple method which can be called!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies the properties in the object "from" and sets them in the object "to"
|
||||
* using specified type converter, or {@link com.opensymphony.xwork2.conversion.impl.XWorkConverter} if none
|
||||
|
||||
+1
-1
@@ -184,7 +184,7 @@ public class DelegatingValidatorContext implements ValidatorContext {
|
||||
}
|
||||
|
||||
public static TextProvider makeTextProvider(Object object, LocaleProvider localeProvider) {
|
||||
// the object argument passed through here will most probably be an ActionSupport decendant which does
|
||||
// the object argument passed through here will most probably be an ActionSupport descendant which does
|
||||
// implements TextProvider.
|
||||
if (object != null && object instanceof DelegatingValidatorContext) {
|
||||
return ((DelegatingValidatorContext) object).getTextProvider();
|
||||
|
||||
@@ -23,7 +23,7 @@ package com.opensymphony.xwork2.validator.validators;
|
||||
* The regular expression used to validate that the string is an email address is:
|
||||
*
|
||||
* <pre>
|
||||
* \\b^['_a-z0-9-\\+]+(\\.['_a-z0-9-\\+]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*\\.([a-z]{2}|aero|arpa|asia|biz|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|nato|net|org|pro|tech|tel|travel|xxx)$\\b
|
||||
* \\b^['_a-z0-9-\\+]+(\\.['_a-z0-9-\\+]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*\\.([a-z]{2}|aero|arpa|asia|biz|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|nato|net|org|pro|tel|travel|xxx|tech|cat)$\\b
|
||||
* </pre>
|
||||
*
|
||||
* You can also specify expression, caseSensitive and trim params as a OGNL expression, see the example below.
|
||||
@@ -80,7 +80,7 @@ public class EmailValidator extends RegexFieldValidator {
|
||||
|
||||
// see XW-371
|
||||
public static final String EMAIL_ADDRESS_PATTERN =
|
||||
"\\b^['_a-z0-9-\\+]+(\\.['_a-z0-9-\\+]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*\\.([a-z]{2}|aero|arpa|asia|biz|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|nato|net|org|pro|tech|tel|travel|xxx)$\\b";
|
||||
"\\b^['_a-z0-9-\\+]+(\\.['_a-z0-9-\\+]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*\\.([a-z]{2}|aero|arpa|asia|biz|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|nato|net|org|pro|tel|travel|xxx|tech|cat)$\\b";
|
||||
|
||||
public EmailValidator() {
|
||||
setRegex(EMAIL_ADDRESS_PATTERN);
|
||||
|
||||
@@ -81,7 +81,7 @@ public class URLValidator extends FieldValidatorSupport {
|
||||
"|((\\d|[1-9]\\d|1\\d{2}|2[0-4][0-9]|25[0-5])\\.){3}" +
|
||||
"(\\d|[1-9]\\d|1\\d{2}|2[0-4][0-9]|25[0-5])" +
|
||||
")(:\\d+)?" +
|
||||
")(((\\/+([a-z0-9$_\\.\\+!\\*\\'\\(\\),;:@&=-]|%[0-9a-f]{2})*)*" +
|
||||
")(((\\/{0,1}([a-z0-9$_\\.\\+!\\*\\'\\(\\),;:@&=-]|%[0-9a-f]{2})*)*" +
|
||||
"(\\?([a-z0-9$_\\.\\+!\\*\\'\\(\\),;:@&=-]|%[0-9a-f]{2})*)" +
|
||||
"?)?)?" +
|
||||
"(#([a-z0-9$_\\.\\+!\\*\\'\\(\\),;:@&=-]|%[0-9a-f]{2})*)?" +
|
||||
|
||||
@@ -36,7 +36,7 @@ import java.util.Map;
|
||||
* <!-- START SNIPPET: javadoc -->
|
||||
* <p>
|
||||
* Note that the doublelistkey and doublelistvalue attribute will default to "key" and "value"
|
||||
* respectively only when the doublelist attribute is evaluated to a Map or its decendant.
|
||||
* respectively only when the doublelist attribute is evaluated to a Map or its descendant.
|
||||
* Other thing else, will result in doublelistkey and doublelistvalue to be null and not used.
|
||||
* </p>
|
||||
*
|
||||
|
||||
@@ -21,7 +21,13 @@
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import java.io.Writer;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import org.apache.struts2.views.annotations.StrutsTag;
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
import org.apache.struts2.StrutsException;
|
||||
|
||||
import com.opensymphony.xwork2.LocaleProvider;
|
||||
import com.opensymphony.xwork2.TextProvider;
|
||||
import com.opensymphony.xwork2.TextProviderFactory;
|
||||
@@ -31,13 +37,6 @@ import com.opensymphony.xwork2.util.LocalizedTextUtil;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.struts2.StrutsException;
|
||||
import org.apache.struts2.views.annotations.StrutsTag;
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
|
||||
import java.io.Writer;
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: javadoc -->
|
||||
@@ -92,6 +91,8 @@ public class I18n extends Component {
|
||||
protected String name;
|
||||
protected Container container;
|
||||
private TextProvider textProvider;
|
||||
private TextProvider defaultTextProvider;
|
||||
private LocaleProvider localeProvider;
|
||||
|
||||
public I18n(ValueStack stack) {
|
||||
super(stack);
|
||||
@@ -102,26 +103,31 @@ public class I18n extends Component {
|
||||
this.container = container;
|
||||
}
|
||||
|
||||
@Inject
|
||||
public void setTextProvider(TextProvider textProvider) {
|
||||
this.defaultTextProvider = textProvider;
|
||||
}
|
||||
|
||||
@Inject
|
||||
public void setLocaleProvider(LocaleProvider localeProvider) {
|
||||
this.localeProvider = localeProvider;
|
||||
}
|
||||
|
||||
public boolean start(Writer writer) {
|
||||
boolean result = super.start(writer);
|
||||
|
||||
try {
|
||||
String name = this.findString(this.name, "name", "Resource bundle name is required. Example: foo or foo_en");
|
||||
ResourceBundle bundle = (ResourceBundle) findValue("getTexts('" + name + "')");
|
||||
ResourceBundle bundle = defaultTextProvider.getTexts(name);
|
||||
|
||||
if (bundle == null) {
|
||||
bundle = LocalizedTextUtil.findResourceBundle(name, (Locale) getStack().getContext().get(ActionContext.LOCALE));
|
||||
bundle = LocalizedTextUtil.findResourceBundle(name, localeProvider.getLocale());
|
||||
}
|
||||
|
||||
if (bundle != null) {
|
||||
final Locale locale = (Locale) getStack().getContext().get(ActionContext.LOCALE);
|
||||
TextProviderFactory tpf = new TextProviderFactory();
|
||||
container.inject(tpf);
|
||||
textProvider = tpf.createInstance(bundle, new LocaleProvider() {
|
||||
public Locale getLocale() {
|
||||
return locale;
|
||||
}
|
||||
});
|
||||
textProvider = tpf.createInstance(bundle, localeProvider);
|
||||
getStack().push(textProvider);
|
||||
pushed = true;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ import java.util.Map;
|
||||
* <!-- START SNIPPET: javadoc -->
|
||||
* <p>
|
||||
* Note that the listkey and listvalue attribute will default to "key" and "value"
|
||||
* respectively only when the list attribute is evaluated to a Map or its decendant.
|
||||
* respectively only when the list attribute is evaluated to a Map or its descendant.
|
||||
* Everything else will result in listkey and listvalue to be null and not used.
|
||||
* </p>
|
||||
* <!-- END SNIPPET: javadoc -->
|
||||
|
||||
@@ -42,7 +42,7 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* <li>application - the value will be set in application scope according to servlet spec. using the name as its key</li>
|
||||
* <li>session - the value will be set in session scope according to servlet spec. using the name as key </li>
|
||||
* <li>request - the value will be set in request scope according to servlet spec. using the name as key </li>
|
||||
* <li>page - the value will be set in page scope according to servlet sepc. using the name as key</li>
|
||||
* <li>page - the value will be set in page scope according to servlet spec. using the name as key</li>
|
||||
* <li>action - the value will be set in the request scope and Struts' action context using the name as key</li>
|
||||
* </ul>
|
||||
*
|
||||
|
||||
@@ -34,6 +34,7 @@ import org.apache.logging.log4j.Logger;
|
||||
import org.apache.struts2.RequestUtils;
|
||||
import org.apache.struts2.ServletActionContext;
|
||||
import org.apache.struts2.StrutsConstants;
|
||||
import org.apache.struts2.StrutsException;
|
||||
import org.apache.struts2.util.PrefixTrie;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -119,7 +120,7 @@ public class DefaultActionMapper implements ActionMapper {
|
||||
protected boolean allowSlashesInActionNames = false;
|
||||
protected boolean alwaysSelectFullNamespace = false;
|
||||
protected PrefixTrie prefixTrie = null;
|
||||
protected Pattern allowedActionNames = Pattern.compile("[a-zA-Z0-9._!/\\-]*");
|
||||
protected Pattern allowedActionNames = Pattern.compile("^[a-zA-Z0-9_!/\\-]*((.htm[l]?)|(.action))?$");
|
||||
private boolean allowActionPrefix = false;
|
||||
private boolean allowActionCrossNamespaceAccess = false;
|
||||
|
||||
@@ -385,14 +386,7 @@ public class DefaultActionMapper implements ActionMapper {
|
||||
if (allowedActionNames.matcher(rawActionName).matches()) {
|
||||
return rawActionName;
|
||||
} else {
|
||||
LOG.warn("Action [{}] does not match allowed action names pattern [{}], cleaning it up!",
|
||||
rawActionName, allowedActionNames);
|
||||
String cleanActionName = rawActionName;
|
||||
for (String chunk : allowedActionNames.split(rawActionName)) {
|
||||
cleanActionName = cleanActionName.replace(chunk, "");
|
||||
}
|
||||
LOG.debug("Cleaned action name [{}]", cleanActionName);
|
||||
return cleanActionName;
|
||||
throw new StrutsException("Action [" + rawActionName + "] does not match allowed action names pattern [" + allowedActionNames + "]!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import com.opensymphony.xwork2.result.ParamNameAwareResult;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Default implementation which uses {@link com.opensymphony.xwork2.result.ParamNameAwareResult} to accept or throwaway parameters
|
||||
* Default implementation which uses {@link com.opensymphony.xwork2.result.ParamNameAwareResult} to accept or throw away parameters
|
||||
*/
|
||||
public class StrutsResultFactory implements ResultFactory {
|
||||
|
||||
|
||||
+1
-2
@@ -73,8 +73,7 @@ class MessageStorePreResultListener implements PreResultListener {
|
||||
try {
|
||||
ResultConfig resultConfig = invocation.getProxy().getConfig().getResults().get(resultCode);
|
||||
if (resultConfig != null) {
|
||||
isRedirect = ServletRedirectResult.class.getName().equals(resultConfig.getClassName())
|
||||
|| ServletActionRedirectResult.class.getName().equals(resultConfig.getClassName());
|
||||
isRedirect = ServletRedirectResult.class.isAssignableFrom(Class.forName(resultConfig.getClassName()));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.warn("Cannot read result!", e);
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
package org.apache.struts2.result;
|
||||
|
||||
import com.opensymphony.xwork2.ActionInvocation;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -218,15 +217,12 @@ public class StreamResult extends StrutsResultSupport {
|
||||
* @see StrutsResultSupport#doExecute(java.lang.String, com.opensymphony.xwork2.ActionInvocation)
|
||||
*/
|
||||
protected void doExecute(String finalLocation, ActionInvocation invocation) throws Exception {
|
||||
LOG.debug("Find the Response in context");
|
||||
|
||||
// Override any parameters using values on the stack
|
||||
resolveParamsFromStack(invocation.getStack(), invocation);
|
||||
|
||||
// Find the Response in context
|
||||
HttpServletResponse oResponse = (HttpServletResponse) invocation.getInvocationContext().get(HTTP_RESPONSE);
|
||||
try (OutputStream oOutput = oResponse.getOutputStream()) {
|
||||
if (inputStream == null) {
|
||||
// Find the inputstream from the invocation variable stack
|
||||
LOG.debug("Find the inputstream from the invocation variable stack");
|
||||
inputStream = (InputStream) invocation.getStack().findValue(conditionalParse(inputName, invocation));
|
||||
}
|
||||
|
||||
@@ -237,18 +233,17 @@ public class StreamResult extends StrutsResultSupport {
|
||||
throw new IllegalArgumentException(msg);
|
||||
}
|
||||
|
||||
// Set the content type
|
||||
LOG.debug("Set the content type: {};charset{}", contentType, contentCharSet);
|
||||
if (contentCharSet != null && ! contentCharSet.equals("")) {
|
||||
oResponse.setContentType(conditionalParse(contentType, invocation)+";charset="+contentCharSet);
|
||||
}
|
||||
else {
|
||||
oResponse.setContentType(conditionalParse(contentType, invocation)+";charset="+conditionalParse(contentCharSet, invocation));
|
||||
} else {
|
||||
oResponse.setContentType(conditionalParse(contentType, invocation));
|
||||
}
|
||||
|
||||
// Set the content length
|
||||
LOG.debug("Set the content length: {}", contentLength);
|
||||
if (contentLength != null) {
|
||||
String _contentLength = conditionalParse(contentLength, invocation);
|
||||
int _contentLengthAsInt = -1;
|
||||
int _contentLengthAsInt;
|
||||
try {
|
||||
_contentLengthAsInt = Integer.parseInt(_contentLength);
|
||||
if (_contentLengthAsInt >= 0) {
|
||||
@@ -260,12 +255,12 @@ public class StreamResult extends StrutsResultSupport {
|
||||
}
|
||||
}
|
||||
|
||||
// Set the content-disposition
|
||||
LOG.debug("Set the content-disposition: {}", contentDisposition);
|
||||
if (contentDisposition != null) {
|
||||
oResponse.addHeader("Content-Disposition", conditionalParse(contentDisposition, invocation));
|
||||
}
|
||||
|
||||
// Set the cache control headers if neccessary
|
||||
LOG.debug("Set the cache control headers if necessary: {}", allowCaching);
|
||||
if (!allowCaching) {
|
||||
oResponse.addHeader("Pragma", "no-cache");
|
||||
oResponse.addHeader("Cache-Control", "no-cache");
|
||||
@@ -274,7 +269,6 @@ public class StreamResult extends StrutsResultSupport {
|
||||
LOG.debug("Streaming result [{}] type=[{}] length=[{}] content-disposition=[{}] charset=[{}]",
|
||||
inputName, contentType, contentLength, contentDisposition, contentCharSet);
|
||||
|
||||
// Copy input to output
|
||||
LOG.debug("Streaming to output buffer +++ START +++");
|
||||
byte[] oBuff = new byte[bufferSize];
|
||||
int iSize;
|
||||
@@ -289,44 +283,4 @@ public class StreamResult extends StrutsResultSupport {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to lookup the parameters on the stack. Will override any existing parameters
|
||||
*
|
||||
* @param stack The current value stack
|
||||
* @param invocation the action invocation
|
||||
*/
|
||||
protected void resolveParamsFromStack(ValueStack stack, ActionInvocation invocation) {
|
||||
String disposition = stack.findString("contentDisposition");
|
||||
if (disposition != null) {
|
||||
setContentDisposition(disposition);
|
||||
}
|
||||
|
||||
String contentType = stack.findString("contentType");
|
||||
if (contentType != null) {
|
||||
setContentType(contentType);
|
||||
}
|
||||
|
||||
String inputName = stack.findString("inputName");
|
||||
if (inputName != null) {
|
||||
setInputName(inputName);
|
||||
}
|
||||
|
||||
String contentLength = stack.findString("contentLength");
|
||||
if (contentLength != null) {
|
||||
setContentLength(contentLength);
|
||||
}
|
||||
|
||||
Integer bufferSize = (Integer) stack.findValue("bufferSize", Integer.class);
|
||||
if (bufferSize != null) {
|
||||
setBufferSize(bufferSize);
|
||||
}
|
||||
|
||||
if (contentCharSet != null ) {
|
||||
contentCharSet = conditionalParse(contentCharSet, invocation);
|
||||
}
|
||||
else {
|
||||
contentCharSet = stack.findString("contentCharSet");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public abstract class TagModel implements TemplateTransformModel {
|
||||
Object value = entry.getValue();
|
||||
|
||||
if (value != null) {
|
||||
// the value should ALWAYS be a decendant of TemplateModel
|
||||
// the value should ALWAYS be a descendant of TemplateModel
|
||||
if (value instanceof TemplateModel) {
|
||||
try {
|
||||
map.put(entry.getKey(), objectWrapper.unwrap((TemplateModel) value));
|
||||
|
||||
@@ -7,4 +7,4 @@ xwork.error.action.execution=Error during Action invocation
|
||||
xwork.exception.missing-action=There is no Action mapped for action name {0}.
|
||||
xwork.exception.missing-package-action=There is no Action mapped for namespace {0} and action name {1}.
|
||||
xwork.default.invalid.fieldvalue=Invalid field value for field "{0}".
|
||||
|
||||
struts.exception.method-not-allowed=Method {0} for action {1} is not allowed!
|
||||
|
||||
@@ -62,11 +62,11 @@
|
||||
class="label"<#t/>
|
||||
</#if>
|
||||
><#t/>
|
||||
<#if parameters.required!false && parameters.requiredPosition!"right" != 'right'>
|
||||
<#if (parameters.required!false) && ((parameters.requiredPosition!"right") != 'right')>
|
||||
<span class="required">*</span><#t/>
|
||||
</#if>
|
||||
${parameters.label?html}<#t/>
|
||||
<#if parameters.required!false && parameters.requiredPosition!"right" == 'right'>
|
||||
<#if (parameters.required!false) && ((parameters.requiredPosition!"right") == 'right')>
|
||||
<span class="required">*</span><#t/>
|
||||
</#if>
|
||||
${parameters.labelseparator!":"?html}<#t/>
|
||||
|
||||
@@ -21,5 +21,10 @@
|
||||
*/
|
||||
-->
|
||||
<#include "/${parameters.templateDir}/${parameters.expandTheme}/controlheader-core.ftl" />
|
||||
<td
|
||||
<td
|
||||
<#if parameters.align?? >
|
||||
class="align-${parameters.align?html}"
|
||||
<#else >
|
||||
class="tdInput"
|
||||
</#if>
|
||||
><#t/>
|
||||
|
||||
@@ -35,3 +35,10 @@
|
||||
.tdCheckboxErrorMessage {text-align:left; vertical-align:top;}
|
||||
.tdErrorMessage {text-align:center; vertical-align:top;}
|
||||
.formButton {text-align:right;}
|
||||
.tdInput {text-align:left;}
|
||||
|
||||
|
||||
.align-center{text-align:center;}
|
||||
.align-right{text-align:right;}
|
||||
.align-left{text-align:left;}
|
||||
.align-justify{text-align:justify;}
|
||||
|
||||
@@ -64,7 +64,6 @@ public class ActionSupportTest extends XWorkTestCase {
|
||||
}
|
||||
|
||||
assertEquals(Action.INPUT, as.input());
|
||||
assertEquals(Action.SUCCESS, as.doDefault());
|
||||
assertEquals(Action.SUCCESS, as.execute());
|
||||
try {
|
||||
as.clone();
|
||||
@@ -157,7 +156,7 @@ public class ActionSupportTest extends XWorkTestCase {
|
||||
ActionContext.getContext().setLocale(new Locale("da"));
|
||||
MyActionSupport mas = new MyActionSupport();
|
||||
|
||||
assertEquals("santa", mas.doDefault());
|
||||
assertEquals("santa", mas.execute());
|
||||
assertNotNull(mas.getTexts());
|
||||
|
||||
assertEquals(false, mas.hasActionMessages());
|
||||
@@ -331,7 +330,7 @@ public class ActionSupportTest extends XWorkTestCase {
|
||||
private Double val;
|
||||
|
||||
@Override
|
||||
public String doDefault() throws Exception {
|
||||
public String execute() throws Exception {
|
||||
return "santa";
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.opensymphony.xwork2;
|
||||
|
||||
import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;
|
||||
import com.opensymphony.xwork2.mock.MockActionInvocation;
|
||||
import org.apache.struts2.StrutsInternalTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
public class DefaultActionProxyTest extends StrutsInternalTestCase {
|
||||
|
||||
@Test
|
||||
public void testThorwExceptionOnNotAllowedMethod() throws Exception {
|
||||
final String filename = "com/opensymphony/xwork2/config/providers/xwork-test-allowed-methods.xml";
|
||||
loadConfigurationProviders(new XmlConfigurationProvider(filename));
|
||||
DefaultActionProxy dap = new DefaultActionProxy(new MockActionInvocation(), "strict", "Default", "notAllowed", true, true);
|
||||
container.inject(dap);
|
||||
|
||||
try {
|
||||
dap.prepare();
|
||||
fail("Must throw exception!");
|
||||
} catch (Exception e) {
|
||||
assertEquals(e.getMessage(), "Method notAllowed for action Default is not allowed!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -759,6 +759,21 @@ public class OgnlUtilTest extends XWorkTestCase {
|
||||
assertEquals(expected.getMessage(), "Eval expressions/chained expressions have been disabled!");
|
||||
}
|
||||
|
||||
public void testCallMethod() throws Exception {
|
||||
Foo foo = new Foo();
|
||||
|
||||
Exception expected = null;
|
||||
try {
|
||||
ognlUtil.callMethod("#booScope=@myclass@DEFAULT_SCOPE,#bootScope.init()", ognlUtil.createDefaultContext(foo), foo);
|
||||
fail();
|
||||
} catch (OgnlException e) {
|
||||
expected = e;
|
||||
}
|
||||
assertNotNull(expected);
|
||||
assertSame(OgnlException.class, expected.getClass());
|
||||
assertEquals(expected.getMessage(), "It isn't a simple method which can be called!");
|
||||
}
|
||||
|
||||
public static class Email {
|
||||
String address;
|
||||
|
||||
|
||||
@@ -119,24 +119,6 @@ public class SecurityMemberAccessTest extends TestCase {
|
||||
assertTrue("fooLogic() from FooInterface isn't accessible!!!", accessible);
|
||||
}
|
||||
|
||||
public void testMiddleOfInheritanceExclusion2() throws Exception {
|
||||
// given
|
||||
SecurityMemberAccess sma = new SecurityMemberAccess(false);
|
||||
|
||||
String propertyName = "barLogic";
|
||||
Member member = BarInterface.class.getMethod(propertyName);
|
||||
|
||||
Set<Class<?>> excluded = new HashSet<Class<?>>();
|
||||
excluded.add(BarInterface.class);
|
||||
sma.setExcludedClasses(excluded);
|
||||
|
||||
// when
|
||||
boolean accessible = sma.isAccessible(context, target, member, propertyName);
|
||||
|
||||
// then
|
||||
assertFalse("barLogic() from BarInterface is accessible!!!", accessible);
|
||||
}
|
||||
|
||||
public void testMiddleOfInheritanceExclusion3() throws Exception {
|
||||
// given
|
||||
SecurityMemberAccess sma = new SecurityMemberAccess(false);
|
||||
@@ -144,12 +126,6 @@ public class SecurityMemberAccessTest extends TestCase {
|
||||
String propertyName = "barLogic";
|
||||
Member member = BarInterface.class.getMethod(propertyName);
|
||||
|
||||
/*
|
||||
Set<Class<?>> excluded = new HashSet<Class<?>>();
|
||||
excluded.add(BarInterface.class);
|
||||
sma.setExcludedClasses(excluded);
|
||||
*/
|
||||
|
||||
// when
|
||||
boolean accessible = sma.isAccessible(context, target, member, propertyName);
|
||||
|
||||
@@ -256,7 +232,7 @@ public class SecurityMemberAccessTest extends TestCase {
|
||||
public void testAccessStatic() throws Exception {
|
||||
// given
|
||||
SecurityMemberAccess sma = new SecurityMemberAccess(true);
|
||||
sma.setExcludedClasses(new HashSet<Class<?>>(Arrays.<Class<?>>asList(Class.class)));
|
||||
sma.setExcludedClasses(new HashSet<Class<?>>(Collections.singletonList(Class.class)));
|
||||
|
||||
// when
|
||||
Member method = StaticTester.class.getMethod("sayHello");
|
||||
@@ -269,7 +245,7 @@ public class SecurityMemberAccessTest extends TestCase {
|
||||
public void testBlockStaticAccess() throws Exception {
|
||||
// given
|
||||
SecurityMemberAccess sma = new SecurityMemberAccess(false);
|
||||
sma.setExcludedClasses(new HashSet<Class<?>>(Arrays.<Class<?>>asList(Class.class)));
|
||||
sma.setExcludedClasses(new HashSet<Class<?>>(Collections.singletonList(Class.class)));
|
||||
|
||||
// when
|
||||
Member method = StaticTester.class.getMethod("sayHello");
|
||||
@@ -282,7 +258,7 @@ public class SecurityMemberAccessTest extends TestCase {
|
||||
public void testBlockStaticAccessIfClassIsExcluded() throws Exception {
|
||||
// given
|
||||
SecurityMemberAccess sma = new SecurityMemberAccess(false);
|
||||
sma.setExcludedClasses(new HashSet<Class<?>>(Arrays.<Class<?>>asList(Class.class)));
|
||||
sma.setExcludedClasses(new HashSet<Class<?>>(Collections.singletonList(Class.class)));
|
||||
|
||||
// when
|
||||
Member method = Class.class.getMethod("getClassLoader");
|
||||
@@ -295,7 +271,7 @@ public class SecurityMemberAccessTest extends TestCase {
|
||||
public void testAllowStaticAccessIfClassIsNotExcluded() throws Exception {
|
||||
// given
|
||||
SecurityMemberAccess sma = new SecurityMemberAccess(true);
|
||||
sma.setExcludedClasses(new HashSet<Class<?>>(Arrays.<Class<?>>asList(ClassLoader.class)));
|
||||
sma.setExcludedClasses(new HashSet<Class<?>>(Collections.singletonList(ClassLoader.class)));
|
||||
|
||||
// when
|
||||
Member method = Class.class.getMethod("getClassLoader");
|
||||
|
||||
@@ -20,10 +20,7 @@ import com.opensymphony.xwork2.*;
|
||||
import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;
|
||||
import com.opensymphony.xwork2.test.ModelDrivenAction2;
|
||||
import com.opensymphony.xwork2.test.TestBean2;
|
||||
import org.apache.struts2.util.DateFormatter;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.swing.text.Style;
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.util.Date;
|
||||
@@ -134,17 +131,17 @@ public class LocalizedTextUtilTest extends XWorkTestCase {
|
||||
}
|
||||
|
||||
public void testDefaultMessage() throws Exception {
|
||||
String message = LocalizedTextUtil.findDefaultText(XWorkMessages.ACTION_EXECUTION_ERROR, Locale.getDefault());
|
||||
String message = LocalizedTextUtil.findDefaultText("xwork.error.action.execution", Locale.getDefault());
|
||||
assertEquals("Error during Action invocation", message);
|
||||
}
|
||||
|
||||
public void testDefaultMessageOverride() throws Exception {
|
||||
String message = LocalizedTextUtil.findDefaultText(XWorkMessages.ACTION_EXECUTION_ERROR, Locale.getDefault());
|
||||
String message = LocalizedTextUtil.findDefaultText("xwork.error.action.execution", Locale.getDefault());
|
||||
assertEquals("Error during Action invocation", message);
|
||||
|
||||
LocalizedTextUtil.addDefaultResourceBundle("com/opensymphony/xwork2/test");
|
||||
|
||||
message = LocalizedTextUtil.findDefaultText(XWorkMessages.ACTION_EXECUTION_ERROR, Locale.getDefault());
|
||||
message = LocalizedTextUtil.findDefaultText("xwork.error.action.execution", Locale.getDefault());
|
||||
assertEquals("Testing resource bundle override", message);
|
||||
}
|
||||
|
||||
@@ -187,12 +184,12 @@ public class LocalizedTextUtilTest extends XWorkTestCase {
|
||||
}
|
||||
|
||||
public void testParameterizedDefaultMessage() throws Exception {
|
||||
String message = LocalizedTextUtil.findDefaultText(XWorkMessages.MISSING_ACTION_EXCEPTION, Locale.getDefault(), new String[]{"AddUser"});
|
||||
String message = LocalizedTextUtil.findDefaultText("xwork.exception.missing-action", Locale.getDefault(), new String[]{"AddUser"});
|
||||
assertEquals("There is no Action mapped for action name AddUser.", message);
|
||||
}
|
||||
|
||||
public void testParameterizedDefaultMessageWithPackage() throws Exception {
|
||||
String message = LocalizedTextUtil.findDefaultText(XWorkMessages.MISSING_PACKAGE_ACTION_EXCEPTION, Locale.getDefault(), new String[]{"blah", "AddUser"});
|
||||
String message = LocalizedTextUtil.findDefaultText("xwork.exception.missing-package-action", Locale.getDefault(), new String[]{"blah", "AddUser"});
|
||||
assertEquals("There is no Action mapped for namespace blah and action name AddUser.", message);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ public class EmailValidatorTest extends XWorkTestCase {
|
||||
assertTrue(verifyEmailValidity("ferda+mravenec@yahoo.com"));
|
||||
assertTrue(verifyEmailValidity("Ferda+Mravenec@yaHoo.CoM"));
|
||||
assertTrue(verifyEmailValidity("user@domainname.tech"));
|
||||
assertTrue(verifyEmailValidity("Ferda+Mravenec@yaHoo.cat"));
|
||||
|
||||
assertFalse(verifyEmailValidity("tm_jee#marry@yahoo.co.uk"));
|
||||
assertFalse(verifyEmailValidity("tm_jee@ yahoo.co.uk"));
|
||||
|
||||
@@ -138,6 +138,7 @@ public class URLValidatorTest extends XWorkTestCase {
|
||||
assertFalse(pattern.matcher("").matches());
|
||||
assertFalse(pattern.matcher(" ").matches());
|
||||
assertFalse(pattern.matcher("no url").matches());
|
||||
assertFalse(pattern.matcher("http://example.com////////////////////////////////////////////////////////////////////////////////////??").matches());
|
||||
|
||||
assertTrue(pattern.matcher("http://www.opensymphony.com").matches());
|
||||
assertTrue(pattern.matcher("https://www.opensymphony.com").matches());
|
||||
|
||||
@@ -164,21 +164,4 @@ public class UIBeanTest extends StrutsInternalTestCase {
|
||||
assertEquals("12", txtFld.getTheme());
|
||||
}
|
||||
|
||||
// I couldn't figure out how to make this test work. Bailing for now.
|
||||
// public void testEscapeLabel() throws Exception {
|
||||
// ValueStack stack = ActionContext.getContext().getValueStack();
|
||||
// MockHttpServletRequest req = new MockHttpServletRequest();
|
||||
// MockHttpServletResponse res = new MockHttpServletResponse();
|
||||
// stack.push(this);
|
||||
//
|
||||
// TextField txtFld = new TextField(stack, req, res);
|
||||
// txtFld.setKey("test['foo']");
|
||||
// txtFld.evaluateParams();
|
||||
// assertEquals("test_label", txtFld.getParameters().get("label"));
|
||||
// }
|
||||
//
|
||||
// public String getText(String key) {
|
||||
// assertEquals("test[\\'foo\\']", key);
|
||||
// return "test_label";
|
||||
// }
|
||||
}
|
||||
|
||||
+30
-6
@@ -30,6 +30,7 @@ import com.opensymphony.xwork2.config.ConfigurationManager;
|
||||
import com.opensymphony.xwork2.config.entities.PackageConfig;
|
||||
import com.opensymphony.xwork2.config.impl.DefaultConfiguration;
|
||||
import org.apache.struts2.ServletActionContext;
|
||||
import org.apache.struts2.StrutsException;
|
||||
import org.apache.struts2.StrutsInternalTestCase;
|
||||
import org.apache.struts2.result.StrutsResultSupport;
|
||||
import org.apache.struts2.views.jsp.StrutsMockHttpServletRequest;
|
||||
@@ -162,8 +163,8 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
|
||||
public void testGetMappingWithNamespaceSlash() throws Exception {
|
||||
|
||||
req.setupGetRequestURI("/my.hh/abc.action");
|
||||
req.setupGetServletPath("/my.hh/abc.action");
|
||||
req.setupGetRequestURI("/my-hh/abc.action");
|
||||
req.setupGetServletPath("/my-hh/abc.action");
|
||||
req.setupGetAttribute(null);
|
||||
req.addExpectedGetAttributeName("javax.servlet.include.servlet_path");
|
||||
|
||||
@@ -180,7 +181,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
mapping = mapper.getMapping(req, configManager);
|
||||
|
||||
assertEquals("", mapping.getNamespace());
|
||||
assertEquals("my.hh/abc", mapping.getName());
|
||||
assertEquals("my-hh/abc", mapping.getName());
|
||||
}
|
||||
|
||||
public void testGetMappingWithUnknownNamespace() throws Exception {
|
||||
@@ -844,14 +845,37 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
String actionName = "action";
|
||||
assertEquals(actionName, mapper.cleanupActionName(actionName));
|
||||
|
||||
Throwable expected = null;
|
||||
|
||||
actionName = "${action}";
|
||||
assertEquals("action", mapper.cleanupActionName(actionName));
|
||||
try {
|
||||
mapper.cleanupActionName(actionName);
|
||||
fail();
|
||||
} catch (Throwable t) {
|
||||
expected = t;
|
||||
}
|
||||
assertTrue(expected instanceof StrutsException);
|
||||
assertEquals("Action [${action}] does not match allowed action names pattern [" + mapper.allowedActionNames.pattern() + "]!", expected.getMessage());
|
||||
|
||||
actionName = "${${%{action}}}";
|
||||
assertEquals("action", mapper.cleanupActionName(actionName));
|
||||
try {
|
||||
mapper.cleanupActionName(actionName);
|
||||
fail();
|
||||
} catch (Throwable t) {
|
||||
expected = t;
|
||||
}
|
||||
assertTrue(expected instanceof StrutsException);
|
||||
assertEquals("Action [${${%{action}}}] does not match allowed action names pattern [" + mapper.allowedActionNames.pattern() + "]!", expected.getMessage());
|
||||
|
||||
actionName = "${#foo='action',#foo}";
|
||||
assertEquals("fooactionfoo", mapper.cleanupActionName(actionName));
|
||||
try {
|
||||
mapper.cleanupActionName(actionName);
|
||||
fail();
|
||||
} catch (Throwable t) {
|
||||
expected = t;
|
||||
}
|
||||
assertTrue(expected instanceof StrutsException);
|
||||
assertEquals("Action [${#foo='action',#foo}] does not match allowed action names pattern [" + mapper.allowedActionNames.pattern() + "]!", expected.getMessage());
|
||||
|
||||
actionName = "test-action";
|
||||
assertEquals("test-action", mapper.cleanupActionName(actionName));
|
||||
|
||||
@@ -78,8 +78,8 @@ public class StreamResultTest extends StrutsInternalTestCase {
|
||||
|
||||
result.doExecute("helloworld", mai);
|
||||
|
||||
assertEquals(String.valueOf(contentLength), result.getContentLength());
|
||||
assertEquals("text/plain", result.getContentType());
|
||||
assertEquals(contentLength, response.getContentLength());
|
||||
assertEquals("text/plain", response.getContentType());
|
||||
assertEquals("streamForImage", result.getInputName());
|
||||
assertEquals(1024, result.getBufferSize()); // 1024 is default
|
||||
assertEquals("inline", result.getContentDisposition());
|
||||
@@ -94,7 +94,7 @@ public class StreamResultTest extends StrutsInternalTestCase {
|
||||
result.setContentCharSet("ISO-8859-1");
|
||||
result.doExecute("helloworld", mai);
|
||||
|
||||
assertEquals(String.valueOf(contentLength), result.getContentLength());
|
||||
assertEquals(contentLength, response.getContentLength());
|
||||
assertEquals("text/plain", result.getContentType());
|
||||
assertEquals("streamForImage", result.getInputName());
|
||||
assertEquals(1024, result.getBufferSize()); // 1024 is default
|
||||
@@ -111,8 +111,9 @@ public class StreamResultTest extends StrutsInternalTestCase {
|
||||
|
||||
result.doExecute("helloworld", mai);
|
||||
|
||||
assertEquals(String.valueOf(contentLength), result.getContentLength());
|
||||
assertEquals(contentLength, response.getContentLength());
|
||||
assertEquals("text/plain", result.getContentType());
|
||||
assertEquals("text/plain;charset=UTF-8", response.getContentType());
|
||||
assertEquals("streamForImage", result.getInputName());
|
||||
assertEquals(1024, result.getBufferSize()); // 1024 is default
|
||||
assertEquals("inline", result.getContentDisposition());
|
||||
@@ -220,6 +221,7 @@ public class StreamResultTest extends StrutsInternalTestCase {
|
||||
response = new MockHttpServletResponse();
|
||||
|
||||
result = new StreamResult();
|
||||
result.setContentLength("${contentLength}");
|
||||
stack = ActionContext.getContext().getValueStack();
|
||||
|
||||
MyImageAction action = new MyImageAction();
|
||||
|
||||
@@ -239,6 +239,62 @@ public class TextfieldTest extends AbstractUITagTest {
|
||||
verify(TextFieldTag.class.getResource("Textfield-9.txt"));
|
||||
}
|
||||
|
||||
public void testRequiredLabelPositionDefault() throws Exception {
|
||||
TestAction testAction = (TestAction) action;
|
||||
testAction.setFoo("bar");
|
||||
|
||||
TextFieldTag tag = new TextFieldTag();
|
||||
tag.setPageContext(pageContext);
|
||||
tag.setId("myId");
|
||||
tag.setLabel("mylabel");
|
||||
tag.setName("foo");
|
||||
tag.setValue("bar");
|
||||
tag.setRequiredLabel("true");
|
||||
|
||||
tag.doStartTag();
|
||||
tag.doEndTag();
|
||||
|
||||
verify(TextFieldTag.class.getResource("Textfield-12.txt"));
|
||||
}
|
||||
|
||||
public void testRequiredLabelPositionRight() throws Exception {
|
||||
TestAction testAction = (TestAction) action;
|
||||
testAction.setFoo("bar");
|
||||
|
||||
TextFieldTag tag = new TextFieldTag();
|
||||
tag.setPageContext(pageContext);
|
||||
tag.setId("myId");
|
||||
tag.setLabel("mylabel");
|
||||
tag.setName("foo");
|
||||
tag.setValue("bar");
|
||||
tag.setRequiredLabel("true");
|
||||
tag.setRequiredPosition("right");
|
||||
|
||||
tag.doStartTag();
|
||||
tag.doEndTag();
|
||||
|
||||
verify(TextFieldTag.class.getResource("Textfield-12.txt"));
|
||||
}
|
||||
|
||||
public void testRequiredLabelPositionLeft() throws Exception {
|
||||
TestAction testAction = (TestAction) action;
|
||||
testAction.setFoo("bar");
|
||||
|
||||
TextFieldTag tag = new TextFieldTag();
|
||||
tag.setPageContext(pageContext);
|
||||
tag.setId("myId");
|
||||
tag.setLabel("mylabel");
|
||||
tag.setName("foo");
|
||||
tag.setValue("bar");
|
||||
tag.setRequiredLabel("true");
|
||||
tag.setRequiredPosition("left");
|
||||
|
||||
tag.doStartTag();
|
||||
tag.doEndTag();
|
||||
|
||||
verify(TextFieldTag.class.getResource("Textfield-13.txt"));
|
||||
}
|
||||
|
||||
public void testErrorPositionBottomCssXhtmlTheme() throws Exception {
|
||||
TestAction testAction = (TestAction) action;
|
||||
testAction.setFoo("bar");
|
||||
@@ -281,4 +337,20 @@ public class TextfieldTest extends AbstractUITagTest {
|
||||
verify(TextFieldTag.class.getResource("Textfield-11.txt"));
|
||||
}
|
||||
|
||||
public void testNameEvaluation() throws Exception {
|
||||
TestAction testAction = (TestAction) action;
|
||||
testAction.setArray(new String[]{"test", "bar"});
|
||||
testAction.setFooInt(1);
|
||||
|
||||
TextFieldTag tag = new TextFieldTag();
|
||||
tag.setPageContext(pageContext);
|
||||
tag.setName("array[%{fooInt}]");
|
||||
|
||||
tag.doStartTag();
|
||||
tag.doEndTag();
|
||||
|
||||
verify(TextFieldTag.class.getResource("Textfield-14.txt"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<tr>
|
||||
<td class="tdLabel"><label for="foo" class="label">mylabel:</label></td>
|
||||
<td>
|
||||
<td class="tdInput">
|
||||
<input type="checkbox" name="foo" value="hello" id="foo-1" checked="checked" title="mytitle" onchange="alert('foo');"/>
|
||||
<label for="foo-1" class="checkboxLabel">world</label>
|
||||
<input type="checkbox" name="foo" value="foo" id="foo-2" title="mytitle" onchange="alert('foo');"/>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<tr>
|
||||
<td class="tdLabel"><label for="collection" class="label">mylabel:</label></td>
|
||||
<td>
|
||||
<td class="tdInput">
|
||||
<input type="checkbox" name="collection" value="hello" id="collection-1" checked="checked"/>
|
||||
<label for="collection-1" class="checkboxLabel">world</label>
|
||||
<input type="checkbox" name="collection" value="foo" id="collection-2" checked="checked"/>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<tr>
|
||||
<td class="tdLabel"><label for="collection" class="label">mylabel:</label></td>
|
||||
<td>
|
||||
<td class="tdInput">
|
||||
<input type="checkbox" name="collection" value="hello" id="collection-1" checked="checked" disabled="disabled"/>
|
||||
<label for="collection-1" class="checkboxLabel">world</label>
|
||||
<input type="checkbox" name="collection" value="foo" id="collection-2" checked="checked" disabled="disabled"/>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<tr>
|
||||
<td class="tdLabel"><label for="foo" class="label">mylabel:</label></td>
|
||||
<td>
|
||||
<td class="tdInput">
|
||||
<input type="checkbox" name="foo" value="hello" id="foo-1" checked="checked" disabled="disabled" onchange="alert('foo');"/>
|
||||
<label for="foo-1" class="checkboxLabel">world</label>
|
||||
<input type="checkbox" name="foo" value="foo" id="foo-2" disabled="disabled" onchange="alert('foo');"/>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<tr>
|
||||
<td class="tdLabel"><label for="cb" class="label">mylabel:</label></td>
|
||||
<td>
|
||||
<td class="tdInput">
|
||||
<script type="text/javascript">
|
||||
function autoPopulate_cb(targetElement) {
|
||||
targetElement.form.elements['foo'].value=targetElement.options[targetElement.selectedIndex].value;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<tr>
|
||||
<td class="tdLabel"><label for="myFavouriteFruit" class="label">My Favourite Fruit:</label></td>
|
||||
<td>
|
||||
<td class="tdInput">
|
||||
<script type="text/javascript">
|
||||
function autoPopulate_myFavouriteFruit(targetElement) {
|
||||
if (targetElement.options[targetElement.selectedIndex].value == '-1') {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<tr>
|
||||
<td class="tdLabel"><label for="myFavouriteFruit" class="label">My Favourite Fruit:</label></td>
|
||||
<td>
|
||||
<td class="tdInput">
|
||||
<script type="text/javascript">
|
||||
function autoPopulate_myFavouriteFruit(targetElement) {
|
||||
if (targetElement.options[targetElement.selectedIndex].value == '-1') {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<tr>
|
||||
<td class="tdLabel"><label for="cb.bc" class="label">mylabel:</label></td>
|
||||
<td>
|
||||
<td class="tdInput">
|
||||
<script type="text/javascript">
|
||||
function autoPopulate_cb_bc(targetElement) {
|
||||
targetElement.form.elements['foo'].value=targetElement.options[targetElement.selectedIndex].value;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<td class="tdLabel">
|
||||
<label for="myFooValue" class="label">mylabel:</label>
|
||||
</td>
|
||||
<td>
|
||||
<td class="tdInput">
|
||||
<input type="text" name="myname" value="foo" id="myFooValue"/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<td class="tdLabel">
|
||||
<label for="foo" class="label">mylabel:</label>
|
||||
</td>
|
||||
<td>
|
||||
<td class="tdInput">
|
||||
<input type="text" name="myname" value="foo" id="foo"/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<tr>
|
||||
<td class="tdLabel"><label for="foo" class="label">mylabel:</label></td>
|
||||
<td>
|
||||
<td class="tdInput">
|
||||
<select name="foo" id="foo" class="c1" style="s1" onmousedown="window.status='onmousedown';" onmouseup="window.status='onmouseup';" onmouseover="window.status='onmouseover';" onmousemove="window.status='onmousemove';" onmouseout="window.status='onmouseout';" onchange="fooRedirect(this.selectedIndex)">
|
||||
<option value="BE">Belgium</option>
|
||||
<option value="FR">France</option>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<tr>
|
||||
<td class="tdLabel"><label for="foo" class="label">mylabel:</label></td>
|
||||
<td>
|
||||
<td class="tdInput">
|
||||
<select name="foo" id="foo" onmousedown="window.status='onmousedown';" onmouseup="window.status='onmouseup';" onmouseover="window.status='onmouseover';" onmousemove="window.status='onmousemove';" onmouseout="window.status='onmouseout';" onchange="fooRedirect(this.selectedIndex)">
|
||||
<option value="BE">Belgium</option>
|
||||
<option value="FR" selected="selected">France</option>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<tr>
|
||||
<td class="tdLabel"><label for="foo_bar" class="label">mylabel:</label></td>
|
||||
<td>
|
||||
<td class="tdInput">
|
||||
<select name="foo.bar" id="foo_bar" onmousedown="window.status='onmousedown';" onmouseup="window.status='onmouseup';" onmouseover="window.status='onmouseover';" onmousemove="window.status='onmousemove';" onmouseout="window.status='onmouseout';" onchange="foo_barRedirect(this.selectedIndex)">
|
||||
<option value="BE">Belgium</option>
|
||||
<option value="FR">France</option>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<tr>
|
||||
<td class="tdLabel"><label for="foo" class="label">mylabel:</label></td>
|
||||
<td>
|
||||
<td class="tdInput">
|
||||
<select name="foo" id="foo" class="c1" style="s1" onmousedown="window.status='onmousedown';" onmouseup="window.status='onmouseup';" onmouseover="window.status='onmouseover';" onmousemove="window.status='onmousemove';" onmouseout="window.status='onmouseout';" onchange="fooRedirect(this.selectedIndex);window.status='onchange';">
|
||||
<option value="BE">Belgium</option>
|
||||
<option value="FR">France</option>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user