Compare commits

...

12 Commits

Author SHA1 Message Date
Lukasz Lenart f2348e53cb [maven-release-plugin] prepare release STRUTS_2_5_5 2016-10-11 20:40:26 +02:00
Lukasz Lenart 5975b7aac7 WW-4697 If DMI is sisabled, exclude action|method params 2016-10-11 10:14:25 +02:00
Lukasz Lenart 580163880c WW-4697 If DMI is enabled, exclude action|method params 2016-10-11 08:28:28 +02:00
Lukasz Lenart dbf2bcb5cd WW-4453 Reduces level to WARN 2016-10-10 11:02:27 +02:00
Lukasz Lenart 1bd9bde610 WW-4696 Upgrades to Log4j 2.7 2016-10-07 10:13:50 +02:00
Lukasz Lenart 6ab6ec879c WW-4572 Simplifies method name 2016-10-07 10:06:10 +02:00
Lukasz Lenart 69da41eb79 WW-4572 Fixes issue with file upload 2016-10-07 10:05:38 +02:00
Lukasz Lenart 7cd3d30fdc [maven-release-plugin] prepare for next development iteration 2016-10-06 21:04:16 +02:00
Lukasz Lenart 12cc861875 [maven-release-plugin] prepare release STRUTS_2_5_4 2016-10-06 21:03:54 +02:00
Lukasz Lenart adeda4788b WW-4572 Updates JavaDocs 2016-10-06 20:56:34 +02:00
Lukasz Lenart bb403720ac WW-4572 Reverts ParameterAware interface to its previous version and introduces new one 2016-10-06 20:51:19 +02:00
Lukasz Lenart 67541e07a7 [maven-release-plugin] prepare for next development iteration 2016-10-05 07:44:55 +02:00
66 changed files with 212 additions and 106 deletions
+1 -1
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>2.5.3</version>
<version>2.5.5</version>
</parent>
<artifactId>struts2-apps</artifactId>
<packaging>pom</packaging>
+2 -2
View File
@@ -26,12 +26,12 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.5.3</version>
<version>2.5.5</version>
</parent>
<artifactId>struts2-rest-showcase</artifactId>
<packaging>war</packaging>
<version>2.5.3</version>
<version>2.5.5</version>
<name>Struts 2 Rest Showcase Webapp</name>
<description>Struts 2 Rest Showcase Example</description>
+1 -1
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.5.3</version>
<version>2.5.5</version>
</parent>
<artifactId>struts2-showcase</artifactId>
+1 -1
View File
@@ -3,7 +3,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>2.5.3</version>
<version>2.5.5</version>
</parent>
<artifactId>struts2-assembly</artifactId>
+3 -3
View File
@@ -10,7 +10,7 @@
</parent>
<artifactId>struts2-bom</artifactId>
<version>2.5.3</version>
<version>2.5.5</version>
<packaging>pom</packaging>
<name>Struts 2 Bill of Materials</name>
@@ -25,7 +25,7 @@
</licenses>
<properties>
<struts-version.version>2.5.3</struts-version.version>
<struts-version.version>2.5.5</struts-version.version>
</properties>
<build>
@@ -172,6 +172,6 @@
</dependencyManagement>
<scm>
<tag>STRUTS_2_5_3</tag>
<tag>STRUTS_2_5_5</tag>
</scm>
</project>
+1 -1
View File
@@ -4,7 +4,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-osgi-bundles</artifactId>
<version>2.5.3</version>
<version>2.5.5</version>
</parent>
<artifactId>struts2-osgi-admin-bundle</artifactId>
+1 -1
View File
@@ -4,7 +4,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-osgi-bundles</artifactId>
<version>2.5.3</version>
<version>2.5.5</version>
</parent>
<artifactId>struts2-osgi-demo-bundle</artifactId>
+1 -1
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>2.5.3</version>
<version>2.5.5</version>
</parent>
<artifactId>struts2-osgi-bundles</artifactId>
+1 -1
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>2.5.3</version>
<version>2.5.5</version>
</parent>
<artifactId>struts2-core</artifactId>
<packaging>jar</packaging>
@@ -24,6 +24,7 @@ import com.opensymphony.xwork2.inject.Container;
import com.opensymphony.xwork2.inject.ContainerBuilder;
import com.opensymphony.xwork2.inject.Scope;
import com.opensymphony.xwork2.util.location.LocatableProperties;
import org.apache.struts2.StrutsConstants;
import java.util.*;
@@ -51,6 +52,7 @@ public class MockConfiguration implements Configuration {
builder.constant(XWorkConstants.DEV_MODE, "false");
builder.constant(XWorkConstants.RELOAD_XML_CONFIGURATION, "true");
builder.constant(XWorkConstants.ENABLE_OGNL_EXPRESSION_CACHE, "true");
builder.constant(StrutsConstants.STRUTS_ENABLE_DYNAMIC_METHOD_INVOCATION, "false");
container = builder.create(true);
}
@@ -87,6 +87,7 @@ import com.opensymphony.xwork2.validator.ValidatorFactory;
import com.opensymphony.xwork2.validator.ValidatorFileParser;
import ognl.MethodAccessor;
import ognl.PropertyAccessor;
import org.apache.struts2.StrutsConstants;
import java.util.ArrayList;
import java.util.Collection;
@@ -181,6 +182,7 @@ public class XWorkConfigurationProvider implements ConfigurationProvider {
.factory(AcceptedPatternsChecker.class, DefaultAcceptedPatternsChecker.class, Scope.PROTOTYPE)
;
props.setProperty(StrutsConstants.STRUTS_ENABLE_DYNAMIC_METHOD_INVOCATION, Boolean.FALSE.toString());
props.setProperty(XWorkConstants.DEV_MODE, Boolean.FALSE.toString());
props.setProperty(XWorkConstants.LOG_MISSING_PROPERTIES, Boolean.FALSE.toString());
props.setProperty(XWorkConstants.ENABLE_OGNL_EXPRESSION_CACHE, Boolean.TRUE.toString());
@@ -161,10 +161,10 @@ public class ParametersInterceptor extends MethodFilterInterceptor {
HttpParameters params;
Map<String, Parameter> acceptableParameters;
if (ordered) {
params = HttpParameters.createEmpty().withComparator(getOrderedComparator()).withParent(parameters).build();
params = HttpParameters.create().withComparator(getOrderedComparator()).withParent(parameters).build();
acceptableParameters = new TreeMap<>(getOrderedComparator());
} else {
params = HttpParameters.createEmpty().withParent(parameters).build();
params = HttpParameters.create().withParent(parameters).build();
acceptableParameters = new TreeMap<>();
}
@@ -203,7 +203,9 @@ public class ParametersInterceptor extends MethodFilterInterceptor {
String name = entry.getKey();
Parameter value = entry.getValue();
try {
if (value.isMultiple()) {
if (value instanceof Parameter.File) {
newStack.setParameter(name, value.getObject());
} else if (value.isMultiple()) {
newStack.setParameter(name, value.getMultipleValues());
} else {
newStack.setParameter(name, value.getValue());
@@ -218,7 +218,7 @@ public class StaticParametersInterceptor extends AbstractInterceptor {
protected void addParametersToContext(ActionContext ac, Map<String, ?> newParams) {
HttpParameters previousParams = ac.getParameters();
HttpParameters.Builder combinedParams = HttpParameters.createEmpty();
HttpParameters.Builder combinedParams = HttpParameters.create();
if (overwrite) {
if (previousParams != null) {
combinedParams = combinedParams.withParent(previousParams);
@@ -3,8 +3,10 @@ package com.opensymphony.xwork2.security;
import com.opensymphony.xwork2.XWorkConstants;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.util.TextParseUtil;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.StrutsConstants;
import java.util.Arrays;
import java.util.HashSet;
@@ -17,8 +19,7 @@ public class DefaultExcludedPatternsChecker implements ExcludedPatternsChecker {
public static final String[] EXCLUDED_PATTERNS = {
"(^|\\%\\{)((#?)(top(\\.|\\['|\\[\")|\\[\\d\\]\\.)?)(dojo|struts|session|request|response|application|servlet(Request|Response|Context)|parameters|context|_memberAccess)(\\.|\\[).*",
".*(^|\\.|\\[|\\'|\"|get)class(\\(\\.|\\[|\\'|\").*",
"^(action|method):.*"
".*(^|\\.|\\[|\\'|\"|get)class(\\(\\.|\\[|\\'|\").*"
};
private Set<Pattern> excludedPatterns;
@@ -45,6 +46,14 @@ public class DefaultExcludedPatternsChecker implements ExcludedPatternsChecker {
}
}
@Inject(StrutsConstants.STRUTS_ENABLE_DYNAMIC_METHOD_INVOCATION)
public void setDynamicMethodInvocation(String dmiValue) {
if (!BooleanUtils.toBoolean(dmiValue)) {
LOG.debug("DMI is disabled, adding DMI related excluded patterns");
setAdditionalExcludePatterns("^(action|method):.*");
}
}
public void setExcludedPatterns(String commaDelimitedPatterns) {
setExcludedPatterns(TextParseUtil.commaDelimitedStringToSet(commaDelimitedPatterns));
}
@@ -216,7 +216,7 @@ public class ActionComponent extends ContextBean {
parentParams = new ActionContext(getStack().getContext()).getParameters();
}
HttpParameters.Builder builder = HttpParameters.createEmpty();
HttpParameters.Builder builder = HttpParameters.create();
if (parentParams != null) {
builder = builder.withParent(parentParams);
}
@@ -23,6 +23,7 @@ package org.apache.struts2.components;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.TextProvider;
import com.opensymphony.xwork2.util.LocalizedTextUtil;
import com.opensymphony.xwork2.util.ValueStack;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -291,8 +292,17 @@ public class Date extends ContextBean {
date = ((Calendar) dateObject).getTime();
} else {
if (devMode) {
LOG.error("Expression [{}] passed to <s:date/> tag which was evaluated to [{}]({}) isn't instance of java.util.Date nor java.util.Calendar!",
name, dateObject, (dateObject != null ? dateObject.getClass() : "null"));
String developerNotification = LocalizedTextUtil.findText(
Date.class,
"devmode.notification",
ActionContext.getContext().getLocale(),
"Developer Notification:\n{0}",
new Object[]{
"Expression [" + name + "] passed to <s:date/> tag which was evaluated to [" + dateObject + "]("
+ (dateObject != null ? dateObject.getClass() : "null") + ") isn't instance of java.util.Date nor java.util.Calendar!"
}
);
LOG.warn(developerNotification);
} else {
LOG.debug("Expression [{}] passed to <s:date/> tag which was evaluated to [{}]({}) isn't instance of java.util.Date nor java.util.Calendar!",
name, dateObject, (dateObject != null ? dateObject.getClass() : "null"));
@@ -20,7 +20,7 @@ public class HttpParameters implements Cloneable {
return new Builder(requestParameterMap);
}
public static Builder createEmpty() {
public static Builder create() {
return new Builder(new HashMap<String, Object>());
}
@@ -53,18 +53,19 @@ public class HttpParameters implements Cloneable {
return parameters.containsKey(name);
}
public HttpParameters clone(Map<String, ?> newParams) {
return HttpParameters.createEmpty().withParent(this).withExtraParams(newParams).build();
}
public Map<String, Object> toMap() {
Map<String, Object> result = new HashMap<>(parameters.size());
public Map<String, String[]> toMap() {
Map<String, String[]> result = new HashMap<>(parameters.size());
for (Map.Entry<String, Parameter> entry : parameters.entrySet()) {
result.put(entry.getKey(), entry.getValue().getObject());
result.put(entry.getKey(), entry.getValue().getMultipleValues());
}
return result;
}
public HttpParameters appendAll(Map<String, Parameter> newParams) {
parameters.putAll(newParams);
return this;
}
public static class Builder {
private Map<String, Object> requestParameterMap;
private HttpParameters parent;
@@ -3,6 +3,8 @@ package org.apache.struts2.dispatcher;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.File;
public interface Parameter {
String getName();
@@ -82,6 +84,12 @@ public interface Parameter {
}
}
class File extends Request {
public File(String name, Object value) {
super(name, value);
}
}
class EmptyHttpParameter implements Parameter {
private String name;
@@ -86,7 +86,7 @@ public class ActionMappingParametersInteceptor extends ParametersInterceptor {
if (mapping != null) {
return HttpParameters.create(mapping.getParams()).build();
} else {
return HttpParameters.createEmpty().build();
return HttpParameters.create().build();
}
}
@@ -103,7 +103,7 @@ public class ActionMappingParametersInteceptor extends ParametersInterceptor {
@Override
protected void addParametersToContext(ActionContext ac, Map<String, ?> newParams) {
HttpParameters previousParams = ac.getParameters();
HttpParameters.Builder combinedParams = HttpParameters.createEmpty().withParent(previousParams).withExtraParams(newParams);
HttpParameters.Builder combinedParams = HttpParameters.create().withParent(previousParams).withExtraParams(newParams);
ac.setParameters(combinedParams.build());
}
@@ -61,7 +61,7 @@ public class CheckboxInterceptor extends AbstractInterceptor {
public String intercept(ActionInvocation ai) throws Exception {
HttpParameters parameters = ai.getInvocationContext().getParameters();
Map<String, String[]> extraParams = new HashMap<>();
Map<String, Parameter> extraParams = new HashMap<>();
for (String name : parameters.getNames()) {
if (name.startsWith("__checkbox_")) {
@@ -77,13 +77,13 @@ public class CheckboxInterceptor extends AbstractInterceptor {
// is this checkbox checked/submitted?
if (!parameters.contains(checkboxName)) {
// if not, let's be sure to default the value to false
extraParams.put(checkboxName, new String[]{ uncheckedValue });
extraParams.put(checkboxName, new Parameter.Request(checkboxName, uncheckedValue));
}
}
}
ai.getInvocationContext().setParameters(parameters.clone(extraParams));
ai.getInvocationContext().getParameters().appendAll(extraParams);
return ai.invoke();
}
@@ -96,7 +96,7 @@ public class DateTextFieldInterceptor implements Interceptor {
}
// Create all the date objects
Map<String, Object> newParams = new HashMap<>();
Map<String, Parameter> newParams = new HashMap<>();
Set<Entry<String, Map<String, String>>> dateEntries = dates.entrySet();
for (Entry<String, Map<String, String>> dateEntry : dateEntries) {
Set<Entry<String, String>> dateFormatEntries = dateEntry.getValue().entrySet();
@@ -110,13 +110,13 @@ public class DateTextFieldInterceptor implements Interceptor {
SimpleDateFormat formatter = new SimpleDateFormat(dateFormat);
formatter.setLenient(false);
Date value = formatter.parse(dateValue);
newParams.put(dateEntry.getKey(), value);
newParams.put(dateEntry.getKey(), new Parameter.Request(dateEntry.getKey(), value));
} catch (ParseException e) {
LOG.warn("Cannot parse the parameter '{}' with format '{}' and with value '{}'", dateEntry.getKey(), dateFormat, dateValue);
}
}
ai.getInvocationContext().setParameters(parameters.clone(newParams));
ai.getInvocationContext().getParameters().appendAll(newParams);
return ai.invoke();
}
@@ -30,6 +30,7 @@ import com.opensymphony.xwork2.util.TextParseUtil;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.dispatcher.Parameter;
import org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper;
import org.apache.struts2.util.ContentTypeMatcher;
@@ -294,11 +295,11 @@ public class FileUploadInterceptor extends AbstractInterceptor {
}
if (!acceptedFiles.isEmpty()) {
Map<String, Object> newParams = new HashMap<>();
newParams.put(inputName, acceptedFiles.toArray(new File[acceptedFiles.size()]));
newParams.put(contentTypeName, acceptedContentTypes.toArray(new String[acceptedContentTypes.size()]));
newParams.put(fileNameName, acceptedFileNames.toArray(new String[acceptedFileNames.size()]));
ac.setParameters(ac.getParameters().clone(newParams));
Map<String, Parameter> newParams = new HashMap<>();
newParams.put(inputName, new Parameter.File(inputName, acceptedFiles.toArray(new File[acceptedFiles.size()])));
newParams.put(contentTypeName, new Parameter.File(contentTypeName, acceptedContentTypes.toArray(new String[acceptedContentTypes.size()])));
newParams.put(fileNameName, new Parameter.File(fileNameName, acceptedFileNames.toArray(new String[acceptedFileNames.size()])));
ac.getParameters().appendAll(newParams);
}
}
} else {
@@ -0,0 +1,47 @@
/*
* $Id$
*
* 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.interceptor;
import org.apache.struts2.dispatcher.HttpParameters;
/**
* <p>
* This interface gives actions an alternative way of receiving input parameters. The parameters will
* contain all input parameters as implementation of {@link org.apache.struts2.dispatcher.Parameter}.
* Actions that need this should simply implement it.
* </p>
*
* <p>
* One common use for this is to have the action propagate parameters to internally instantiated data
* objects.
* </p>
*/
public interface HttpParametersAware {
/**
* Sets the HTTP parameters in the implementing class.
*
* @param parameters an instance of {@link HttpParameters}.
*/
void setParameters(HttpParameters parameters);
}
@@ -23,6 +23,7 @@ package org.apache.struts2.interceptor;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
import org.apache.struts2.dispatcher.HttpParameters;
import org.apache.struts2.dispatcher.Parameter;
import java.util.HashMap;
import java.util.Map;
@@ -47,7 +48,7 @@ public class MultiselectInterceptor extends AbstractInterceptor {
*/
public String intercept(ActionInvocation ai) throws Exception {
HttpParameters parameters = ai.getInvocationContext().getParameters();
Map<String, Object> newParams = new HashMap<>();
Map<String, Parameter> newParams = new HashMap<>();
for (String name : parameters.getNames()) {
if (name.startsWith("__multiselect_")) {
@@ -56,14 +57,14 @@ public class MultiselectInterceptor extends AbstractInterceptor {
// is this multi-select box submitted?
if (!parameters.contains(key)) {
// if not, let's be sure to default the value to an empty string array
newParams.put(key, new String[0]);
newParams.put(key, new Parameter.Request(key, new String[0]));
}
parameters = parameters.remove(name);
}
}
ai.getInvocationContext().setParameters(parameters.clone(newParams));
ai.getInvocationContext().getParameters().appendAll(newParams);
return ai.invoke();
}
@@ -21,11 +21,8 @@
package org.apache.struts2.interceptor;
import org.apache.struts2.dispatcher.HttpParameters;
import java.util.Map;
/**
* <p>
* This interface gives actions an alternative way of receiving input parameters. The map will
@@ -41,7 +38,10 @@ import java.util.Map;
* Note that all parameter values for a given name will be returned, so the type of the objects in
* the map is <tt>java.lang.String[]</tt>.
* </p>
*
* @deprecated please use {@link HttpParametersAware} instead
*/
@Deprecated
public interface ParameterAware {
/**
@@ -49,5 +49,5 @@ public interface ParameterAware {
*
* @param parameters a Map of parameters (name/value Strings).
*/
public void setParameters(HttpParameters parameters);
public void setParameters(Map<String, String[]> parameters);
}
@@ -55,7 +55,9 @@ import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
*
* <li>{@link ServletResponseAware}</li>
*
* <li>{@link ParameterAware}</li>
* <li>{@link ParameterAware} - deprecated since 2.5.4, please use {@link HttpParametersAware}</li>
*
* <li>{@link HttpParametersAware}</li>
*
* <li>{@link RequestAware}</li>
*
@@ -105,6 +107,7 @@ import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
* @see ServletRequestAware
* @see ServletResponseAware
* @see ParameterAware
* @see HttpParametersAware
* @see SessionAware
* @see ApplicationAware
* @see PrincipalAware
@@ -135,7 +138,11 @@ public class ServletConfigInterceptor extends AbstractInterceptor implements Str
}
if (action instanceof ParameterAware) {
((ParameterAware) action).setParameters(context.getParameters());
((ParameterAware) action).setParameters(context.getParameters().toMap());
}
if (action instanceof HttpParametersAware) {
((HttpParametersAware) action).setParameters(context.getParameters());
}
if (action instanceof ApplicationAware) {
@@ -89,7 +89,7 @@ public class ActionContextTest extends XWorkTestCase {
}
public void testParameters() {
context.setParameters(HttpParameters.createEmpty().build());
context.setParameters(HttpParameters.create().build());
assertEquals(0, context.getParameters().getNames().size());
}
@@ -126,7 +126,7 @@ public class StaticParametersInterceptorTest extends XWorkTestCase {
User user = new User();
ActionContext.getContext().getValueStack().push(user);
ActionContext.getContext().setParameters(HttpParameters.createEmpty().build());
ActionContext.getContext().setParameters(HttpParameters.create().build());
int before = ActionContext.getContext().getValueStack().size();
interceptor.setMerge("false");
interceptor.intercept(mai);
@@ -235,7 +235,7 @@ public class DoubleRangeValidatorTest extends XWorkTestCase {
loadConfigurationProviders(provider, new MockConfigurationProvider());
val = new DoubleRangeFieldValidator();
val.setValueStack(ActionContext.getContext().getValueStack());
ActionContext.getContext().setParameters(HttpParameters.createEmpty().build());
ActionContext.getContext().setParameters(HttpParameters.create().build());
}
@Override
@@ -37,7 +37,7 @@ public class ValidatorAnnotationTest extends XWorkTestCase {
public void testNotAnnotatedMethodSuccess2() throws Exception {
HashMap<String, Object> extraContext = new HashMap<>();
extraContext.put(ActionContext.PARAMETERS, HttpParameters.createEmpty().build());
extraContext.put(ActionContext.PARAMETERS, HttpParameters.create().build());
ActionProxy proxy = actionProxyFactory.createActionProxy("", "notAnnotatedMethod", null, extraContext);
proxy.execute();
@@ -50,7 +50,7 @@ public class ValidatorAnnotationTest extends XWorkTestCase {
public void testAnnotatedMethodFailure() throws Exception {
HashMap<String, Object> extraContext = new HashMap<>();
extraContext.put(ActionContext.PARAMETERS, HttpParameters.createEmpty().build());
extraContext.put(ActionContext.PARAMETERS, HttpParameters.create().build());
ActionProxy proxy = actionProxyFactory.createActionProxy("", "annotatedMethod", null, extraContext);
proxy.execute();
@@ -173,7 +173,7 @@ public class ExecuteAndWaitInterceptorTest extends StrutsInternalTestCase {
params = new HashMap();
context = new HashMap();
context.put(ActionContext.SESSION, session);
context.put(ActionContext.PARAMETERS, HttpParameters.createEmpty().build());
context.put(ActionContext.PARAMETERS, HttpParameters.create().build());
request = new StrutsMockHttpServletRequest();
httpSession = new StrutsMockHttpSession();
@@ -201,7 +201,7 @@ public class FileUploadInterceptorTest extends StrutsInternalTestCase {
mai.setResultCode("success");
mai.setInvocationContext(ActionContext.getContext());
ActionContext.getContext().setParameters(HttpParameters.createEmpty().build());
ActionContext.getContext().setParameters(HttpParameters.create().build());
ActionContext.getContext().put(ServletActionContext.HTTP_REQUEST, createMultipartRequest(req, 2000));
interceptor.intercept(mai);
@@ -222,7 +222,7 @@ public class FileUploadInterceptorTest extends StrutsInternalTestCase {
mai.setResultCode("success");
mai.setInvocationContext(ActionContext.getContext());
ActionContext.getContext().setParameters(HttpParameters.createEmpty().build());
ActionContext.getContext().setParameters(HttpParameters.create().build());
ActionContext.getContext().put(ServletActionContext.HTTP_REQUEST, createMultipartRequest(req, 2000));
interceptor.intercept(mai);
@@ -201,7 +201,7 @@ public class I18nInterceptorTest extends TestCase {
session = new HashMap();
Map<String, Object> ctx = new HashMap<String, Object>();
ctx.put(ActionContext.PARAMETERS, HttpParameters.createEmpty().build());
ctx.put(ActionContext.PARAMETERS, HttpParameters.create().build());
ctx.put(ActionContext.SESSION, session);
ac = new ActionContext(ctx);
@@ -27,12 +27,10 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import com.opensymphony.xwork2.ActionProxy;
import com.opensymphony.xwork2.interceptor.PreResultListener;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.StrutsInternalTestCase;
import org.apache.struts2.dispatcher.HttpParameters;
import org.apache.struts2.result.ServletActionRedirectResult;
import org.easymock.EasyMock;
import com.opensymphony.xwork2.Action;
@@ -40,7 +38,6 @@ import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.ActionSupport;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
@@ -76,7 +73,7 @@ public class MessageStoreInterceptorTest extends StrutsInternalTestCase {
action.addFieldError("field2", "some field error 2");
ActionContext actionContext = new ActionContext(new HashMap());
actionContext.setParameters(HttpParameters.createEmpty().build());
actionContext.setParameters(HttpParameters.create().build());
HttpSession mockedSession = EasyMock.createControl().createMock(HttpSession.class);
HttpServletRequest mockedRequest = EasyMock.createControl().createMock(HttpServletRequest.class);
@@ -151,7 +148,7 @@ public class MessageStoreInterceptorTest extends StrutsInternalTestCase {
EasyMock.replay(mockedRequest);
ActionContext actionContext = new ActionContext(new HashMap());
actionContext.setParameters(HttpParameters.createEmpty().build());
actionContext.setParameters(HttpParameters.create().build());
actionContext.put(ActionContext.SESSION, sessionMap);
mockActionInvocation.getInvocationContext();
@@ -203,7 +200,7 @@ public class MessageStoreInterceptorTest extends StrutsInternalTestCase {
action.addFieldError("field2", "some field error 2");
ActionContext actionContext = new ActionContext(new HashMap());
actionContext.setParameters(HttpParameters.createEmpty().build());
actionContext.setParameters(HttpParameters.create().build());
actionContext.put(ActionContext.SESSION, sessionMap);
HttpSession mockedSession = EasyMock.createControl().createMock(HttpSession.class);
@@ -289,7 +286,7 @@ public class MessageStoreInterceptorTest extends StrutsInternalTestCase {
public void testRequestOperationMode3() throws Exception {
ActionContext actionContext = new ActionContext(new HashMap());
actionContext.setParameters(HttpParameters.createEmpty().build());
actionContext.setParameters(HttpParameters.create().build());
ActionInvocation mockActionInvocation = EasyMock.createControl().createMock(ActionInvocation.class);
mockActionInvocation.getInvocationContext();
@@ -111,7 +111,7 @@ public class MessageStorePreResultListenerTest extends StrutsInternalTestCase {
action.addFieldError("field2", "some field error 2");
ActionContext actionContext = new ActionContext(new HashMap());
actionContext.setParameters(HttpParameters.createEmpty().build());
actionContext.setParameters(HttpParameters.create().build());
actionContext.put(ActionContext.SESSION, sessionMap);
HttpSession mockedSession = EasyMock.createControl().createMock(HttpSession.class);
@@ -191,7 +191,7 @@ public class MessageStorePreResultListenerTest extends StrutsInternalTestCase {
action.addFieldError("field2", "some field error 2");
ActionContext actionContext = new ActionContext(new HashMap());
actionContext.setParameters(HttpParameters.createEmpty().build());
actionContext.setParameters(HttpParameters.create().build());
actionContext.setSession(sessionMap);
HttpSession mockedSession = EasyMock.createControl().createMock(HttpSession.class);
@@ -84,11 +84,27 @@ public class ServletConfigInterceptorTest extends StrutsInternalTestCase {
}
public void testParameterAware() throws Exception {
ParameterAware mock = (ParameterAware) createMock(ParameterAware.class);
ParameterAware mock = createMock(ParameterAware.class);
MockActionInvocation mai = createActionInvocation(mock);
HttpParameters param = HttpParameters.createEmpty().build();
HttpParameters param = HttpParameters.create().build();
mai.getInvocationContext().setParameters(param);
mock.setParameters(param.toMap());
expectLastCall().times(1);
replay(mock);
interceptor.intercept(mai);
verify(mock);
}
public void testHttpParametersAware() throws Exception {
HttpParametersAware mock = createMock(HttpParametersAware.class);
MockActionInvocation mai = createActionInvocation(mock);
HttpParameters param = HttpParameters.create().build();
mai.getInvocationContext().setParameters(param);
mock.setParameters(param);
@@ -113,7 +113,7 @@ public class TokenInterceptorTest extends StrutsInternalTestCase {
params = new TreeMap<>();
extraContext = new TreeMap<>();
extraContext.put(ActionContext.SESSION, session);
extraContext.put(ActionContext.PARAMETERS, HttpParameters.createEmpty().build());
extraContext.put(ActionContext.PARAMETERS, HttpParameters.create().build());
request = new StrutsMockHttpServletRequest();
httpSession = new StrutsMockHttpSession();
@@ -93,7 +93,7 @@ public class TokenHelperTest extends TestCase {
session = new HashMap();
Map ctxMap = new TreeMap();
ctxMap.put(ActionContext.SESSION, session);
ctxMap.put(ActionContext.PARAMETERS, HttpParameters.createEmpty().build());
ctxMap.put(ActionContext.PARAMETERS, HttpParameters.create().build());
ActionContext ctx = new ActionContext(ctxMap);
ActionContext.setContext(ctx);
}
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.3</version>
<version>2.5.5</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.3</version>
<version>2.5.5</version>
</parent>
<artifactId>struts2-cdi-plugin</artifactId>
+1 -1
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.3</version>
<version>2.5.5</version>
</parent>
<artifactId>struts2-config-browser-plugin</artifactId>
+1 -1
View File
@@ -3,7 +3,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.3</version>
<version>2.5.5</version>
</parent>
<artifactId>struts2-convention-plugin</artifactId>
+1 -1
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.3</version>
<version>2.5.5</version>
</parent>
<artifactId>struts2-dwr-plugin</artifactId>
+1 -1
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.3</version>
<version>2.5.5</version>
</parent>
<artifactId>struts2-embeddedjsp-plugin</artifactId>
@@ -22,12 +22,14 @@ package org.apache.struts2;
import com.opensymphony.xwork2.ActionContext;
import org.apache.struts2.dispatcher.HttpParameters;
import org.apache.struts2.dispatcher.Parameter;
import org.apache.struts2.views.util.UrlHelper;
import javax.servlet.Servlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.HttpJspPage;
import java.util.HashMap;
import java.util.Map;
/**
@@ -54,12 +56,14 @@ public abstract class JSPRuntime {
int i = location.indexOf("?");
if (i > 0) {
//extract params from the url and add them to the request
HttpParameters parameters = ActionContext.getContext().getParameters();
String query = location.substring(i + 1);
Map<String, Object> queryParams = urlHelper.parseQueryString(query, true);
if (queryParams != null && !queryParams.isEmpty()) {
parameters = parameters.clone(queryParams);
ActionContext.getContext().setParameters(parameters);
Map<String, Parameter> newParams = new HashMap<>();
for (Map.Entry<String, Object> entry : queryParams.entrySet()) {
newParams.put(entry.getKey(), new Parameter.Request(entry.getKey(), entry.getValue()));
}
ActionContext.getContext().getParameters().appendAll(newParams);
}
location = location.substring(0, i);
}
+1 -1
View File
@@ -3,7 +3,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.3</version>
<version>2.5.5</version>
</parent>
<artifactId>struts2-gxp-plugin</artifactId>
+1 -1
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.3</version>
<version>2.5.5</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.3</version>
<version>2.5.5</version>
</parent>
<artifactId>struts2-javatemplates-plugin</artifactId>
+1 -1
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.3</version>
<version>2.5.5</version>
</parent>
<artifactId>struts2-jfreechart-plugin</artifactId>
+1 -1
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.3</version>
<version>2.5.5</version>
</parent>
<artifactId>struts2-json-plugin</artifactId>
+1 -1
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.3</version>
<version>2.5.5</version>
</parent>
<artifactId>struts2-junit-plugin</artifactId>
+1 -1
View File
@@ -4,7 +4,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.3</version>
<version>2.5.5</version>
</parent>
<artifactId>struts2-osgi-plugin</artifactId>
+1 -1
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.3</version>
<version>2.5.5</version>
</parent>
<artifactId>struts2-oval-plugin</artifactId>
+1 -1
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.3</version>
<version>2.5.5</version>
</parent>
<artifactId>struts2-pell-multipart-plugin</artifactId>
+1 -1
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.3</version>
<version>2.5.5</version>
</parent>
<artifactId>struts2-plexus-plugin</artifactId>
+1 -1
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>2.5.3</version>
<version>2.5.5</version>
</parent>
<artifactId>struts2-plugins</artifactId>
+1 -1
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.3</version>
<version>2.5.5</version>
</parent>
<artifactId>struts2-portlet-tiles-plugin</artifactId>
+1 -1
View File
@@ -3,7 +3,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.3</version>
<version>2.5.5</version>
</parent>
<artifactId>struts2-portlet-plugin</artifactId>
@@ -23,7 +23,6 @@ package org.apache.struts2.portlet.result;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.ActionProxy;
import com.sun.net.httpserver.HttpsParameters;
import junit.textui.TestRunner;
import org.apache.struts2.StrutsStatics;
import org.apache.struts2.dispatcher.HttpParameters;
@@ -74,7 +73,7 @@ public class PortletResultTest extends MockObjectTestCase implements StrutsStati
Map<String, Object> context = new HashMap<String, Object>();
context.put(SESSION, sessionMap);
context.put(PARAMETERS, HttpParameters.createEmpty().build());
context.put(PARAMETERS, HttpParameters.create().build());
context.put(STRUTS_PORTLET_CONTEXT, mockCtx.proxy());
ActionContext.setContext(new ActionContext(context));
+1 -1
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.3</version>
<version>2.5.5</version>
</parent>
<artifactId>struts2-rest-plugin</artifactId>
+1 -1
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.3</version>
<version>2.5.5</version>
</parent>
<artifactId>struts2-sitegraph-plugin</artifactId>
+1 -1
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.3</version>
<version>2.5.5</version>
</parent>
<artifactId>struts2-sitemesh-plugin</artifactId>
+1 -1
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.3</version>
<version>2.5.5</version>
</parent>
<artifactId>struts2-spring-plugin</artifactId>
+1 -1
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.3</version>
<version>2.5.5</version>
</parent>
<artifactId>struts2-testng-plugin</artifactId>
+1 -1
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>2.5.3</version>
<version>2.5.5</version>
</parent>
<artifactId>struts2-tiles-plugin</artifactId>
+3 -3
View File
@@ -9,7 +9,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>struts2-parent</artifactId>
<version>2.5.3</version>
<version>2.5.5</version>
<packaging>pom</packaging>
<name>Struts 2</name>
<url>http://struts.apache.org/</url>
@@ -31,7 +31,7 @@
<connection>scm:git:git://git.apache.org/struts.git</connection>
<developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/struts.git</developerConnection>
<url>http://git.apache.org/struts.git</url>
<tag>STRUTS_2_5_3</tag>
<tag>STRUTS_2_5_5</tag>
</scm>
<issueManagement>
@@ -89,7 +89,7 @@
<asm5.version>5.1</asm5.version>
<tiles.version>3.0.7</tiles.version>
<tiles-request.version>1.0.6</tiles-request.version>
<log4j2.version>2.6.2</log4j2.version>
<log4j2.version>2.7</log4j2.version>
<!-- SCM Site Configuration -->
<site.mainDirectory>${project.build.directory}/site</site.mainDirectory>