mirror of
https://github.com/apache/struts.git
synced 2026-08-07 23:57:03 +00:00
Compare commits
114 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 60a1a2642a | |||
| d25a342bd2 | |||
| 6870fb7f79 | |||
| e62ae2ee7a | |||
| 83dc967eac | |||
| dd1588d3eb | |||
| 6194d3fc88 | |||
| bd0d514de9 | |||
| cde8a288f9 | |||
| ac868ae3ab | |||
| feb5ab1333 | |||
| 458acb89e5 | |||
| 88c2d216e3 | |||
| 61735542c2 | |||
| 0b41b68da4 | |||
| dbcca3512e | |||
| 6ec2bdc197 | |||
| 9b9aa10059 | |||
| 6c216de38e | |||
| a89b7c11af | |||
| 918182344c | |||
| 52e8d46364 | |||
| c59f294fb9 | |||
| 86e5bd7f52 | |||
| bea6fb599d | |||
| 4a3917176d | |||
| a746fc872a | |||
| 949e069f53 | |||
| 4db5cdc473 | |||
| afc8f20440 | |||
| 75d7bf481c | |||
| d86539ed07 | |||
| f0b3a1d213 | |||
| 2306f5f7fa | |||
| ed7f9dd4cb | |||
| cf53b59647 | |||
| 6dd6e5cfb7 | |||
| b9a0c497d3 | |||
| 2f95b9a130 | |||
| 103e3b174e | |||
| 2776b34b44 | |||
| 287e3bc8cb | |||
| 677ccebe83 | |||
| f11ac901d3 | |||
| 3fddfb6eb5 | |||
| 744c1f409d | |||
| 54a4dce7bf | |||
| 16eb7fa768 | |||
| 631ce98d17 | |||
| 086b637355 | |||
| ae56301979 | |||
| 73da12e723 | |||
| 583da3d5df | |||
| 9e8627ca66 | |||
| c349dfa5ab | |||
| 4d888a5ab6 | |||
| 1ed29d508f | |||
| 3523064939 | |||
| 54dff362f5 | |||
| b12864dd38 | |||
| de90290354 | |||
| ba0563183b | |||
| b348fc552c | |||
| 81371e09c5 | |||
| 431e50e922 | |||
| 156db8e5df | |||
| 6f5ddca471 | |||
| cc0d52f216 | |||
| 23e0181328 | |||
| 030ffa3354 | |||
| 8e67b9144a | |||
| 77017cd677 | |||
| 7d8c3598ef | |||
| 83bb64f4c2 | |||
| ae2840f183 | |||
| e8b48f8bb4 | |||
| 3243448084 | |||
| 5c61c9a575 | |||
| e40dcaa3f4 | |||
| ab6acd2382 | |||
| bf0a01d390 | |||
| 00c47b7ce6 | |||
| c84810ff82 | |||
| 2ea59b31b4 | |||
| fae1e0e799 | |||
| e4ce3ce839 | |||
| 730441b7a7 | |||
| bb22c585b5 | |||
| eccc31ebce | |||
| 1c92a8b2c9 | |||
| b28b78c062 | |||
| 8d172b8e9b | |||
| 88b885339a | |||
| 3f526d630a | |||
| 34025eafec | |||
| 54e8bf1f75 | |||
| 9f2cae2f1e | |||
| 9bcd1bc9f6 | |||
| f052398cd2 | |||
| 237432512d | |||
| ca25476120 | |||
| 731fde544c | |||
| 76eb8f38a3 | |||
| deefeffd11 | |||
| 98d2692e43 | |||
| 46517afb14 | |||
| 5190b53673 | |||
| d36f31b3e1 | |||
| cbae13a6a8 | |||
| 865f1f2784 | |||
| 5ce807aaea | |||
| 17dab897d9 | |||
| 45fa8d0320 | |||
| 6fee2eb1a4 |
+1
-1
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-blank</artifactId>
|
||||
|
||||
@@ -25,7 +25,6 @@ import org.apache.struts2.interceptor.validation.SkipValidation;
|
||||
|
||||
public class Login extends ExampleSupport {
|
||||
|
||||
@Override
|
||||
public String execute() throws Exception {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-jboss-blank</artifactId>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-mailreader</artifactId>
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-parent</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</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.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-portlet</artifactId>
|
||||
|
||||
@@ -5,11 +5,11 @@ Here you'll find examples of what is possible with the Struts Portlet integratio
|
||||
<ul>
|
||||
<li><a href="<s:url action="formExample"/>">A simple form</a></li>
|
||||
<li><a href="<s:url action="formExamplePrg" method="input"/>">Form example with proper PRG</a></li>
|
||||
<li><a href="<s:url action="formExampleModelDriven" method="input"/>">Model driven example</li>
|
||||
<li><a href="<s:url action="formExampleModelDriven" method="input"/>">Model driven example</a>/li>
|
||||
<li><a href="<s:url action="validationExample"/>">Validation</a></li>
|
||||
<li><a href="<s:url action="tokenExample"/>">Token</a></li>
|
||||
<li><a href="<s:url action="springExample"/>">Spring integration</a></li>
|
||||
<li><a href="<s:url action="fileUpload" method="input"/>">File upload</li>
|
||||
<li><a href="<s:url action="fileUpload" method="input"/>">File upload</a></li>
|
||||
<li><a href="<s:url action="freeMarkerExample"/>">FreeMarker</a></li>
|
||||
<li><a href="<s:url action="velocityHelloWorld"/>">Velocity</a></li>
|
||||
<li><a href="<s:url action="index" namespace="/tiles"/>">Form Example Validation with Tiles</a></li>
|
||||
|
||||
@@ -26,12 +26,12 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-rest-showcase</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</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.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-showcase</artifactId>
|
||||
|
||||
+2
-1
@@ -36,7 +36,8 @@ public class SaveGangsterAction extends Action {
|
||||
// Some code to save the gangster to the db as necessary
|
||||
GangsterForm gform = (GangsterForm) form;
|
||||
ActionMessages messages = new ActionMessages();
|
||||
messages.add("msg", new ActionMessage("Gangster " + gform.getName() + " added successfully"));
|
||||
System.out.println(gform.getName());
|
||||
messages.add("msg", new ActionMessage("struts1.gangsterAdded", gform.getName()));
|
||||
addMessages(request, messages);
|
||||
|
||||
return mapping.findForward("success");
|
||||
|
||||
@@ -7,3 +7,5 @@ item.create=Create {0}
|
||||
item.list={0} List
|
||||
|
||||
token.transfer.time=The bank transfer was executed at {0,date,HH:mm:ss MM-dd-yyyy}
|
||||
|
||||
struts1.gangsterAdded=Gangster {0} added successfully
|
||||
@@ -5,3 +5,5 @@ item.create={0} neu anlegen
|
||||
item.list={0}-Liste
|
||||
|
||||
token.transfer.time=Die \u00dcberweisung wurde am {0,date,HH:mm:ss MM-dd-yyyy} durchgef\u00fchrt
|
||||
|
||||
struts1.gangsterAdded=Gangster {0} wurde erfolgreich hinzugefugt
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
struts1.gangsterAdded=Gangster {0} anadido con exito
|
||||
+1
-1
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-parent</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-archetypes</artifactId>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-archetypes</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-archetypes</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-archetypes</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-archetypes</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-archetypes</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-archetypes</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-archetypes</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
+9
-13
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-parent</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-assembly</artifactId>
|
||||
@@ -82,33 +82,29 @@
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>cwiki-docs</id>
|
||||
<id>docs</id>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<tasks>
|
||||
<mkdir dir="${project.build.directory}/cwiki/" />
|
||||
<target>
|
||||
<mkdir dir="${project.build.directory}/docs/" />
|
||||
<exec executable="wget">
|
||||
<arg value="-erobots=off" />
|
||||
<arg value="-nH" />
|
||||
<arg value="--cut-dirs=3" />
|
||||
<arg value="-x" />
|
||||
<arg value="-nv" />
|
||||
<arg value="-E" />
|
||||
<arg value="-L" />
|
||||
<arg value="-l 0" />
|
||||
<arg value="-np" />
|
||||
<arg value="--directory-prefix=${project.build.directory}/cwiki" />
|
||||
<arg value="--directory-prefix=${project.build.directory}/docs" />
|
||||
<arg value="--no-check-certificate" />
|
||||
<arg value="-r" />
|
||||
<arg value="http://struts.apache.org/docs/" />
|
||||
<arg value="-i" />
|
||||
<arg value="src/main/resources/docs-urls.txt" />
|
||||
</exec>
|
||||
<delete>
|
||||
<fileset dir="${project.build.directory}/cwiki/" includes="**/index.*" />
|
||||
</delete>
|
||||
<copy file="${project.build.directory}/cwiki/home.html" tofile="${project.build.directory}/cwiki/index.html" />
|
||||
</tasks>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
<!-- Include the Confluence docs in the assembly -->
|
||||
<fileSet>
|
||||
<directory>target/cwiki</directory>
|
||||
<directory>target/docs</directory>
|
||||
<outputDirectory>docs/docs</outputDirectory>
|
||||
</fileSet>
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
https://struts.apache.org/getting-started/
|
||||
https://struts.apache.org/security/
|
||||
https://struts.apache.org/core-developers/
|
||||
https://struts.apache.org/tag-developers/
|
||||
https://struts.apache.org/maven-archetypes/
|
||||
https://struts.apache.org/plugins/
|
||||
+3
-3
@@ -10,7 +10,7 @@
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-bom</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>Struts 2 Bill of Materials</name>
|
||||
@@ -25,7 +25,7 @@
|
||||
</licenses>
|
||||
|
||||
<properties>
|
||||
<struts-version.version>2.3.28</struts-version.version>
|
||||
<struts-version.version>2.3.37</struts-version.version>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
@@ -197,6 +197,6 @@
|
||||
</dependencyManagement>
|
||||
|
||||
<scm>
|
||||
<tag>STRUTS_2_3_28</tag>
|
||||
<tag>STRUTS_2_3_37</tag>
|
||||
</scm>
|
||||
</project>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-osgi-bundles</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</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.3.28</version>
|
||||
<version>2.3.37</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.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-osgi-bundles</artifactId>
|
||||
|
||||
+3
-7
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-parent</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
<artifactId>struts2-core</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
@@ -46,15 +46,11 @@
|
||||
<configuration>
|
||||
<A>uri=/struts-tags,tlibVersion=${tlib.version},jspVersion=2.0,shortName=s,displayName=Struts Tags,
|
||||
outFile=${basedir}/target/classes/META-INF/struts-tags.tld,
|
||||
description="To make it easier to access dynamic data;
|
||||
the Apache Struts framework includes a library of custom tags.
|
||||
The tags interact with the framework's validation and internationalization features;
|
||||
to ensure that input is correct and output is localized.
|
||||
The Struts Tags can be used with JSP FreeMarker or Velocity.",
|
||||
description='To make it easier to access dynamic data the Apache Struts framework includes a library of custom tags. The tags interact with the framework validation and internationalization features to ensure that input is correct and output is localized. The Struts Tags can be used with JSP FreeMarker or Velocity.',
|
||||
outTemplatesDir=${basedir}/src/site/resources/tags
|
||||
</A>
|
||||
<resourceTargetPath>target</resourceTargetPath>
|
||||
<fork>false</fork>
|
||||
<fork>true</fork>
|
||||
<force>true</force>
|
||||
<nocompile>true</nocompile>
|
||||
<showWarnings>true</showWarnings>
|
||||
|
||||
@@ -270,8 +270,20 @@ public final class StrutsConstants {
|
||||
|
||||
public static final String STRUTS_EXPRESSION_PARSER = "struts.expression.parser";
|
||||
|
||||
/** namespaces names' whitelist **/
|
||||
public static final String STRUTS_ALLOWED_NAMESPACE_NAMES = "struts.allowed.namespace.names";
|
||||
/** default namespace name to use when namespace didn't match the whitelist **/
|
||||
public static final String STRUTS_DEFAULT_NAMESPACE_NAME = "struts.default.namespace.name";
|
||||
|
||||
/** actions names' whitelist **/
|
||||
public static final String STRUTS_ALLOWED_ACTION_NAMES = "struts.allowed.action.names";
|
||||
/** default action name to use when action didn't match the whitelist **/
|
||||
public static final String STRUTS_DEFAULT_ACTION_NAME = "struts.default.action.name";
|
||||
|
||||
/** methods names' whitelist **/
|
||||
public static final String STRUTS_ALLOWED_METHOD_NAMES = "struts.allowed.method.names";
|
||||
/** default method name to use when method didn't match the whitelist **/
|
||||
public static final String STRUTS_DEFAULT_METHOD_NAME = "struts.default.method.name";
|
||||
|
||||
/** enables action: prefix **/
|
||||
public static final String STRUTS_MAPPER_ACTION_PREFIX_ENABLED = "struts.mapper.action.prefix.enabled";
|
||||
|
||||
@@ -22,14 +22,12 @@
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import java.io.Writer;
|
||||
import java.util.Locale;
|
||||
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.ActionContext;
|
||||
import com.opensymphony.xwork2.LocaleProvider;
|
||||
import com.opensymphony.xwork2.TextProviderFactory;
|
||||
import com.opensymphony.xwork2.TextProvider;
|
||||
@@ -95,6 +93,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);
|
||||
@@ -105,26 +105,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;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ package org.apache.struts2.dispatcher;
|
||||
|
||||
import com.opensymphony.xwork2.inject.Inject;
|
||||
import com.opensymphony.xwork2.util.ClassLoaderUtil;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
import org.apache.struts2.StrutsConstants;
|
||||
@@ -39,6 +41,7 @@ import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.LinkedList;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
/**
|
||||
@@ -93,6 +96,7 @@ public class DefaultStaticContentLoader implements StaticContentLoader {
|
||||
*/
|
||||
protected String encoding;
|
||||
|
||||
protected boolean devMode;
|
||||
|
||||
/**
|
||||
* Modify state of StrutsConstants.STRUTS_SERVE_STATIC_CONTENT setting.
|
||||
@@ -101,29 +105,34 @@ public class DefaultStaticContentLoader implements StaticContentLoader {
|
||||
* New setting
|
||||
*/
|
||||
@Inject(StrutsConstants.STRUTS_SERVE_STATIC_CONTENT)
|
||||
public void setServeStaticContent(String val) {
|
||||
serveStatic = "true".equals(val);
|
||||
public void setServeStaticContent(String serveStaticContent) {
|
||||
this.serveStatic = BooleanUtils.toBoolean(serveStaticContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify state of StrutsConstants.STRUTS_SERVE_STATIC_BROWSER_CACHE
|
||||
* setting.
|
||||
*
|
||||
* @param val
|
||||
* @param serveStaticBrowserCache
|
||||
* New setting
|
||||
*/
|
||||
@Inject(StrutsConstants.STRUTS_SERVE_STATIC_BROWSER_CACHE)
|
||||
public void setServeStaticBrowserCache(String val) {
|
||||
serveStaticBrowserCache = "true".equals(val);
|
||||
public void setServeStaticBrowserCache(String serveStaticBrowserCache) {
|
||||
this.serveStaticBrowserCache = BooleanUtils.toBoolean(serveStaticBrowserCache);
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify state of StrutsConstants.STRUTS_I18N_ENCODING setting.
|
||||
* @param val New setting
|
||||
* @param encoding New setting
|
||||
*/
|
||||
@Inject(StrutsConstants.STRUTS_I18N_ENCODING)
|
||||
public void setEncoding(String val) {
|
||||
encoding = val;
|
||||
public void setEncoding(String encoding) {
|
||||
this.encoding = encoding;
|
||||
}
|
||||
|
||||
@Inject(StrutsConstants.STRUTS_DEVMODE)
|
||||
public void setDevMode(String devMode) {
|
||||
this.devMode = Boolean.parseBoolean(devMode);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -141,7 +150,16 @@ public class DefaultStaticContentLoader implements StaticContentLoader {
|
||||
}
|
||||
|
||||
protected String getAdditionalPackages() {
|
||||
return "org.apache.struts2.static template org.apache.struts2.interceptor.debugging static";
|
||||
List<String> packages = new LinkedList<String>();
|
||||
packages.add("org.apache.struts2.static");
|
||||
packages.add("template");
|
||||
packages.add("static");
|
||||
|
||||
if (devMode) {
|
||||
packages.add("org.apache.struts2.interceptor.debugging");
|
||||
}
|
||||
|
||||
return StringUtils.join(packages.iterator(), ' ');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -273,7 +291,7 @@ public class DefaultStaticContentLoader implements StaticContentLoader {
|
||||
* @param name resource name
|
||||
* @param packagePrefix The package prefix to use to locate the resource
|
||||
* @return full path
|
||||
* @throws UnsupportedEncodingException
|
||||
* @throws UnsupportedEncodingException If there is a encoding problem
|
||||
*/
|
||||
protected String buildPath(String name, String packagePrefix) throws UnsupportedEncodingException {
|
||||
String resourcePath;
|
||||
|
||||
@@ -211,7 +211,11 @@ public class Dispatcher {
|
||||
*/
|
||||
@Inject(StrutsConstants.STRUTS_DEVMODE)
|
||||
public void setDevMode(String mode) {
|
||||
devMode = "true".equals(mode);
|
||||
devMode = Boolean.parseBoolean(mode);
|
||||
}
|
||||
|
||||
public boolean isDevMode() {
|
||||
return devMode;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -265,6 +269,10 @@ public class Dispatcher {
|
||||
this.handleException = Boolean.parseBoolean(handleException);
|
||||
}
|
||||
|
||||
public boolean isHandleException() {
|
||||
return handleException;
|
||||
}
|
||||
|
||||
@Inject
|
||||
public void setDispatcherErrorHandler(DispatcherErrorHandler errorHandler) {
|
||||
this.errorHandler = errorHandler;
|
||||
|
||||
@@ -127,6 +127,8 @@ public class PostbackResult extends StrutsResultSupport {
|
||||
|
||||
if (actionName != null) {
|
||||
actionName = conditionalParse(actionName, invocation);
|
||||
parseLocation = false;
|
||||
|
||||
if (namespace == null) {
|
||||
namespace = invocation.getProxy().getNamespace();
|
||||
} else {
|
||||
|
||||
@@ -164,6 +164,8 @@ public class ServletActionRedirectResult extends ServletRedirectResult implement
|
||||
*/
|
||||
public void execute(ActionInvocation invocation) throws Exception {
|
||||
actionName = conditionalParse(actionName, invocation);
|
||||
parseLocation = false;
|
||||
|
||||
if (namespace == null) {
|
||||
namespace = invocation.getProxy().getNamespace();
|
||||
} else {
|
||||
|
||||
@@ -118,6 +118,8 @@ public abstract class StrutsResultSupport implements Result, StrutsStatics {
|
||||
private String location;
|
||||
private String lastFinalLocation;
|
||||
|
||||
protected boolean parseLocation = true;
|
||||
|
||||
public StrutsResultSupport() {
|
||||
this(null, true, false);
|
||||
}
|
||||
@@ -187,7 +189,7 @@ public abstract class StrutsResultSupport implements Result, StrutsStatics {
|
||||
* @throws Exception if an error occurs while executing the result.
|
||||
*/
|
||||
public void execute(ActionInvocation invocation) throws Exception {
|
||||
lastFinalLocation = conditionalParse(location, invocation);
|
||||
lastFinalLocation = parseLocation ? conditionalParse(location, invocation) : location;
|
||||
doExecute(lastFinalLocation, invocation);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
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,16 @@ public class DefaultActionMapper implements ActionMapper {
|
||||
protected boolean allowSlashesInActionNames = false;
|
||||
protected boolean alwaysSelectFullNamespace = false;
|
||||
protected PrefixTrie prefixTrie = null;
|
||||
|
||||
protected Pattern allowedNamespaceNames = Pattern.compile("[a-zA-Z0-9._/\\-]*");
|
||||
protected String defaultNamespaceName = "/";
|
||||
|
||||
protected Pattern allowedActionNames = Pattern.compile("[a-zA-Z0-9._!/\\-]*");
|
||||
protected String defaultActionName = "index";
|
||||
|
||||
protected Pattern allowedMethodNames = Pattern.compile("[a-zA-Z_]*[0-9]*");
|
||||
protected String defaultMethodName = "execute";
|
||||
|
||||
private boolean allowActionPrefix = false;
|
||||
private boolean allowActionCrossNamespaceAccess = false;
|
||||
|
||||
@@ -136,7 +146,7 @@ public class DefaultActionMapper implements ActionMapper {
|
||||
put(METHOD_PREFIX, new ParameterAction() {
|
||||
public void execute(String key, ActionMapping mapping) {
|
||||
if (allowDynamicMethodCalls) {
|
||||
mapping.setMethod(key.substring(METHOD_PREFIX.length()));
|
||||
mapping.setMethod(cleanupMethodName(key.substring(METHOD_PREFIX.length())));
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -148,7 +158,7 @@ public class DefaultActionMapper implements ActionMapper {
|
||||
if (allowDynamicMethodCalls) {
|
||||
int bang = name.indexOf('!');
|
||||
if (bang != -1) {
|
||||
String method = name.substring(bang + 1);
|
||||
String method = cleanupMethodName(name.substring(bang + 1));
|
||||
mapping.setMethod(method);
|
||||
name = name.substring(0, bang);
|
||||
}
|
||||
@@ -160,8 +170,8 @@ public class DefaultActionMapper implements ActionMapper {
|
||||
}
|
||||
}
|
||||
if (!allowSlashesInActionNames && !allowActionCrossNamespaceAccess) {
|
||||
if (actionName.lastIndexOf("/") != -1) {
|
||||
actionName = actionName.substring(actionName.lastIndexOf("/") + 1);
|
||||
if (actionName.lastIndexOf('/') != -1) {
|
||||
actionName = actionName.substring(actionName.lastIndexOf('/') + 1);
|
||||
}
|
||||
}
|
||||
mapping.setName(actionName);
|
||||
@@ -199,11 +209,36 @@ public class DefaultActionMapper implements ActionMapper {
|
||||
this.alwaysSelectFullNamespace = "true".equals(val);
|
||||
}
|
||||
|
||||
@Inject(value = StrutsConstants.STRUTS_ALLOWED_NAMESPACE_NAMES, required = false)
|
||||
public void setAllowedNamespaceNames(String allowedNamespaceNames) {
|
||||
this.allowedNamespaceNames = Pattern.compile(allowedNamespaceNames);
|
||||
}
|
||||
|
||||
@Inject(value = StrutsConstants.STRUTS_DEFAULT_NAMESPACE_NAME, required = false)
|
||||
public void setDefaultNamespaceName(String defaultNamespaceName) {
|
||||
this.defaultNamespaceName = defaultNamespaceName;
|
||||
}
|
||||
|
||||
@Inject(value = StrutsConstants.STRUTS_ALLOWED_ACTION_NAMES, required = false)
|
||||
public void setAllowedActionNames(String allowedActionNames) {
|
||||
this.allowedActionNames = Pattern.compile(allowedActionNames);
|
||||
}
|
||||
|
||||
@Inject(value = StrutsConstants.STRUTS_DEFAULT_ACTION_NAME, required = false)
|
||||
public void setDefaultActionName(String defaultActionName) {
|
||||
this.defaultActionName = defaultActionName;
|
||||
}
|
||||
|
||||
@Inject(value = StrutsConstants.STRUTS_ALLOWED_METHOD_NAMES, required = false)
|
||||
public void setAllowedMethodNames(String allowedMethodNames) {
|
||||
this.allowedMethodNames = Pattern.compile(allowedMethodNames);
|
||||
}
|
||||
|
||||
@Inject(value = StrutsConstants.STRUTS_DEFAULT_METHOD_NAME, required = false)
|
||||
public void setDefaultMethodName(String defaultMethodName) {
|
||||
this.defaultMethodName = defaultMethodName;
|
||||
}
|
||||
|
||||
@Inject(value = StrutsConstants.STRUTS_MAPPER_ACTION_PREFIX_ENABLED)
|
||||
public void setAllowActionPrefix(String allowActionPrefix) {
|
||||
this.allowActionPrefix = "true".equalsIgnoreCase(allowActionPrefix);
|
||||
@@ -253,7 +288,7 @@ public class DefaultActionMapper implements ActionMapper {
|
||||
ActionMapping mapping = new ActionMapping();
|
||||
String uri = RequestUtils.getUri(request);
|
||||
|
||||
int indexOfSemicolon = uri.indexOf(";");
|
||||
int indexOfSemicolon = uri.indexOf(';');
|
||||
uri = (indexOfSemicolon > -1) ? uri.substring(0, indexOfSemicolon) : uri;
|
||||
|
||||
uri = dropExtension(uri, mapping);
|
||||
@@ -273,7 +308,7 @@ public class DefaultActionMapper implements ActionMapper {
|
||||
if (allowDynamicMethodCalls) {
|
||||
// handle "name!method" convention.
|
||||
String name = mapping.getName();
|
||||
int exclamation = name.lastIndexOf("!");
|
||||
int exclamation = name.lastIndexOf('!');
|
||||
if (exclamation != -1) {
|
||||
mapping.setName(name.substring(0, exclamation));
|
||||
|
||||
@@ -322,7 +357,7 @@ public class DefaultActionMapper implements ActionMapper {
|
||||
*/
|
||||
protected void parseNameAndNamespace(String uri, ActionMapping mapping, ConfigurationManager configManager) {
|
||||
String namespace, name;
|
||||
int lastSlash = uri.lastIndexOf("/");
|
||||
int lastSlash = uri.lastIndexOf('/');
|
||||
if (lastSlash == -1) {
|
||||
namespace = "";
|
||||
name = uri;
|
||||
@@ -370,12 +405,30 @@ public class DefaultActionMapper implements ActionMapper {
|
||||
}
|
||||
}
|
||||
|
||||
mapping.setNamespace(namespace);
|
||||
mapping.setNamespace(cleanupNamespaceName(namespace));
|
||||
mapping.setName(cleanupActionName(name));
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans up action name from suspicious characters
|
||||
* Checks namespace name against allowed pattern if not matched returns default namespace
|
||||
*
|
||||
* @param rawNamespace name extracted from URI
|
||||
* @return safe namespace name
|
||||
*/
|
||||
protected String cleanupNamespaceName(final String rawNamespace) {
|
||||
if (allowedNamespaceNames.matcher(rawNamespace).matches()) {
|
||||
return rawNamespace;
|
||||
} else {
|
||||
LOG.warn(
|
||||
"{} did not match allowed namespace names {} - default namespace {} will be used!",
|
||||
rawNamespace, allowedNamespaceNames, defaultNamespaceName
|
||||
);
|
||||
return defaultNamespaceName;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks action name against allowed pattern if not matched returns default action name
|
||||
*
|
||||
* @param rawActionName action name extracted from URI
|
||||
* @return safe action name
|
||||
@@ -384,18 +437,23 @@ public class DefaultActionMapper implements ActionMapper {
|
||||
if (allowedActionNames.matcher(rawActionName).matches()) {
|
||||
return rawActionName;
|
||||
} else {
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Action [#0] does not match allowed action names pattern [#1], cleaning it up!",
|
||||
rawActionName, allowedActionNames);
|
||||
}
|
||||
String cleanActionName = rawActionName;
|
||||
for (String chunk : allowedActionNames.split(rawActionName)) {
|
||||
cleanActionName = cleanActionName.replace(chunk, "");
|
||||
}
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Cleaned action name [#0]", cleanActionName);
|
||||
}
|
||||
return cleanActionName;
|
||||
LOG.warn("{} did not match allowed action names {} - default action {} will be used!", rawActionName, allowedActionNames, defaultActionName);
|
||||
return defaultActionName;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks method name (when DMI is enabled) against allowed pattern if not matched returns default action name
|
||||
*
|
||||
* @param rawMethodName method name extracted from URI
|
||||
* @return safe method name
|
||||
*/
|
||||
protected String cleanupMethodName(final String rawMethodName) {
|
||||
if (allowedMethodNames.matcher(rawMethodName).matches()) {
|
||||
return rawMethodName;
|
||||
} else {
|
||||
LOG.warn("{} did not match allowed method names {} - default method {} will be used!", rawMethodName, allowedMethodNames, defaultMethodName);
|
||||
return defaultMethodName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-1
@@ -120,7 +120,11 @@ public class JakartaMultiPartRequest implements MultiPartRequest {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Preparing error message for key: [#0]", errorKey);
|
||||
}
|
||||
return LocalizedTextUtil.findText(this.getClass(), errorKey, defaultLocale, e.getMessage(), args);
|
||||
if (LocalizedTextUtil.findText(this.getClass(), errorKey, defaultLocale, null, new Object[0]) == null) {
|
||||
return LocalizedTextUtil.findText(this.getClass(), "struts.messages.error.uploading", defaultLocale, null, new Object[] { e.getMessage() });
|
||||
} else {
|
||||
return LocalizedTextUtil.findText(this.getClass(), errorKey, defaultLocale, null, args);
|
||||
}
|
||||
}
|
||||
|
||||
protected void processUpload(HttpServletRequest request, String saveDir) throws FileUploadException, UnsupportedEncodingException {
|
||||
|
||||
+5
-1
@@ -539,7 +539,11 @@ public class JakartaStreamMultiPartRequest implements MultiPartRequest {
|
||||
String errorKey = "struts.message.upload.error." + e.getClass().getSimpleName();
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Preparing error message for key: [#0]", errorKey);
|
||||
return LocalizedTextUtil.findText(this.getClass(), errorKey, defaultLocale, e.getMessage(), args);
|
||||
if (LocalizedTextUtil.findText(this.getClass(), errorKey, defaultLocale, null, new Object[0]) == null) {
|
||||
return LocalizedTextUtil.findText(this.getClass(), "struts.messages.error.uploading", defaultLocale, null, new Object[] { e.getMessage() });
|
||||
} else {
|
||||
return LocalizedTextUtil.findText(this.getClass(), errorKey, defaultLocale, null, args);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+5
-1
@@ -108,7 +108,11 @@ public class MultiPartRequestWrapper extends StrutsRequestWrapper {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Preparing error message for key: [#0]", errorKey);
|
||||
}
|
||||
return LocalizedTextUtil.findText(this.getClass(), errorKey, defaultLocale, e.getMessage(), args);
|
||||
if (LocalizedTextUtil.findText(this.getClass(), errorKey, getLocale(), null, new Object[0]) == null) {
|
||||
return LocalizedTextUtil.findText(this.getClass(), "struts.messages.error.uploading", defaultLocale, null, new Object[] { e.getMessage() });
|
||||
} else {
|
||||
return LocalizedTextUtil.findText(this.getClass(), errorKey, defaultLocale, null, args);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -168,7 +168,9 @@ public class PrepareOperations {
|
||||
request.setAttribute(STRUTS_ACTION_MAPPING_KEY, mapping);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
dispatcher.sendError(request, response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, ex);
|
||||
if (dispatcher.isHandleException() || dispatcher.isDevMode()) {
|
||||
dispatcher.sendError(request, response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -72,8 +72,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);
|
||||
|
||||
@@ -44,11 +44,11 @@ public class ComponentUtils {
|
||||
* @return true if it is an expression
|
||||
*/
|
||||
public static boolean isExpression(String expr) {
|
||||
return expr.startsWith("%{") && expr.endsWith("}");
|
||||
return expr != null && expr.startsWith("%{") && expr.endsWith("}");
|
||||
}
|
||||
|
||||
public static boolean containsExpression(String expr) {
|
||||
return expr.contains("%{") && expr.contains("}");
|
||||
return expr != null && expr.contains("%{") && expr.contains("}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,4 +19,16 @@ public class URLDecoderUtil {
|
||||
return UDecoder.URLDecode(sequence, charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes a <code>x-www-form-urlencoded</code> string.
|
||||
* @param sequence the String to decode
|
||||
* @param charset The name of a supported character encoding.
|
||||
* @param isQueryString whether input is a query string. If <code>true</code> other decoding rules apply.
|
||||
* @return the newly decoded <code>String</code>
|
||||
* @exception IllegalArgumentException If the encoding is not valid
|
||||
*/
|
||||
public static String decode(String sequence, String charset, boolean isQueryString) {
|
||||
return UDecoder.URLDecode(sequence, charset, isQueryString);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import freemarker.cache.FileTemplateLoader;
|
||||
import freemarker.cache.MultiTemplateLoader;
|
||||
import freemarker.cache.TemplateLoader;
|
||||
import freemarker.cache.WebappTemplateLoader;
|
||||
import freemarker.core.TemplateClassResolver;
|
||||
import freemarker.ext.jsp.TaglibFactory;
|
||||
import freemarker.ext.servlet.HttpRequestHashModel;
|
||||
import freemarker.ext.servlet.HttpRequestParametersHashModel;
|
||||
@@ -344,6 +345,9 @@ public class FreemarkerManager {
|
||||
configuration.setLocalizedLookup(false);
|
||||
configuration.setWhitespaceStripping(true);
|
||||
|
||||
LOG.debug("Sets NewBuiltinClassResolver to TemplateClassResolver.SAFER_RESOLVER");
|
||||
configuration.setNewBuiltinClassResolver(TemplateClassResolver.SAFER_RESOLVER);
|
||||
|
||||
return configuration;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,18 @@ package org.apache.struts2.views.util;
|
||||
import com.opensymphony.xwork2.inject.Inject;
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.struts2.StrutsConstants;
|
||||
@@ -179,9 +191,9 @@ public class DefaultUrlHelper implements UrlHelper {
|
||||
|
||||
//if the action was not explicitly set grab the params from the request
|
||||
if (escapeAmp) {
|
||||
buildParametersString(params, link, AMP);
|
||||
buildParametersString(params, link, AMP, true);
|
||||
} else {
|
||||
buildParametersString(params, link, "&");
|
||||
buildParametersString(params, link, "&", true);
|
||||
}
|
||||
|
||||
String result = link.toString();
|
||||
@@ -202,6 +214,10 @@ public class DefaultUrlHelper implements UrlHelper {
|
||||
}
|
||||
|
||||
public void buildParametersString(Map<String, Object> params, StringBuilder link, String paramSeparator) {
|
||||
buildParametersString(params, link, paramSeparator, true);
|
||||
}
|
||||
|
||||
public void buildParametersString(Map<String, Object> params, StringBuilder link, String paramSeparator, boolean encode) {
|
||||
if ((params != null) && (params.size() > 0)) {
|
||||
if (!link.toString().contains("?")) {
|
||||
link.append("?");
|
||||
@@ -219,7 +235,7 @@ public class DefaultUrlHelper implements UrlHelper {
|
||||
if (value instanceof Iterable) {
|
||||
for (Iterator iterator = ((Iterable) value).iterator(); iterator.hasNext();) {
|
||||
Object paramValue = iterator.next();
|
||||
link.append(buildParameterSubstring(name, paramValue != null ? paramValue.toString() : StringUtils.EMPTY));
|
||||
link.append(buildParameterSubstring(name, paramValue != null ? paramValue.toString() : StringUtils.EMPTY, encode));
|
||||
|
||||
if (iterator.hasNext()) {
|
||||
link.append(paramSeparator);
|
||||
@@ -229,14 +245,14 @@ public class DefaultUrlHelper implements UrlHelper {
|
||||
Object[] array = (Object[]) value;
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
Object paramValue = array[i];
|
||||
link.append(buildParameterSubstring(name, paramValue != null ? paramValue.toString() : StringUtils.EMPTY));
|
||||
link.append(buildParameterSubstring(name, paramValue != null ? paramValue.toString() : StringUtils.EMPTY, encode));
|
||||
|
||||
if (i < array.length - 1) {
|
||||
link.append(paramSeparator);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
link.append(buildParameterSubstring(name, value != null ? value.toString() : StringUtils.EMPTY));
|
||||
link.append(buildParameterSubstring(name, value != null ? value.toString() : StringUtils.EMPTY, encode));
|
||||
}
|
||||
|
||||
if (iter.hasNext()) {
|
||||
@@ -250,11 +266,11 @@ public class DefaultUrlHelper implements UrlHelper {
|
||||
return HTTP_PROTOCOL.equals(scheme) || HTTPS_PROTOCOL.equals(scheme);
|
||||
}
|
||||
|
||||
private String buildParameterSubstring(String name, String value) {
|
||||
private String buildParameterSubstring(String name, String value, boolean encode) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append(encode(name));
|
||||
builder.append(encode ? encode(name) : name);
|
||||
builder.append('=');
|
||||
builder.append(encode(value));
|
||||
builder.append(encode ? encode(value) : value);
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
@@ -283,7 +299,7 @@ public class DefaultUrlHelper implements UrlHelper {
|
||||
*/
|
||||
public String decode( String input ) {
|
||||
try {
|
||||
return URLDecoderUtil.decode(input, encoding);
|
||||
return URLDecoderUtil.decode(input, encoding, false);
|
||||
} catch (Exception e) {
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Could not decode URL parameter '#0', returning value un-decoded", input);
|
||||
@@ -292,6 +308,22 @@ public class DefaultUrlHelper implements UrlHelper {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes the URL using {@link URLDecoderUtil#decode(String, String, boolean)} with the encoding specified in the configuration.
|
||||
*
|
||||
* @param input the input to decode
|
||||
* @param isQueryString whether input is a query string. If <code>true</code> other decoding rules apply.
|
||||
* @return the encoded string
|
||||
*/
|
||||
public String decode( String input, boolean isQueryString ) {
|
||||
try {
|
||||
return URLDecoderUtil.decode(input, encoding, isQueryString);
|
||||
} catch (Exception e) {
|
||||
LOG.warn("Could not decode URL parameter '{}', returning value un-decoded", input);
|
||||
return input;
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String, Object> parseQueryString(String queryString, boolean forceValueArray) {
|
||||
Map<String, Object> queryParams = new LinkedHashMap<String, Object>();
|
||||
if (queryString != null) {
|
||||
@@ -308,8 +340,8 @@ public class DefaultUrlHelper implements UrlHelper {
|
||||
paramValue = tmpParams[1];
|
||||
}
|
||||
if (paramName != null) {
|
||||
paramName = decode(paramName);
|
||||
String translatedParamValue = decode(paramValue);
|
||||
paramName = decode(paramName, true);
|
||||
String translatedParamValue = decode(paramValue, true);
|
||||
|
||||
if (queryParams.containsKey(paramName) || forceValueArray) {
|
||||
// WW-1619 append new param value to existing value(s)
|
||||
|
||||
@@ -448,12 +448,7 @@ public class XSLTResult implements Result {
|
||||
ServletActionContext.getServletContext());
|
||||
}
|
||||
|
||||
protected Templates getTemplates(String path) throws TransformerException, IOException {
|
||||
String pathFromRequest = ServletActionContext.getRequest().getParameter("xslt.location");
|
||||
|
||||
if (pathFromRequest != null)
|
||||
path = pathFromRequest;
|
||||
|
||||
protected Templates getTemplates(final String path) throws TransformerException, IOException {
|
||||
if (path == null)
|
||||
throw new TransformerException("Stylesheet path is null");
|
||||
|
||||
|
||||
@@ -47,10 +47,6 @@
|
||||
java.lang.ClassLoader,
|
||||
java.lang.Shutdown,
|
||||
java.lang.ProcessBuilder,
|
||||
ognl.OgnlContext,
|
||||
ognl.ClassResolver,
|
||||
ognl.TypeConverter,
|
||||
com.opensymphony.xwork2.ognl.SecurityMemberAccess,
|
||||
com.opensymphony.xwork2.ActionContext" />
|
||||
|
||||
<!-- this must be valid regex, each '.' in package name must be escaped! -->
|
||||
@@ -58,7 +54,18 @@
|
||||
<!-- constant name="struts.excludedPackageNamePatterns" value="^java\.lang\..*,^ognl.*,^(?!javax\.servlet\..+)(javax\..+)" / -->
|
||||
|
||||
<!-- this is simpler version of the above used with string comparison -->
|
||||
<constant name="struts.excludedPackageNames" value="java.lang.,ognl,javax" />
|
||||
<constant name="struts.excludedPackageNames"
|
||||
value="
|
||||
ognl.,
|
||||
javax.,
|
||||
freemarker.core.,
|
||||
freemarker.template.,
|
||||
freemarker.ext.rhino.,
|
||||
sun.reflect.,
|
||||
javassist.,
|
||||
com.opensymphony.xwork2.ognl.,
|
||||
com.opensymphony.xwork2.security.,
|
||||
com.opensymphony.xwork2.util." />
|
||||
|
||||
<bean class="com.opensymphony.xwork2.ObjectFactory" name="struts"/>
|
||||
<bean type="com.opensymphony.xwork2.factory.ResultFactory" name="struts" class="org.apache.struts2.factory.StrutsResultFactory" />
|
||||
|
||||
@@ -61,6 +61,9 @@
|
||||
</#if>
|
||||
<#else>
|
||||
<input type="submit"<#rt/>
|
||||
<#if parameters.nameValue?has_content>
|
||||
value="<@s.property value="parameters.nameValue"/>"<#rt/>
|
||||
</#if>
|
||||
</#if>
|
||||
<#if parameters.id?has_content>
|
||||
id="${parameters.id?html}"<#rt/>
|
||||
@@ -68,9 +71,6 @@
|
||||
<#if parameters.name?has_content>
|
||||
name="${parameters.name?html}"<#rt/>
|
||||
</#if>
|
||||
<#if parameters.nameValue?has_content>
|
||||
value="<@s.property value="parameters.nameValue"/>"<#rt/>
|
||||
</#if>
|
||||
<#if parameters.disabled!false>
|
||||
disabled="disabled"<#rt/>
|
||||
</#if>
|
||||
|
||||
@@ -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";
|
||||
// }
|
||||
}
|
||||
|
||||
+107
-66
@@ -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.dispatcher.StrutsResultSupport;
|
||||
import org.apache.struts2.views.jsp.StrutsMockHttpServletRequest;
|
||||
@@ -67,7 +68,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
};
|
||||
}
|
||||
|
||||
public void testGetMapping() throws Exception {
|
||||
public void testGetMapping() {
|
||||
req.setupGetRequestURI("/my/namespace/actionName.action");
|
||||
req.setupGetServletPath("/my/namespace/actionName.action");
|
||||
req.setupGetAttribute(null);
|
||||
@@ -81,7 +82,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertNull(mapping.getMethod());
|
||||
}
|
||||
|
||||
public void testGetMappingWithMethod() throws Exception {
|
||||
public void testGetMappingWithMethod() {
|
||||
req.setupGetParameterMap(new HashMap());
|
||||
req.setupGetRequestURI("/my/namespace/actionName!add.action");
|
||||
req.setupGetServletPath("/my/namespace/actionName!add.action");
|
||||
@@ -97,7 +98,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertEquals("add", mapping.getMethod());
|
||||
}
|
||||
|
||||
public void testGetMappingWithSlashedName() throws Exception {
|
||||
public void testGetMappingWithSlashedName() {
|
||||
|
||||
req.setupGetRequestURI("/my/foo/actionName.action");
|
||||
req.setupGetServletPath("/my/foo/actionName.action");
|
||||
@@ -113,7 +114,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertNull(mapping.getMethod());
|
||||
}
|
||||
|
||||
public void testGetMappingWithSlashedNameAtRootButNoSlashPackage() throws Exception {
|
||||
public void testGetMappingWithSlashedNameAtRootButNoSlashPackage() {
|
||||
|
||||
req.setupGetRequestURI("/foo/actionName.action");
|
||||
req.setupGetServletPath("/foo/actionName.action");
|
||||
@@ -129,7 +130,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertNull(mapping.getMethod());
|
||||
}
|
||||
|
||||
public void testGetMappingWithSlashedNameAtRoot() throws Exception {
|
||||
public void testGetMappingWithSlashedNameAtRoot() {
|
||||
config = new DefaultConfiguration();
|
||||
PackageConfig pkg = new PackageConfig.Builder("myns")
|
||||
.namespace("/my/namespace").build();
|
||||
@@ -160,10 +161,10 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
|
||||
|
||||
|
||||
public void testGetMappingWithNamespaceSlash() throws Exception {
|
||||
public void testGetMappingWithNamespaceSlash() {
|
||||
|
||||
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,10 +181,10 @@ 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 {
|
||||
public void testGetMappingWithUnknownNamespace() {
|
||||
req.setupGetRequestURI("/bo/foo/actionName.action");
|
||||
req.setupGetServletPath("/bo/foo/actionName.action");
|
||||
req.setupGetAttribute(null);
|
||||
@@ -197,7 +198,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertNull(mapping.getMethod());
|
||||
}
|
||||
|
||||
public void testGetMappingWithUnknownNamespaceButFullNamespaceSelect() throws Exception {
|
||||
public void testGetMappingWithUnknownNamespaceButFullNamespaceSelect() {
|
||||
req.setupGetRequestURI("/bo/foo/actionName.action");
|
||||
req.setupGetServletPath("/bo/foo/actionName.action");
|
||||
req.setupGetAttribute(null);
|
||||
@@ -212,7 +213,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertNull(mapping.getMethod());
|
||||
}
|
||||
|
||||
public void testGetMappingWithActionName_methodAndName() throws Exception {
|
||||
public void testGetMappingWithActionName_methodAndName() {
|
||||
DefaultActionMapper mapper = new DefaultActionMapper();
|
||||
mapper.setAllowDynamicMethodCalls("true");
|
||||
ActionMapping mapping = mapper.getMappingFromActionName("actionName!add");
|
||||
@@ -220,22 +221,22 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertEquals("add", mapping.getMethod());
|
||||
}
|
||||
|
||||
public void testGetMappingWithActionName_name() throws Exception {
|
||||
public void testGetMappingWithActionName_name() {
|
||||
DefaultActionMapper mapper = new DefaultActionMapper();
|
||||
ActionMapping mapping = mapper.getMappingFromActionName("actionName");
|
||||
assertEquals("actionName", mapping.getName());
|
||||
assertEquals(null, mapping.getMethod());
|
||||
assertNull(mapping.getMethod());
|
||||
}
|
||||
|
||||
public void testGetMappingWithActionName_noDynamicMethod() throws Exception {
|
||||
public void testGetMappingWithActionName_noDynamicMethod() {
|
||||
DefaultActionMapper mapper = new DefaultActionMapper();
|
||||
mapper.setAllowDynamicMethodCalls("false");
|
||||
ActionMapping mapping = mapper.getMappingFromActionName("actionName!add");
|
||||
assertEquals("actionName!add", mapping.getName());
|
||||
assertEquals(null, mapping.getMethod());
|
||||
assertNull(mapping.getMethod());
|
||||
}
|
||||
|
||||
public void testGetMappingWithActionName_noDynamicMethodColonPrefix() throws Exception {
|
||||
public void testGetMappingWithActionName_noDynamicMethodColonPrefix() {
|
||||
|
||||
Map parameterMap = new HashMap();
|
||||
parameterMap.put(DefaultActionMapper.METHOD_PREFIX + "someMethod", "");
|
||||
@@ -249,16 +250,16 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
ActionMapping actionMapping = defaultActionMapper.getMapping(request, configManager);
|
||||
|
||||
assertEquals("someServletPath", actionMapping.getName());
|
||||
assertEquals(null, actionMapping.getMethod());
|
||||
assertNull(actionMapping.getMethod());
|
||||
}
|
||||
|
||||
public void testGetMappingWithActionName_null() throws Exception {
|
||||
public void testGetMappingWithActionName_null() {
|
||||
DefaultActionMapper mapper = new DefaultActionMapper();
|
||||
ActionMapping mapping = mapper.getMappingFromActionName(null);
|
||||
assertNull(mapping);
|
||||
}
|
||||
|
||||
public void testGetUri() throws Exception {
|
||||
public void testGetUri() {
|
||||
req.setupGetParameterMap(new HashMap());
|
||||
req.setupGetRequestURI("/my/namespace/actionName.action");
|
||||
req.setupGetServletPath("/my/namespace/actionName.action");
|
||||
@@ -270,7 +271,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertEquals("/my/namespace/actionName.action", mapper.getUriFromActionMapping(mapping));
|
||||
}
|
||||
|
||||
public void testGetUriWithSemicolonPresent() throws Exception {
|
||||
public void testGetUriWithSemicolonPresent() {
|
||||
req.setupGetParameterMap(new HashMap());
|
||||
req.setupGetRequestURI("/my/namespace/actionName.action;abc=123rty56");
|
||||
req.setupGetServletPath("/my/namespace/actionName.action;abc=123rty56");
|
||||
@@ -282,7 +283,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertEquals("/my/namespace/actionName.action", mapper.getUriFromActionMapping(mapping));
|
||||
}
|
||||
|
||||
public void testGetUriWithMethod() throws Exception {
|
||||
public void testGetUriWithMethod() {
|
||||
req.setupGetParameterMap(new HashMap());
|
||||
req.setupGetRequestURI("/my/namespace/actionName!add.action");
|
||||
req.setupGetServletPath("/my/namespace/actionName!add.action");
|
||||
@@ -295,7 +296,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertEquals("/my/namespace/actionName!add.action", mapper.getUriFromActionMapping(mapping));
|
||||
}
|
||||
|
||||
public void testGetUriWithOriginalExtension() throws Exception {
|
||||
public void testGetUriWithOriginalExtension() {
|
||||
ActionMapping mapping = new ActionMapping("actionName", "/ns", null, new HashMap());
|
||||
|
||||
ActionMapping orig = new ActionMapping();
|
||||
@@ -306,7 +307,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertEquals("/ns/actionName.foo", mapper.getUriFromActionMapping(mapping));
|
||||
}
|
||||
|
||||
public void testGetMappingWithNoExtension() throws Exception {
|
||||
public void testGetMappingWithNoExtension() {
|
||||
req.setupGetParameterMap(new HashMap());
|
||||
req.setupGetRequestURI("/my/namespace/actionName");
|
||||
req.setupGetServletPath("/my/namespace/actionName");
|
||||
@@ -322,7 +323,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertNull(mapping.getMethod());
|
||||
}
|
||||
|
||||
public void testGetMappingWithNoExtensionButUriHasExtension() throws Exception {
|
||||
public void testGetMappingWithNoExtensionButUriHasExtension() {
|
||||
req.setupGetParameterMap(new HashMap());
|
||||
req.setupGetRequestURI("/my/namespace/actionName.html");
|
||||
req.setupGetServletPath("/my/namespace/actionName.html");
|
||||
@@ -342,7 +343,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
// === test name & namespace ===
|
||||
// =============================
|
||||
|
||||
public void testParseNameAndNamespace1() throws Exception {
|
||||
public void testParseNameAndNamespace1() {
|
||||
ActionMapping actionMapping = new ActionMapping();
|
||||
|
||||
DefaultActionMapper defaultActionMapper = new DefaultActionMapper();
|
||||
@@ -352,7 +353,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertEquals(actionMapping.getNamespace(), "");
|
||||
}
|
||||
|
||||
public void testParseNameAndNamespace2() throws Exception {
|
||||
public void testParseNameAndNamespace2() {
|
||||
ActionMapping actionMapping = new ActionMapping();
|
||||
|
||||
DefaultActionMapper defaultActionMapper = new DefaultActionMapper();
|
||||
@@ -362,7 +363,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertEquals(actionMapping.getNamespace(), "/");
|
||||
}
|
||||
|
||||
public void testParseNameAndNamespace3() throws Exception {
|
||||
public void testParseNameAndNamespace3() {
|
||||
ActionMapping actionMapping = new ActionMapping();
|
||||
|
||||
DefaultActionMapper defaultActionMapper = new DefaultActionMapper();
|
||||
@@ -372,7 +373,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertEquals(actionMapping.getNamespace(), "/my");
|
||||
}
|
||||
|
||||
public void testParseNameAndNamespace_NoSlashes() throws Exception {
|
||||
public void testParseNameAndNamespace_NoSlashes() {
|
||||
ActionMapping actionMapping = new ActionMapping();
|
||||
|
||||
DefaultActionMapper defaultActionMapper = new DefaultActionMapper();
|
||||
@@ -383,7 +384,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertEquals(actionMapping.getNamespace(), "");
|
||||
}
|
||||
|
||||
public void testParseNameAndNamespace_AllowSlashes() throws Exception {
|
||||
public void testParseNameAndNamespace_AllowSlashes() {
|
||||
ActionMapping actionMapping = new ActionMapping();
|
||||
|
||||
DefaultActionMapper defaultActionMapper = new DefaultActionMapper();
|
||||
@@ -399,7 +400,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
// === test special prefix ===
|
||||
// ===========================
|
||||
|
||||
public void testActionPrefixWhenDisabled() throws Exception {
|
||||
public void testActionPrefixWhenDisabled() {
|
||||
Map parameterMap = new HashMap();
|
||||
parameterMap.put(DefaultActionMapper.ACTION_PREFIX + "myAction", "");
|
||||
|
||||
@@ -413,7 +414,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertEquals("someServletPath", actionMapping.getName());
|
||||
}
|
||||
|
||||
public void testActionPrefixWhenEnabled() throws Exception {
|
||||
public void testActionPrefixWhenEnabled() {
|
||||
Map parameterMap = new HashMap();
|
||||
parameterMap.put(DefaultActionMapper.ACTION_PREFIX + "myAction", "");
|
||||
|
||||
@@ -428,7 +429,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertEquals("myAction", actionMapping.getName());
|
||||
}
|
||||
|
||||
public void testActionPrefixWhenSlashesAndCrossNamespaceDisabled() throws Exception {
|
||||
public void testActionPrefixWhenSlashesAndCrossNamespaceDisabled() {
|
||||
Map parameterMap = new HashMap();
|
||||
parameterMap.put(DefaultActionMapper.ACTION_PREFIX + "my/Action", "");
|
||||
|
||||
@@ -444,7 +445,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertEquals("my/Action", actionMapping.getName());
|
||||
}
|
||||
|
||||
public void testActionPrefixWhenSlashesButSlashesDisabledAndCrossNamespaceDisabled() throws Exception {
|
||||
public void testActionPrefixWhenSlashesButSlashesDisabledAndCrossNamespaceDisabled() {
|
||||
Map parameterMap = new HashMap();
|
||||
parameterMap.put(DefaultActionMapper.ACTION_PREFIX + "my/Action", "");
|
||||
|
||||
@@ -460,7 +461,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertEquals("Action", actionMapping.getName());
|
||||
}
|
||||
|
||||
public void testActionPrefixWhenSlashesButSlashesDisabledAndCrossNamespace() throws Exception {
|
||||
public void testActionPrefixWhenSlashesButSlashesDisabledAndCrossNamespace() {
|
||||
Map parameterMap = new HashMap();
|
||||
parameterMap.put(DefaultActionMapper.ACTION_PREFIX + "my/Action", "");
|
||||
|
||||
@@ -477,7 +478,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertEquals("my/Action", actionMapping.getName());
|
||||
}
|
||||
|
||||
public void testActionPrefixWhenCrossNamespace() throws Exception {
|
||||
public void testActionPrefixWhenCrossNamespace() {
|
||||
Map parameterMap = new HashMap();
|
||||
parameterMap.put(DefaultActionMapper.ACTION_PREFIX + "/my/Action", "");
|
||||
|
||||
@@ -493,7 +494,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertEquals("/my/Action", actionMapping.getName());
|
||||
}
|
||||
|
||||
public void testActionPrefix_fromImageButton() throws Exception {
|
||||
public void testActionPrefix_fromImageButton() {
|
||||
Map parameterMap = new HashMap();
|
||||
parameterMap.put(DefaultActionMapper.ACTION_PREFIX + "myAction", "");
|
||||
parameterMap.put(DefaultActionMapper.ACTION_PREFIX + "myAction.x", "");
|
||||
@@ -510,7 +511,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertEquals("myAction", actionMapping.getName());
|
||||
}
|
||||
|
||||
public void testActionPrefix_fromIEImageButton() throws Exception {
|
||||
public void testActionPrefix_fromIEImageButton() {
|
||||
Map parameterMap = new HashMap();
|
||||
parameterMap.put(DefaultActionMapper.ACTION_PREFIX + "myAction.x", "");
|
||||
parameterMap.put(DefaultActionMapper.ACTION_PREFIX + "myAction.y", "");
|
||||
@@ -526,7 +527,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertEquals("myAction", actionMapping.getName());
|
||||
}
|
||||
|
||||
public void testRedirectPrefix() throws Exception {
|
||||
public void testRedirectPrefix() {
|
||||
Map parameterMap = new HashMap();
|
||||
parameterMap.put("redirect:" + "http://www.google.com", "");
|
||||
|
||||
@@ -542,7 +543,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertNull(result);
|
||||
}
|
||||
|
||||
public void testUnsafeRedirectPrefix() throws Exception {
|
||||
public void testUnsafeRedirectPrefix() {
|
||||
Map parameterMap = new HashMap();
|
||||
parameterMap.put("redirect:" + "http://%{3*4}", "");
|
||||
|
||||
@@ -558,7 +559,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertNull(result);
|
||||
}
|
||||
|
||||
public void testRedirectActionPrefix() throws Exception {
|
||||
public void testRedirectActionPrefix() {
|
||||
Map parameterMap = new HashMap();
|
||||
parameterMap.put("redirectAction:" + "myAction", "");
|
||||
|
||||
@@ -575,7 +576,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertNull(result);
|
||||
}
|
||||
|
||||
public void testUnsafeRedirectActionPrefix() throws Exception {
|
||||
public void testUnsafeRedirectActionPrefix() {
|
||||
Map parameterMap = new HashMap();
|
||||
parameterMap.put("redirectAction:" + "%{3*4}", "");
|
||||
|
||||
@@ -592,7 +593,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertNull(result);
|
||||
}
|
||||
|
||||
public void testRedirectActionPrefixWithEmptyExtension() throws Exception {
|
||||
public void testRedirectActionPrefixWithEmptyExtension() {
|
||||
Map parameterMap = new HashMap();
|
||||
parameterMap.put("redirectAction:" + "myAction", "");
|
||||
|
||||
@@ -610,7 +611,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertNull(result);
|
||||
}
|
||||
|
||||
public void testCustomActionPrefix() throws Exception {
|
||||
public void testCustomActionPrefix() {
|
||||
Map parameterMap = new HashMap();
|
||||
parameterMap.put("foo:myAction", "");
|
||||
|
||||
@@ -629,7 +630,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertEquals(actionMapping.getName(), "myAction");
|
||||
}
|
||||
|
||||
public void testDropExtension() throws Exception {
|
||||
public void testDropExtension() {
|
||||
DefaultActionMapper mapper = new DefaultActionMapper();
|
||||
String name = mapper.dropExtension("foo.action");
|
||||
assertTrue("Name not right: "+name, "foo".equals(name));
|
||||
@@ -639,7 +640,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
|
||||
}
|
||||
|
||||
public void testDropExtensionWhenBlank() throws Exception {
|
||||
public void testDropExtensionWhenBlank() {
|
||||
DefaultActionMapper mapper = new DefaultActionMapper();
|
||||
mapper.setExtensions("action,,");
|
||||
String name = mapper.dropExtension("foo.action");
|
||||
@@ -650,7 +651,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertNull(mapper.dropExtension("foo."));
|
||||
}
|
||||
|
||||
public void testDropExtensionEmbeddedDot() throws Exception {
|
||||
public void testDropExtensionEmbeddedDot() {
|
||||
DefaultActionMapper mapper = new DefaultActionMapper();
|
||||
mapper.setExtensions("action,,");
|
||||
|
||||
@@ -661,7 +662,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertTrue("Name not right: "+name, "/foo/bar-1.0/baz".equals(name));
|
||||
}
|
||||
|
||||
public void testGetUriFromActionMapper1() throws Exception {
|
||||
public void testGetUriFromActionMapper1() {
|
||||
DefaultActionMapper mapper = new DefaultActionMapper();
|
||||
ActionMapping actionMapping = new ActionMapping();
|
||||
actionMapping.setMethod("myMethod");
|
||||
@@ -672,7 +673,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertEquals("/myNamespace/myActionName!myMethod.action", uri);
|
||||
}
|
||||
|
||||
public void testGetUriFromActionMapper2() throws Exception {
|
||||
public void testGetUriFromActionMapper2() {
|
||||
DefaultActionMapper mapper = new DefaultActionMapper();
|
||||
ActionMapping actionMapping = new ActionMapping();
|
||||
actionMapping.setMethod("myMethod");
|
||||
@@ -683,7 +684,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertEquals("/myActionName!myMethod.action", uri);
|
||||
}
|
||||
|
||||
public void testGetUriFromActionMapper3() throws Exception {
|
||||
public void testGetUriFromActionMapper3() {
|
||||
DefaultActionMapper mapper = new DefaultActionMapper();
|
||||
ActionMapping actionMapping = new ActionMapping();
|
||||
actionMapping.setMethod("myMethod");
|
||||
@@ -695,7 +696,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
}
|
||||
|
||||
|
||||
public void testGetUriFromActionMapper4() throws Exception {
|
||||
public void testGetUriFromActionMapper4() {
|
||||
DefaultActionMapper mapper = new DefaultActionMapper();
|
||||
ActionMapping actionMapping = new ActionMapping();
|
||||
actionMapping.setName("myActionName");
|
||||
@@ -705,7 +706,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertEquals("/myActionName.action", uri);
|
||||
}
|
||||
|
||||
public void testGetUriFromActionMapper5() throws Exception {
|
||||
public void testGetUriFromActionMapper5() {
|
||||
DefaultActionMapper mapper = new DefaultActionMapper();
|
||||
ActionMapping actionMapping = new ActionMapping();
|
||||
actionMapping.setName("myActionName");
|
||||
@@ -716,7 +717,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
}
|
||||
|
||||
//
|
||||
public void testGetUriFromActionMapper6() throws Exception {
|
||||
public void testGetUriFromActionMapper6() {
|
||||
DefaultActionMapper mapper = new DefaultActionMapper();
|
||||
ActionMapping actionMapping = new ActionMapping();
|
||||
actionMapping.setMethod("myMethod");
|
||||
@@ -727,7 +728,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertEquals("/myNamespace/myActionName!myMethod.action?test=bla", uri);
|
||||
}
|
||||
|
||||
public void testGetUriFromActionMapper7() throws Exception {
|
||||
public void testGetUriFromActionMapper7() {
|
||||
DefaultActionMapper mapper = new DefaultActionMapper();
|
||||
ActionMapping actionMapping = new ActionMapping();
|
||||
actionMapping.setMethod("myMethod");
|
||||
@@ -738,7 +739,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertEquals("/myActionName!myMethod.action?test=bla", uri);
|
||||
}
|
||||
|
||||
public void testGetUriFromActionMapper8() throws Exception {
|
||||
public void testGetUriFromActionMapper8() {
|
||||
DefaultActionMapper mapper = new DefaultActionMapper();
|
||||
ActionMapping actionMapping = new ActionMapping();
|
||||
actionMapping.setMethod("myMethod");
|
||||
@@ -750,7 +751,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
}
|
||||
|
||||
|
||||
public void testGetUriFromActionMapper9() throws Exception {
|
||||
public void testGetUriFromActionMapper9() {
|
||||
DefaultActionMapper mapper = new DefaultActionMapper();
|
||||
ActionMapping actionMapping = new ActionMapping();
|
||||
actionMapping.setName("myActionName?test=bla");
|
||||
@@ -760,7 +761,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertEquals("/myActionName.action?test=bla", uri);
|
||||
}
|
||||
|
||||
public void testGetUriFromActionMapper10() throws Exception {
|
||||
public void testGetUriFromActionMapper10() {
|
||||
DefaultActionMapper mapper = new DefaultActionMapper();
|
||||
ActionMapping actionMapping = new ActionMapping();
|
||||
actionMapping.setName("myActionName?test=bla");
|
||||
@@ -770,7 +771,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertEquals("/myActionName.action?test=bla", uri);
|
||||
}
|
||||
|
||||
public void testGetUriFromActionMapper11() throws Exception {
|
||||
public void testGetUriFromActionMapper11() {
|
||||
DefaultActionMapper mapper = new DefaultActionMapper();
|
||||
ActionMapping actionMapping = new ActionMapping();
|
||||
actionMapping.setName("myActionName.action");
|
||||
@@ -780,7 +781,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertEquals("/myActionName.action", uri);
|
||||
}
|
||||
|
||||
public void testGetUriFromActionMapper12() throws Exception {
|
||||
public void testGetUriFromActionMapper12() {
|
||||
DefaultActionMapper mapper = new DefaultActionMapper();
|
||||
ActionMapping actionMapping = new ActionMapping();
|
||||
actionMapping.setName("myActionName.action");
|
||||
@@ -790,7 +791,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertEquals("/myActionName.action", uri);
|
||||
}
|
||||
|
||||
public void testGetUriFromActionMapper_justActionAndMethod() throws Exception {
|
||||
public void testGetUriFromActionMapper_justActionAndMethod() {
|
||||
DefaultActionMapper mapper = new DefaultActionMapper();
|
||||
ActionMapping actionMapping = new ActionMapping();
|
||||
actionMapping.setMethod("myMethod");
|
||||
@@ -801,7 +802,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertEquals("myActionName!myMethod", uri);
|
||||
}
|
||||
|
||||
public void testGetUriFromActionMapperWhenBlankExtension() throws Exception {
|
||||
public void testGetUriFromActionMapperWhenBlankExtension() {
|
||||
DefaultActionMapper mapper = new DefaultActionMapper();
|
||||
mapper.setExtensions(",,");
|
||||
ActionMapping actionMapping = new ActionMapping();
|
||||
@@ -813,7 +814,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertEquals("/myNamespace/myActionName!myMethod", uri);
|
||||
}
|
||||
|
||||
public void testSetExtension() throws Exception {
|
||||
public void testSetExtension() {
|
||||
DefaultActionMapper mapper = new DefaultActionMapper();
|
||||
mapper.setExtensions("");
|
||||
assertNull(mapper.extensions);
|
||||
@@ -838,20 +839,45 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
|
||||
}
|
||||
|
||||
public void testAllowedActionNames() throws Exception {
|
||||
public void testAllowedNamespaceNames() {
|
||||
DefaultActionMapper mapper = new DefaultActionMapper();
|
||||
|
||||
String namespace = "/";
|
||||
assertEquals(namespace, mapper.cleanupNamespaceName(namespace));
|
||||
|
||||
namespace = "${namespace}";
|
||||
assertEquals(mapper.defaultNamespaceName, mapper.cleanupNamespaceName(namespace));
|
||||
|
||||
namespace = "${${%{namespace}}}";
|
||||
assertEquals(mapper.defaultNamespaceName, mapper.cleanupNamespaceName(namespace));
|
||||
|
||||
namespace = "${#foo='namespace',#foo}";
|
||||
assertEquals(mapper.defaultNamespaceName, mapper.cleanupNamespaceName(namespace));
|
||||
|
||||
namespace = "/test-namespace/namespace/";
|
||||
assertEquals("/test-namespace/namespace/", mapper.cleanupNamespaceName(namespace));
|
||||
|
||||
namespace = "/test_namespace/namespace-test/";
|
||||
assertEquals("/test_namespace/namespace-test/", mapper.cleanupNamespaceName(namespace));
|
||||
|
||||
namespace = "/test_namespace/namespace.test/";
|
||||
assertEquals("/test_namespace/namespace.test/", mapper.cleanupActionName(namespace));
|
||||
}
|
||||
|
||||
public void testAllowedActionNames() {
|
||||
DefaultActionMapper mapper = new DefaultActionMapper();
|
||||
|
||||
String actionName = "action";
|
||||
assertEquals(actionName, mapper.cleanupActionName(actionName));
|
||||
|
||||
actionName = "${action}";
|
||||
assertEquals("action", mapper.cleanupActionName(actionName));
|
||||
assertEquals(mapper.defaultActionName, mapper.cleanupActionName(actionName));
|
||||
|
||||
actionName = "${${%{action}}}";
|
||||
assertEquals("action", mapper.cleanupActionName(actionName));
|
||||
assertEquals(mapper.defaultActionName, mapper.cleanupActionName(actionName));
|
||||
|
||||
actionName = "${#foo='action',#foo}";
|
||||
assertEquals("fooactionfoo", mapper.cleanupActionName(actionName));
|
||||
assertEquals(mapper.defaultActionName, mapper.cleanupActionName(actionName));
|
||||
|
||||
actionName = "test-action";
|
||||
assertEquals("test-action", mapper.cleanupActionName(actionName));
|
||||
@@ -863,4 +889,19 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
|
||||
assertEquals("test!bar.action", mapper.cleanupActionName(actionName));
|
||||
}
|
||||
|
||||
public void testAllowedMethodNames() {
|
||||
DefaultActionMapper mapper = new DefaultActionMapper();
|
||||
|
||||
assertEquals("", mapper.cleanupMethodName(""));
|
||||
assertEquals("test", mapper.cleanupMethodName("test"));
|
||||
assertEquals("test_method", mapper.cleanupMethodName("test_method"));
|
||||
assertEquals("_test", mapper.cleanupMethodName("_test"));
|
||||
assertEquals("test1", mapper.cleanupMethodName("test1"));
|
||||
|
||||
assertEquals(mapper.defaultMethodName, mapper.cleanupMethodName("2test"));
|
||||
assertEquals(mapper.defaultMethodName, mapper.cleanupMethodName("%{exp}"));
|
||||
assertEquals(mapper.defaultMethodName, mapper.cleanupMethodName("${%{foo}}"));
|
||||
assertEquals(mapper.defaultMethodName, mapper.cleanupMethodName("${#foo='method',#foo}"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -93,6 +93,10 @@ public class ComponentUtilsTest extends StrutsInternalTestCase {
|
||||
assertFalse(actual);
|
||||
}
|
||||
|
||||
public void testIsExpressionIsFalseWhenNull() throws Exception {
|
||||
assertFalse(ComponentUtils.isExpression(null));
|
||||
}
|
||||
|
||||
public void testContainsExpressionIsTrue() throws Exception {
|
||||
// given
|
||||
String anExpression = "%{foo}";
|
||||
@@ -125,6 +129,10 @@ public class ComponentUtilsTest extends StrutsInternalTestCase {
|
||||
// then
|
||||
assertFalse(actual);
|
||||
}
|
||||
|
||||
public void testContainsExpressionIsFalseWhenNull() throws Exception {
|
||||
assertFalse(ComponentUtils.containsExpression(null));
|
||||
}
|
||||
}
|
||||
|
||||
class MockConfigurationProvider implements ConfigurationProvider {
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.struts2.util;
|
||||
|
||||
import com.opensymphony.xwork2.ognl.OgnlUtil;
|
||||
import org.apache.struts2.StrutsInternalTestCase;
|
||||
|
||||
public class OgnlUtilStrutsTest extends StrutsInternalTestCase {
|
||||
|
||||
private OgnlUtil ognlUtil;
|
||||
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
ognlUtil = container.getInstance(OgnlUtil.class);
|
||||
}
|
||||
|
||||
public void testDefaultExcludes() {
|
||||
ognlUtil.setExcludedClasses("");
|
||||
ognlUtil.setExcludedPackageNames("");
|
||||
ognlUtil.setExcludedPackageNamePatterns("");
|
||||
assertTrue(ognlUtil.getExcludedClasses().size() > 0);
|
||||
assertTrue(ognlUtil.getExcludedPackageNames().size() > 0);
|
||||
|
||||
try {
|
||||
ognlUtil.getExcludedClasses().clear();
|
||||
} catch (Exception ex){
|
||||
assertTrue(ex instanceof UnsupportedOperationException);
|
||||
}
|
||||
try {
|
||||
ognlUtil.getExcludedPackageNames().clear();
|
||||
} catch (Exception ex){
|
||||
assertTrue(ex instanceof UnsupportedOperationException);
|
||||
}
|
||||
try {
|
||||
ognlUtil.getExcludedPackageNamePatterns().clear();
|
||||
} catch (Exception ex){
|
||||
assertTrue(ex instanceof UnsupportedOperationException);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -68,4 +68,11 @@ public class URLDecoderUtilTest {
|
||||
assertEquals("xxxx\u00ea", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testURLDecodePlusCharAsSpace() {
|
||||
|
||||
String result = URLDecoderUtil.decode("a+b", "UTF-8", true);
|
||||
assertEquals("a b", result);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -237,7 +237,7 @@ public class SubmitTest extends AbstractUITagTest {
|
||||
tag.doStartTag();
|
||||
tag.doEndTag();
|
||||
|
||||
assertEquals("<input type=\"submit\" id=\"myname\" name=\"myname\" value=\"Submit\"/>", writer.toString().trim());
|
||||
assertEquals("<input type=\"submit\" value=\"Submit\" id=\"myname\" name=\"myname\"/>", writer.toString().trim());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -281,4 +281,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-12.txt"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -21,21 +21,23 @@
|
||||
|
||||
package org.apache.struts2.views.util;
|
||||
|
||||
import com.mockobjects.dynamic.Mock;
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.inject.Container;
|
||||
import com.opensymphony.xwork2.inject.Scope.Strategy;
|
||||
import org.apache.struts2.StrutsConstants;
|
||||
import org.apache.struts2.StrutsInternalTestCase;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.struts2.StrutsConstants;
|
||||
import org.apache.struts2.StrutsInternalTestCase;
|
||||
|
||||
import com.mockobjects.dynamic.Mock;
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.inject.Container;
|
||||
import com.opensymphony.xwork2.inject.Scope.Strategy;
|
||||
|
||||
|
||||
/**
|
||||
* Test case for DefaultUrlHelper.
|
||||
@@ -393,7 +395,15 @@ public class DefaultUrlHelperTest extends StrutsInternalTestCase {
|
||||
|
||||
assertEquals(result, expectedResult);
|
||||
}
|
||||
|
||||
|
||||
public void testDecodeSpacesInQueryString() throws Exception {
|
||||
Map<String, Object> queryParameters = urlHelper.parseQueryString("name=value+with+space", false);
|
||||
|
||||
assertTrue(queryParameters.containsKey("name"));
|
||||
assertEquals("value with space", queryParameters.get("name"));
|
||||
}
|
||||
|
||||
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
stubContainer = new StubContainer(container);
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<tr>
|
||||
<td colspan="2"><div align="left"><input type="submit" id="myname" name="myname" value="bar" disabled="disabled" tabindex="1"/></div></td>
|
||||
<td colspan="2"><div align="left"><input type="submit" value="bar" id="myname" name="myname" disabled="disabled" tabindex="1"/></div></td>
|
||||
</tr>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<tr>
|
||||
<td colspan="2"><div align="right"><input type="submit" id="myname" name="myname" value="Submit" title="mytitle"/></div></td>
|
||||
<td colspan="2"><div align="right"><input type="submit" value="Submit" id="myname" name="myname" title="mytitle"/></div></td>
|
||||
</tr>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<tr>
|
||||
<td colspan="2"><div align="right"><input type="image" alt="bar" id="myname" name="myname" value="bar" disabled="disabled"/></div></td>
|
||||
<td colspan="2"><div align="right"><input type="image" alt="bar" id="myname" name="myname" disabled="disabled"/></div></td>
|
||||
</tr>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<tr>
|
||||
<td colspan="2"><div align="right"><input type="image" alt="mylabel" src="some.gif" id="myname" name="myname" value="bar"/></div></td>
|
||||
<td colspan="2"><div align="right"><input type="image" alt="mylabel" src="some.gif" id="myname" name="myname"/></div></td>
|
||||
</tr>
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<tr>
|
||||
<td class="tdLabel"></td>
|
||||
<td><input type="text" name="array[1]" value="bar" id="array_1_"/></td>
|
||||
</tr>
|
||||
+1
-1
@@ -25,7 +25,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-cdi-plugin</artifactId>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-codebehind-plugin</artifactId>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-config-browser-plugin</artifactId>
|
||||
|
||||
+1
@@ -50,6 +50,7 @@ public class ShowBeansAction extends ActionNamesAction {
|
||||
|
||||
@Inject
|
||||
public void setContainer(Container container) {
|
||||
super.setContainer(container);
|
||||
bindings = new TreeMap<String, Set<Binding>>();
|
||||
bindings.put(ObjectFactory.class.getName(), addBindings(container, ObjectFactory.class, StrutsConstants.STRUTS_OBJECTFACTORY));
|
||||
bindings.put(XWorkConverter.class.getName(), addBindings(container, XWorkConverter.class, StrutsConstants.STRUTS_XWORKCONVERTER));
|
||||
|
||||
+1
@@ -36,6 +36,7 @@ public class ShowConstantsAction extends ActionNamesAction {
|
||||
|
||||
@Inject
|
||||
public void setContainer(Container container) {
|
||||
super.setContainer(container);
|
||||
constants = new HashMap<String, String>();
|
||||
for (String key : container.getInstanceNames(String.class)) {
|
||||
constants.put(key, container.getInstance(String.class, key));
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
-->
|
||||
<#include "tigris-macros.ftl">
|
||||
<@startPage pageTitle="Actions in namespace"/>
|
||||
<h3>Actions in <#if namespace == ""> default namespace <#else> ${namespace} </#if></h3>
|
||||
<h3>Actions in <#if namespace == ""> default namespace <#else> ${namespace?html} </#if></h3>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<tr><td>Action name:</td><td>${actionName}</td></tr>
|
||||
<tr><td>Namespace:</td><td> ${namespace}</td></tr>
|
||||
<tr><td>Action class:</td><td> ${config.className}</td></tr>
|
||||
<tr><td>Action method:</td><td> <#if config.methodName?exists>${config.methodName}</#if></td></tr>
|
||||
<tr><td>Action method:</td><td> <#if config.methodName??>${config.methodName}</#if></td></tr>
|
||||
<tr><td>Parameters:</td><td> <#list config.params?keys as p>
|
||||
${p}
|
||||
</#list></td></tr>
|
||||
@@ -41,9 +41,9 @@
|
||||
</table>
|
||||
|
||||
<!-- URLTag is faulty -->
|
||||
<@s.url id="url" action="showConfig" includeParams="none">
|
||||
<@s.param name="namespace">${namespace}</@s.param>
|
||||
<@s.param name="actionName">${actionName}</@s.param>
|
||||
<@s.url var="url" action="showConfig" includeParams="none">
|
||||
<@s.param name="namespace">${namespace?html}</@s.param>
|
||||
<@s.param name="actionName">${actionName?html}</@s.param>
|
||||
</@s.url>
|
||||
<#assign url = url + "&detailView=">
|
||||
<!-- Set all to false -->
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<#call startPage pageTitle="Validator Details"/>
|
||||
<table>
|
||||
<tr><td>Validated Class:</td><td>${action.stripPackage(clazz)}</td></tr>
|
||||
<tr><td>Context:</td><td>${context}</td></tr>
|
||||
<tr><td>Context:</td><td>${context?html}</td></tr>
|
||||
<tr><td>Validator Number:</td><td>${selected}</td></tr>
|
||||
<tr><td>Validator Type:</td><td>${action.stripPackage(selectedValidator.class)}</td></tr>
|
||||
</table>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-convention-plugin</artifactId>
|
||||
|
||||
+18
-10
@@ -43,6 +43,7 @@ import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -332,27 +333,34 @@ public class ConventionUnknownHandler implements UnknownHandler {
|
||||
Map<String, ResultTypeConfig> resultsByExtension) {
|
||||
try {
|
||||
boolean traceEnabled = LOG.isTraceEnabled();
|
||||
if (traceEnabled)
|
||||
if (traceEnabled) {
|
||||
LOG.trace("Checking ServletContext for [#0]", path);
|
||||
}
|
||||
|
||||
if (servletContext.getResource(path) != null) {
|
||||
if (traceEnabled)
|
||||
LOG.trace("Found");
|
||||
URL resource = servletContext.getResource(path);
|
||||
if (resource != null && resource.getPath().endsWith(path)) {
|
||||
if (traceEnabled) {
|
||||
LOG.trace("Found resource #0", resource);
|
||||
}
|
||||
return buildResult(path, resultCode, resultsByExtension.get(ext), actionContext);
|
||||
}
|
||||
|
||||
if (traceEnabled)
|
||||
LOG.trace("Checking ClasLoader for #0", path);
|
||||
if (traceEnabled) {
|
||||
LOG.trace("Checking ClassLoader for #0", path);
|
||||
}
|
||||
|
||||
String classLoaderPath = path.startsWith("/") ? path.substring(1, path.length()) : path;
|
||||
if (ClassLoaderUtil.getResource(classLoaderPath, getClass()) != null) {
|
||||
if (traceEnabled)
|
||||
LOG.trace("Found");
|
||||
resource = ClassLoaderUtil.getResource(classLoaderPath, getClass());
|
||||
if (resource != null && resource.getPath().endsWith(classLoaderPath)) {
|
||||
if (traceEnabled) {
|
||||
LOG.trace("Found resource #0", resource);
|
||||
}
|
||||
return buildResult(path, resultCode, resultsByExtension.get(ext), actionContext);
|
||||
}
|
||||
} catch (MalformedURLException e) {
|
||||
if (LOG.isErrorEnabled())
|
||||
if (LOG.isErrorEnabled()) {
|
||||
LOG.error("Unable to parse template path: [#0] skipping...", path);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
+19
-7
@@ -107,14 +107,26 @@ public class ConventionsServiceImpl implements ConventionsService {
|
||||
public Map<String, ResultTypeConfig> getResultTypesByExtension(PackageConfig packageConfig) {
|
||||
Map<String, ResultTypeConfig> results = packageConfig.getAllResultTypeConfigs();
|
||||
|
||||
ResultTypeConfig dispatcher = disableParse(results.get("dispatcher"));
|
||||
ResultTypeConfig velocity = disableParse(results.get("velocity"));
|
||||
ResultTypeConfig freemarker = disableParse(results.get("freemarker"));
|
||||
|
||||
Map<String, ResultTypeConfig> resultsByExtension = new HashMap<String, ResultTypeConfig>();
|
||||
resultsByExtension.put("jsp", results.get("dispatcher"));
|
||||
resultsByExtension.put("jspf", results.get("dispatcher"));
|
||||
resultsByExtension.put("jspx", results.get("dispatcher"));
|
||||
resultsByExtension.put("vm", results.get("velocity"));
|
||||
resultsByExtension.put("ftl", results.get("freemarker"));
|
||||
resultsByExtension.put("html", results.get("dispatcher"));
|
||||
resultsByExtension.put("htm", results.get("dispatcher"));
|
||||
resultsByExtension.put("jsp", dispatcher);
|
||||
resultsByExtension.put("jspf", dispatcher);
|
||||
resultsByExtension.put("jspx", dispatcher);
|
||||
resultsByExtension.put("vm", velocity);
|
||||
resultsByExtension.put("ftl", freemarker);
|
||||
resultsByExtension.put("html", dispatcher);
|
||||
resultsByExtension.put("htm", dispatcher);
|
||||
return resultsByExtension;
|
||||
}
|
||||
|
||||
private ResultTypeConfig disableParse(ResultTypeConfig resultConfig) {
|
||||
if (resultConfig != null) {
|
||||
return new ResultTypeConfig.Builder(resultConfig).addParam("parse", "false").build();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<parent>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -33,7 +33,7 @@ dojo.global=function(){
|
||||
return dj_currentContext;
|
||||
};
|
||||
dojo.locale=djConfig.locale;
|
||||
dojo.version={major:0,minor:4,patch:3,flag:"",revision:Number("$Rev$".match(/[0-9]+/)[0]),toString:function(){
|
||||
dojo.version={major:0,minor:4,patch:3,flag:"",revision:Number("$Rev: 670371 $".match(/[0-9]+/)[0]),toString:function(){
|
||||
with(dojo.version){
|
||||
return major+"."+minor+"."+patch+flag+" ("+revision+")";
|
||||
}
|
||||
|
||||
+1
-1
@@ -100,7 +100,7 @@ dojo.locale = djConfig.locale;
|
||||
dojo.version = {
|
||||
// summary: version number of this instance of dojo.
|
||||
major: 0, minor: 4, patch: 3, flag: "",
|
||||
revision: Number("$Rev$".match(/[0-9]+/)[0]),
|
||||
revision: Number("$Rev: 670371 $".match(/[0-9]+/)[0]),
|
||||
toString: function(){
|
||||
with(dojo.version){
|
||||
return major + "." + minor + "." + patch + flag + " (" + revision + ")"; // String
|
||||
|
||||
+1
-1
@@ -90,7 +90,7 @@ dojo.locale = djConfig.locale;
|
||||
dojo.version = {
|
||||
// summary: version number of this instance of dojo.
|
||||
major: 0, minor: 4, patch: 3, flag: "",
|
||||
revision: Number("$Rev$".match(/[0-9]+/)[0]),
|
||||
revision: Number("$Rev: 670371 $".match(/[0-9]+/)[0]),
|
||||
toString: function(){
|
||||
with(dojo.version){
|
||||
return major + "." + minor + "." + patch + flag + " (" + revision + ")"; // String
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-dwr-plugin</artifactId>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-embeddedjsp-plugin</artifactId>
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-gxp-plugin</artifactId>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-jasperreports-plugin</artifactId>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-java8-support-plugin</artifactId>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-javatemplates-plugin</artifactId>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-jfreechart-plugin</artifactId>
|
||||
|
||||
@@ -53,7 +53,7 @@ public class ChartResultTest extends StrutsTestCase {
|
||||
public void testChart() throws Exception {
|
||||
EasyMock.expect(responseMock.getOutputStream()).andReturn(os);
|
||||
EasyMock.replay(responseMock, mockActionProxy, actionInvocation);
|
||||
|
||||
|
||||
ChartResult result = new ChartResult();
|
||||
|
||||
result.setChart(mockChart);
|
||||
@@ -65,7 +65,7 @@ public class ChartResultTest extends StrutsTestCase {
|
||||
EasyMock.verify(responseMock);
|
||||
assertTrue(os.isWritten());
|
||||
}
|
||||
|
||||
|
||||
public void testContentTypePng() throws Exception {
|
||||
EasyMock.expect(responseMock.getOutputStream()).andReturn(os);
|
||||
responseMock.setContentType("image/png");
|
||||
@@ -82,7 +82,7 @@ public class ChartResultTest extends StrutsTestCase {
|
||||
EasyMock.verify(responseMock);
|
||||
assertTrue(os.isWritten());
|
||||
}
|
||||
|
||||
|
||||
public void testContentTypeJpg() throws Exception {
|
||||
EasyMock.expect(responseMock.getOutputStream()).andReturn(os);
|
||||
responseMock.setContentType("image/jpg");
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-jsf-plugin</artifactId>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-json-plugin</artifactId>
|
||||
|
||||
@@ -7,7 +7,9 @@ import org.junit.Test;
|
||||
|
||||
import java.net.URL;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
|
||||
@@ -90,6 +92,41 @@ public class JSONWriterTest extends StrutsTestCase{
|
||||
TestUtils.assertEquals(JSONWriter.class.getResource("jsonwriter-write-bean-02.txt"), json);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteBeanWithList() throws Exception {
|
||||
BeanWithList bean1 = new BeanWithList();
|
||||
bean1.setStringField("str");
|
||||
bean1.setBooleanField(true);
|
||||
bean1.setCharField('s');
|
||||
bean1.setDoubleField(10.1);
|
||||
bean1.setFloatField(1.5f);
|
||||
bean1.setIntField(10);
|
||||
bean1.setLongField(100);
|
||||
bean1.setEnumField(AnEnum.ValueA);
|
||||
bean1.setEnumBean(AnEnumBean.Two);
|
||||
List<String> errors = new ArrayList<String>();
|
||||
errors.add("Field is required");
|
||||
bean1.setErrors(errors);
|
||||
|
||||
JSONWriter jsonWriter = new JSONWriter();
|
||||
jsonWriter.setEnumAsBean(false);
|
||||
jsonWriter.setIgnoreHierarchy(false);
|
||||
String json = jsonWriter.write(bean1);
|
||||
TestUtils.assertEquals(JSONWriter.class.getResource("jsonwriter-write-bean-04.txt"), json);
|
||||
}
|
||||
|
||||
private class BeanWithList extends Bean {
|
||||
private List<String> errors;
|
||||
|
||||
public List<String> getErrors() {
|
||||
return errors;
|
||||
}
|
||||
|
||||
public void setErrors(List<String> errors) {
|
||||
this.errors = errors;
|
||||
}
|
||||
}
|
||||
|
||||
private class AnnotatedBean extends Bean{
|
||||
private URL url;
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"bigDecimal":null,
|
||||
"bigInteger":null,
|
||||
"booleanField":true,
|
||||
"byteField":0,
|
||||
"charField":"s",
|
||||
"doubleField":10.1,
|
||||
"enumBean":"Two",
|
||||
"enumField":"ValueA",
|
||||
"errors":["Field is required"],
|
||||
"floatField":1.5,
|
||||
"intField":10,
|
||||
"longField":100,
|
||||
"objectField":null,
|
||||
"stringField":"str"
|
||||
}
|
||||
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-junit-plugin</artifactId>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-osgi-plugin</artifactId>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-oval-plugin</artifactId>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-pell-multipart-plugin</artifactId>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-plexus-plugin</artifactId>
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-parent</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-portlet-tiles-plugin</artifactId>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-portlet-plugin</artifactId>
|
||||
|
||||
+2
@@ -174,6 +174,8 @@ public class PortletActionRedirectResult extends PortletResult {
|
||||
*/
|
||||
public void execute(ActionInvocation invocation) throws Exception {
|
||||
actionName = conditionalParse(actionName, invocation);
|
||||
parseLocation = false;
|
||||
|
||||
String portletNamespace = (String)invocation.getInvocationContext().get(PortletConstants.PORTLET_NAMESPACE);
|
||||
if (portletMode != null) {
|
||||
Map<PortletMode, String> namespaceMap = getNamespaceMap(invocation);
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<version>2.3.37</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-rest-plugin</artifactId>
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
package org.apache.struts2.rest;
|
||||
|
||||
import com.opensymphony.xwork2.ActionInvocation;
|
||||
import org.apache.struts2.rest.handler.ContentTypeHandler;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -58,10 +59,16 @@ public interface ContentTypeHandlerManager {
|
||||
* @param target The object to return, usually the action object
|
||||
* @return The new result code to process
|
||||
* @throws IOException If unable to write to the response
|
||||
*
|
||||
* @deprecated use version which requires {@link ActionInvocation}
|
||||
*/
|
||||
@Deprecated
|
||||
String handleResult(ActionConfig actionConfig, Object methodResult, Object target)
|
||||
throws IOException;
|
||||
|
||||
String handleResult(ActionInvocation actionInvocation, Object methodResult, Object target)
|
||||
throws IOException;
|
||||
|
||||
/**
|
||||
* Finds the extension in the url
|
||||
*
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user