Compare commits

...

8 Commits

Author SHA1 Message Date
Lukasz Lenart b3a9d82d58 [maven-release-plugin] prepare release STRUTS_2_5_25 2020-09-17 13:36:38 +02:00
Lukasz Lenart 828d02fcbd Merge pull request #438 from yasserzamani/WW-5087
WW-5087 handle Parameter.Empty properly
2020-09-15 07:48:19 +02:00
Yasser Zamani 88b05cdaed WW-5087 handle Parameter.Empty properly
There was a bug with AliasInterceptor not handling the Parameter.Empty that is returned from HttpParameters.get(). Since HttpParameters.get() always returns a non-null value, the Evaluated object is treated as always being defined, which results in the empty value being set incorrectly on the stack.
2020-09-14 18:00:54 +04:30
Lukasz Lenart e60df05c27 Merge pull request #437 from gregh3269/struts-2-5-x
Empty file upload, storeLocation null gives wrong error message.
2020-09-09 12:57:59 +02:00
Greg Huber 1efcc938cf Empty file upload, storeLocation null gives wrong error message. 2020-09-09 11:02:55 +01:00
Lukasz Lenart 7b1c3b0fca Merge pull request #436 from JCgH4164838Gh792C124B5/WW-5075_S2_5_OSGiPluginBackportfix
Backport a few PR#433 OSGi plugin-related changes from 2.6 to 2.5.
2020-09-09 07:52:57 +02:00
JCgH4164838Gh792C124B5 10a834a54c Backport a few PR#433 OSGi plugin-related changes from 2.6 to 2.5.
- Fix to allow the OSGi plugin to initialize with no internet connection.
- Fix an unintended JS change for the admin bundle.
- Fix the OSGi Demo bundle so it works under 2.5.x as well.
2020-09-08 15:25:02 -04:00
Lukasz Lenart abb1ac3c99 [maven-release-plugin] prepare for next development iteration 2020-08-18 07:38:38 +02:00
45 changed files with 119 additions and 60 deletions
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
</parent>
<artifactId>struts2-apps</artifactId>
<packaging>pom</packaging>
+2 -2
View File
@@ -24,12 +24,12 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
</parent>
<artifactId>struts2-rest-showcase</artifactId>
<packaging>war</packaging>
<version>2.5.24</version>
<version>2.5.25</version>
<name>Struts 2 Rest Showcase Webapp</name>
<description>Struts 2 Rest Showcase Example</description>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
</parent>
<artifactId>struts2-showcase</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
</parent>
<artifactId>struts2-assembly</artifactId>
+3 -3
View File
@@ -30,7 +30,7 @@
</parent>
<artifactId>struts2-bom</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
<packaging>pom</packaging>
<name>Struts 2 Bill of Materials</name>
@@ -45,7 +45,7 @@
</licenses>
<properties>
<struts-version.version>2.5.24</struts-version.version>
<struts-version.version>2.5.25</struts-version.version>
<maven.site.skip>true</maven.site.skip>
<maven.site.deploy.skip>true</maven.site.deploy.skip>
</properties>
@@ -181,7 +181,7 @@
</dependencyManagement>
<scm>
<tag>STRUTS_2_5_24</tag>
<tag>STRUTS_2_5_25</tag>
<connection>scm:git:https://gitbox.apache.org/repos/asf/struts.git</connection>
<developerConnection>scm:git:https://gitbox.apache.org/repos/asf/struts.git</developerConnection>
<url>https://github.com/apache/struts/</url>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-osgi-bundles</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
</parent>
<artifactId>struts2-osgi-admin-bundle</artifactId>
@@ -29,8 +29,8 @@
result_div.appendChild(document.createElement('br'));
for (var line_index in result_array) {
var result_wrap = document.createElement('pre')
line = document.createTextNode(result_array[line_index]);
var result_wrap = document.createElement('pre');
var line = document.createTextNode(result_array[line_index]);
result_wrap.appendChild(line);
result_div.appendChild(result_wrap);
result_div.appendChild(document.createElement('br'));
+1 -2
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-osgi-bundles</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
</parent>
<artifactId>struts2-osgi-demo-bundle</artifactId>
@@ -67,7 +67,6 @@
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<version>2.1.0</version>
<configuration>
<instructions>
<manifestLocation>META-INF</manifestLocation>
@@ -22,13 +22,21 @@ package actions.osgi;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Actions;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.ResultPath;
@ResultPath("/content")
@Namespace("/osgi")
@ResultPath("/content/osgi")
public class HelloWorldAction extends ActionSupport {
private Message message;
private Message message = new Message("Default non-null message");
@Action("hello-convention")
@Override
@Actions({
@Action(value="hello-convention", results={@Result(name="success", type="freemarker", location="/content/osgi/hello-convention.ftl")}),
@Action(value="/osgi/hello-convention", results={@Result(name="success", type="freemarker", location="/content/osgi/hello-convention.ftl")})
})
public String execute() {
return SUCCESS;
}
@@ -45,6 +53,7 @@ public class HelloWorldAction extends ActionSupport {
return "Hello!!!";
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("{message:");
sb.append(message != null ? message.getText() : "null");
@@ -20,7 +20,7 @@
-->
<html>
<head>
<title>Action mapped by the XML configurationn</title>
<title>Action mapped by the XML configuration</title>
</head>
<body>
This is an action mapped by XML configuration, using a <b>FreeMarker</b> result.
@@ -18,7 +18,7 @@
*#
<html>
<head>
<title>Action mapped by the XML configurationn</title>
<title>Action mapped by the XML configuration</title>
</head>
<body>
This is an action mapped by XML configuration, using a <b>Velocity</b> result.
+21 -6
View File
@@ -20,21 +20,36 @@
*/
-->
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd">
<struts>
<package name="bundle-demo" namespace="/osgi" extends="osgi-default">
<!-- Set some Struts 2 constants relevant to the OSGi Plugin.
Note: The constant definitions specified here (within the demo bundle) may also need to be
duplicated in the struts.xml configuration of the outer project that packages the demo
bundle JAR file within it.
-->
<constant name="struts.objectFactory" value="osgi" />
<constant name="struts.objectFactory.delegate" value="struts" />
<constant name="struts.freemarker.manager.classname" value="org.apache.struts2.osgi.BundleFreemarkerManager" />
<constant name="struts.velocity.manager.classname" value="org.apache.struts2.osgi.VelocityBundleResourceLoader" />
<constant name="struts.staticContentLoader" value="org.apache.struts2.osgi.loaders.StaticContentBundleResourceLoader" />
<package name="bundle-demo" namespace="/osgi" extends="osgi-default" strict-method-invocation="true">
<default-action-ref name="home" />
<action name="hello-velocity" class="helloWorldAction">
<action name="hello-velocity" class="actions.osgi.HelloWorldAction">
<result type="velocity">/content/osgi/hello.vm</result>
</action>
<action name="hello-freemarker" class="helloWorldAction">
<action name="hello-freemarker" class="actions.osgi.HelloWorldAction">
<result type="freemarker">/content/osgi/hello.ftl</result>
</action>
<action name="home">
<action name="home" class="actions.osgi.HelloWorldAction">
<result type="freemarker">/content/osgi/home.ftl</result>
</action>
</package>
</struts>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
</parent>
<artifactId>struts2-osgi-bundles</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
</parent>
<artifactId>struts2-core</artifactId>
<packaging>jar</packaging>
@@ -32,6 +32,7 @@ import com.opensymphony.xwork2.util.reflection.ReflectionContextState;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.dispatcher.HttpParameters;
import org.apache.struts2.dispatcher.Parameter;
import java.util.Map;
@@ -173,7 +174,10 @@ public class AliasInterceptor extends AbstractInterceptor {
HttpParameters contextParameters = ActionContext.getContext().getParameters();
if (null != contextParameters) {
value = new Evaluated(contextParameters.get(name));
Parameter param = contextParameters.get(name);
if (param.isDefined()) {
value = new Evaluated(param.getValue());
}
}
}
if (value.isDefined()) {
@@ -343,6 +343,14 @@ public class FileUploadInterceptor extends AbstractInterceptor {
validation.addFieldError(inputName, errMsg);
}
if (LOG.isWarnEnabled()) {
LOG.warn(errMsg);
}
} else if (file.getContent() == null) {
String errMsg = getTextMessage(action, "struts.messages.error.uploading", new String[]{filename});
if (validation != null) {
validation.addFieldError(inputName, errMsg);
}
if (LOG.isWarnEnabled()) {
LOG.warn(errMsg);
}
@@ -23,6 +23,7 @@ import com.opensymphony.xwork2.config.entities.ActionConfig;
import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;
import com.opensymphony.xwork2.mock.MockActionInvocation;
import com.opensymphony.xwork2.mock.MockActionProxy;
import org.apache.struts2.dispatcher.HttpParameters;
import java.util.HashMap;
import java.util.Map;
@@ -60,7 +61,30 @@ public class AliasInterceptorTest extends XWorkTestCase {
actionOne.setFoo(17);
actionOne.setBar(23);
proxy.execute();
assertEquals("name to be copied", actionOne.getAliasSource());
assertEquals(actionOne.getAliasSource(), actionOne.getAliasDest());
assertNull(actionOne.getBlah()); // WW-5087
}
public void testNotExisting() throws Exception {
Map<String, Object> params = new HashMap<>();
Map<String, Object> httpParams = new HashMap<>();
httpParams.put("notExisting", "from http parameter");
params.put(ActionContext.PARAMETERS, HttpParameters.create(httpParams).build());
XmlConfigurationProvider provider = new XmlConfigurationProvider("xwork-sample.xml");
container.inject(provider);
loadConfigurationProviders(provider);
ActionProxy proxy = actionProxyFactory.createActionProxy("", "aliasTest", null, params);
SimpleAction actionOne = (SimpleAction) proxy.getAction();
// prevent ERROR result
actionOne.setFoo(-1);
actionOne.setBar(1);
proxy.execute();
assertEquals("from http parameter", actionOne.getBlah());
assertNull(actionOne.getAliasDest()); // WW-5087
}
public void testInvalidAliasExpression() throws Exception {
+1 -1
View File
@@ -97,7 +97,7 @@
</action>
<action name="aliasTest" class="com.opensymphony.xwork2.SimpleAction">
<param name="aliases">#{ "aliasSource" : "aliasDest", "bar":"baz" }</param>
<param name="aliases">#{ "aliasSource" : "aliasDest", "bar":"baz", "notExisting":"blah" }</param>
<interceptor-ref name="params"/>
<interceptor-ref name="alias"/>
<result name="success" type="mock" />
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
</parent>
<modelVersion>4.0.0</modelVersion>
+1 -1
View File
@@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
</parent>
<artifactId>struts2-cdi-plugin</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
</parent>
<artifactId>struts2-config-browser-plugin</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
</parent>
<artifactId>struts2-convention-plugin</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
</parent>
<artifactId>struts2-dwr-plugin</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
</parent>
<artifactId>struts2-embeddedjsp-plugin</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
</parent>
<artifactId>struts2-gxp-plugin</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
</parent>
<artifactId>struts2-jasperreports-plugin</artifactId>
+1 -1
View File
@@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
</parent>
<artifactId>struts2-javatemplates-plugin</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
</parent>
<artifactId>struts2-jfreechart-plugin</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
</parent>
<artifactId>struts2-json-plugin</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
</parent>
<artifactId>struts2-junit-plugin</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
</parent>
<artifactId>struts2-osgi-plugin</artifactId>
@@ -24,11 +24,11 @@ import com.opensymphony.xwork2.config.Configuration;
import com.opensymphony.xwork2.config.ConfigurationException;
import com.opensymphony.xwork2.config.entities.PackageConfig;
import com.opensymphony.xwork2.config.impl.DefaultConfiguration;
import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;
import com.opensymphony.xwork2.inject.Container;
import com.opensymphony.xwork2.util.fs.DefaultFileManagerFactory;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.struts2.config.StrutsXmlConfigurationProvider;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -140,18 +140,18 @@ public class BundlePackageLoader implements PackageLoader {
this.contextContainer = contextContainer;
}
static class BundleConfigurationProvider extends XmlConfigurationProvider {
static class BundleConfigurationProvider extends StrutsXmlConfigurationProvider {
private Bundle bundle;
private BundleContext bundleContext;
public BundleConfigurationProvider(String filename, Bundle bundle, BundleContext bundleContext) {
super(filename, false);
super(filename, false, null); // Currently no dependency on ServletContext
this.bundle = bundle;
this.bundleContext = bundleContext;
}
public BundleConfigurationProvider(String filename) {
super(filename);
super(filename, false, null); // Currently no dependency on ServletContext
}
@Override
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
</parent>
<artifactId>struts2-oval-plugin</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
</parent>
<artifactId>struts2-pell-multipart-plugin</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
</parent>
<artifactId>struts2-plexus-plugin</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
</parent>
<artifactId>struts2-plugins</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
</parent>
<artifactId>struts2-portlet-tiles-plugin</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
</parent>
<artifactId>struts2-portlet-plugin</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
</parent>
<artifactId>struts2-rest-plugin</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
</parent>
<artifactId>struts2-sitegraph-plugin</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
</parent>
<artifactId>struts2-sitemesh-plugin</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
</parent>
<artifactId>struts2-spring-plugin</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
</parent>
<artifactId>struts2-testng-plugin</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
</parent>
<artifactId>struts2-tiles-plugin</artifactId>
+3 -3
View File
@@ -29,7 +29,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>struts2-parent</artifactId>
<version>2.5.24</version>
<version>2.5.25</version>
<packaging>pom</packaging>
<name>Struts 2</name>
<url>http://struts.apache.org/</url>
@@ -51,7 +51,7 @@
<connection>scm:git:https://gitbox.apache.org/repos/asf/struts.git</connection>
<developerConnection>scm:git:https://gitbox.apache.org/repos/asf/struts.git</developerConnection>
<url>https://github.com/apache/struts/</url>
<tag>STRUTS_2_5_24</tag>
<tag>STRUTS_2_5_25</tag>
</scm>
<issueManagement>
@@ -96,7 +96,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.outputTimestamp>2020-08-18T05:32:21Z</project.build.outputTimestamp>
<project.build.outputTimestamp>2020-09-17T11:33:02Z</project.build.outputTimestamp>
<!-- Dependencies -->
<ognl.version>3.1.28</ognl.version>