This is an automated email from the ASF dual-hosted git repository. ebourg pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-configuration.git
commit 3a81545a42666d2c60ede0cb870af9dfc6767d21 Author: Emmanuel Bourg <ebo...@apache.org> AuthorDate: Mon Oct 28 15:39:38 2024 +0100 [CONFIGURATION-836] Added web configurations using the jakarta.servlet namespace --- pom.xml | 9 +++ src/changes/changes.xml | 3 +- .../web/JakartaServletConfiguration.java | 69 +++++++++++++++++++ .../web/JakartaServletContextConfiguration.java | 69 +++++++++++++++++++ .../web/JakartaServletFilterConfiguration.java | 59 ++++++++++++++++ .../web/JakartaServletRequestConfiguration.java | 78 ++++++++++++++++++++++ ...n.java => TestJakartaServletConfiguration.java} | 12 ++-- ...=> TestJakartaServletContextConfiguration.java} | 14 ++-- ... => TestJakartaServletFilterConfiguration.java} | 14 ++-- ...=> TestJakartaServletRequestConfiguration.java} | 10 +-- .../web/TestServletConfiguration.java | 2 +- .../web/TestServletContextConfiguration.java | 2 +- .../web/TestServletFilterConfiguration.java | 2 +- .../web/TestServletRequestConfiguration.java | 4 +- 14 files changed, 316 insertions(+), 31 deletions(-) diff --git a/pom.xml b/pom.xml index fa3d18e3..5969fc4a 100644 --- a/pom.xml +++ b/pom.xml @@ -223,6 +223,15 @@ <optional>true</optional> </dependency> + <dependency> + <!-- For org.apache.commons.configuration2.web --> + <groupId>jakarta.servlet</groupId> + <artifactId>jakarta.servlet-api</artifactId> + <version>5.0.0</version> + <scope>provided</scope> + <optional>true</optional> + </dependency> + <dependency> <groupId>org.yaml</groupId> <artifactId>snakeyaml</artifactId> diff --git a/src/changes/changes.xml b/src/changes/changes.xml index b6be9901..7e889d43 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -23,7 +23,7 @@ <author email="d...@commons.apache.org">Apache Commons Community</author> </properties> <body> - <release version="2.11.1" date="YYYY-MM-DD" description="This is a feature and maintenance release. Java 8 or later is required."> + <release version="2.12.0" date="YYYY-MM-DD" description="This is a feature and maintenance release. Java 8 or later is required."> <!-- FIX --> <action type="fix" dev="ggregory" due-to="Gary Gregory">PropertyConverter.to(Class, Object, DefaultConversionHandler) doesn't convert custom java.lang.Number subclasses.</action> <action type="fix" dev="ggregory" due-to="Gary Gregory">DefaultConversionHandler.convertValue(Object, Class, ConfigurationInterpolator) doesn't convert custom java.lang.Number subclasses.</action> @@ -32,6 +32,7 @@ <action type="fix" issue="CONFIGURATION-848" dev="ggregory" due-to="Laszlo Hujber, Gary Gregory">CompositeConfiguration does not account for delimiters as it did in 2.9.0.</action> <!-- ADD --> <action type="add" dev="ggregory" due-to="Gary Gregory">Add PrefixedKeysIterator.toString() to package-private PrefixedKeysIterator.</action> + <action type="add" issue="CONFIGURATION-836" dev="ebourg" due-to="Emmanuel Bourg">New web configurations using the jakarta.servlet namespace are now available</action> <!-- UPDATE --> <action type="update" dev="ebourg" due-to="Emmanuel Bourg">The dependency on commons-codec has been removed</action> <action type="update" dev="ggregory" due-to="Gary Gregory, Dependabot">Bump org.apache.commons:commons-parent from 70 to 78 #434, #453, #466, #470, #479, #486, #491, #499.</action> diff --git a/src/main/java/org/apache/commons/configuration2/web/JakartaServletConfiguration.java b/src/main/java/org/apache/commons/configuration2/web/JakartaServletConfiguration.java new file mode 100644 index 00000000..a9eb5585 --- /dev/null +++ b/src/main/java/org/apache/commons/configuration2/web/JakartaServletConfiguration.java @@ -0,0 +1,69 @@ +/* + * 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.commons.configuration2.web; + +import java.util.Collections; +import java.util.Enumeration; +import java.util.Iterator; +import java.util.Objects; + +import jakarta.servlet.Servlet; +import jakarta.servlet.ServletConfig; + +/** + * A configuration wrapper around a {@link ServletConfig}. This configuration is read only, adding or removing a + * property will throw an UnsupportedOperationException. + * + * @since 2.12 + */ +public class JakartaServletConfiguration extends BaseWebConfiguration { + + /** Stores a reference to the wrapped {@code ServletConfig}. */ + protected ServletConfig config; + + /** + * Creates a ServletConfiguration using the initialization parameter of the specified servlet. + * + * @param servlet the servlet + */ + public JakartaServletConfiguration(final Servlet servlet) { + this(Objects.requireNonNull(servlet, "servlet").getServletConfig()); + } + + /** + * Creates a ServletConfiguration using the servlet initialization parameters. + * + * @param config the servlet configuration + */ + public JakartaServletConfiguration(final ServletConfig config) { + this.config = Objects.requireNonNull(config, "config"); + } + + @Override + protected Iterator<String> getKeysInternal() { + // According to the documentation of getInitParameterNames() the + // enumeration is of type String. + final Enumeration<String> en = config.getInitParameterNames(); + return Collections.list(en).iterator(); + } + + @Override + protected Object getPropertyInternal(final String key) { + return handleDelimiters(config.getInitParameter(key)); + } +} diff --git a/src/main/java/org/apache/commons/configuration2/web/JakartaServletContextConfiguration.java b/src/main/java/org/apache/commons/configuration2/web/JakartaServletContextConfiguration.java new file mode 100644 index 00000000..f91302fa --- /dev/null +++ b/src/main/java/org/apache/commons/configuration2/web/JakartaServletContextConfiguration.java @@ -0,0 +1,69 @@ +/* + * 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.commons.configuration2.web; + +import java.util.Collections; +import java.util.Enumeration; +import java.util.Iterator; +import java.util.Objects; + +import jakarta.servlet.Servlet; +import jakarta.servlet.ServletContext; + +/** + * A configuration wrapper to read the initialization parameters of a servlet context. This configuration is read only, + * adding or removing a property will throw an UnsupportedOperationException. + * + * @since 2.12 + */ +public class JakartaServletContextConfiguration extends BaseWebConfiguration { + + /** Stores the wrapped servlet context. */ + protected ServletContext context; + + /** + * Create a ServletContextConfiguration using the context of the specified servlet. + * + * @param servlet the servlet + */ + public JakartaServletContextConfiguration(final Servlet servlet) { + this.context = Objects.requireNonNull(servlet, "servlet").getServletConfig().getServletContext(); + } + + /** + * Create a ServletContextConfiguration using the servlet context initialization parameters. + * + * @param context the servlet context + */ + public JakartaServletContextConfiguration(final ServletContext context) { + this.context = Objects.requireNonNull(context, "context"); + } + + @Override + protected Iterator<String> getKeysInternal() { + // According to the documentation of getInitParameterNames() the + // enumeration is of type String. + final Enumeration<String> en = context.getInitParameterNames(); + return Collections.list(en).iterator(); + } + + @Override + protected Object getPropertyInternal(final String key) { + return handleDelimiters(context.getInitParameter(key)); + } +} diff --git a/src/main/java/org/apache/commons/configuration2/web/JakartaServletFilterConfiguration.java b/src/main/java/org/apache/commons/configuration2/web/JakartaServletFilterConfiguration.java new file mode 100644 index 00000000..3e07b302 --- /dev/null +++ b/src/main/java/org/apache/commons/configuration2/web/JakartaServletFilterConfiguration.java @@ -0,0 +1,59 @@ +/* + * 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.commons.configuration2.web; + +import java.util.Collections; +import java.util.Enumeration; +import java.util.Iterator; +import java.util.Objects; + +import jakarta.servlet.FilterConfig; + +/** + * A configuration wrapper around a {@link FilterConfig}. This configuration is read only, adding or removing a property + * will throw an UnsupportedOperationException. + * + * @since 2.12 + */ +public class JakartaServletFilterConfiguration extends BaseWebConfiguration { + + /** Stores the wrapped filter config. */ + protected FilterConfig config; + + /** + * Create a ServletFilterConfiguration using the filter initialization parameters. + * + * @param config the filter configuration + */ + public JakartaServletFilterConfiguration(final FilterConfig config) { + this.config = Objects.requireNonNull(config, "config"); + } + + @Override + protected Iterator<String> getKeysInternal() { + // According to the documentation of getInitParameterNames() the + // enumeration is of type String. + final Enumeration<String> en = config.getInitParameterNames(); + return Collections.list(en).iterator(); + } + + @Override + protected Object getPropertyInternal(final String key) { + return handleDelimiters(config.getInitParameter(key)); + } +} diff --git a/src/main/java/org/apache/commons/configuration2/web/JakartaServletRequestConfiguration.java b/src/main/java/org/apache/commons/configuration2/web/JakartaServletRequestConfiguration.java new file mode 100644 index 00000000..07a916e6 --- /dev/null +++ b/src/main/java/org/apache/commons/configuration2/web/JakartaServletRequestConfiguration.java @@ -0,0 +1,78 @@ +/* + * 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.commons.configuration2.web; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +import jakarta.servlet.ServletRequest; + +/** + * A configuration wrapper to read the parameters of a servlet request. This configuration is read only, adding or + * removing a property will throw an UnsupportedOperationException. + * + * @since 2.12 + */ +public class JakartaServletRequestConfiguration extends BaseWebConfiguration { + + /** Stores the wrapped request. */ + protected ServletRequest request; + + /** + * Create a ServletRequestConfiguration using the request parameters. + * + * @param request the servlet request + */ + public JakartaServletRequestConfiguration(final ServletRequest request) { + this.request = Objects.requireNonNull(request, "config"); + } + + @Override + protected Iterator<String> getKeysInternal() { + // According to the documentation of getParameterMap(), keys are Strings. + final Map<String, ?> parameterMap = request.getParameterMap(); + return parameterMap.keySet().iterator(); + } + + @Override + protected Object getPropertyInternal(final String key) { + final String[] values = request.getParameterValues(key); + + if (values == null || values.length == 0) { + return null; + } + if (values.length == 1) { + return handleDelimiters(values[0]); + } + // ensure that escape characters in all list elements are removed + final List<Object> result = new ArrayList<>(values.length); + for (final String value : values) { + final Object val = handleDelimiters(value); + if (val instanceof Collection) { + result.addAll((Collection<?>) val); + } else { + result.add(val); + } + } + return result; + } +} diff --git a/src/test/java/org/apache/commons/configuration2/web/TestServletConfiguration.java b/src/test/java/org/apache/commons/configuration2/web/TestJakartaServletConfiguration.java similarity index 90% copy from src/test/java/org/apache/commons/configuration2/web/TestServletConfiguration.java copy to src/test/java/org/apache/commons/configuration2/web/TestJakartaServletConfiguration.java index 05e3bc27..bcd8a73a 100644 --- a/src/test/java/org/apache/commons/configuration2/web/TestServletConfiguration.java +++ b/src/test/java/org/apache/commons/configuration2/web/TestJakartaServletConfiguration.java @@ -24,9 +24,9 @@ import static org.mockito.Mockito.when; import java.util.Properties; -import javax.servlet.Servlet; -import javax.servlet.ServletConfig; -import javax.servlet.http.HttpServlet; +import jakarta.servlet.Servlet; +import jakarta.servlet.ServletConfig; +import jakarta.servlet.http.HttpServlet; import org.apache.commons.configuration2.AbstractConfiguration; import org.apache.commons.configuration2.TestAbstractConfiguration; @@ -37,7 +37,7 @@ import org.mockito.ArgumentMatchers; /** * Test case for the {@link ServletConfiguration} class. */ -public class TestServletConfiguration extends TestAbstractConfiguration { +public class TestJakartaServletConfiguration extends TestAbstractConfiguration { @Override protected AbstractConfiguration getConfiguration() { @@ -61,14 +61,14 @@ public class TestServletConfiguration extends TestAbstractConfiguration { } }; - final ServletConfiguration servletConfiguration = new ServletConfiguration(servlet); + final AbstractConfiguration servletConfiguration = new JakartaServletConfiguration(servlet); servletConfiguration.setListDelimiterHandler(new DefaultListDelimiterHandler(',')); return servletConfiguration; } @Override protected AbstractConfiguration getEmptyConfiguration() { - return new ServletConfiguration(mockServletConfig(new Properties())); + return new JakartaServletConfiguration(mockServletConfig(new Properties())); } /** diff --git a/src/test/java/org/apache/commons/configuration2/web/TestServletContextConfiguration.java b/src/test/java/org/apache/commons/configuration2/web/TestJakartaServletContextConfiguration.java similarity index 90% copy from src/test/java/org/apache/commons/configuration2/web/TestServletContextConfiguration.java copy to src/test/java/org/apache/commons/configuration2/web/TestJakartaServletContextConfiguration.java index 7769c0eb..92044c0f 100644 --- a/src/test/java/org/apache/commons/configuration2/web/TestServletContextConfiguration.java +++ b/src/test/java/org/apache/commons/configuration2/web/TestJakartaServletContextConfiguration.java @@ -24,10 +24,10 @@ import static org.mockito.Mockito.when; import java.util.Properties; -import javax.servlet.Servlet; -import javax.servlet.ServletConfig; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServlet; +import jakarta.servlet.Servlet; +import jakarta.servlet.ServletConfig; +import jakarta.servlet.ServletContext; +import jakarta.servlet.http.HttpServlet; import org.apache.commons.configuration2.AbstractConfiguration; import org.apache.commons.configuration2.TestAbstractConfiguration; @@ -38,7 +38,7 @@ import org.mockito.ArgumentMatchers; /** * Test case for the {@link ServletContextConfiguration} class. */ -public class TestServletContextConfiguration extends TestAbstractConfiguration { +public class TestJakartaServletContextConfiguration extends TestAbstractConfiguration { @Override protected AbstractConfiguration getConfiguration() { @@ -68,7 +68,7 @@ public class TestServletContextConfiguration extends TestAbstractConfiguration { } }; - final ServletContextConfiguration resultConfig = new ServletContextConfiguration(servlet); + final AbstractConfiguration resultConfig = new JakartaServletContextConfiguration(servlet); resultConfig.setListDelimiterHandler(new DefaultListDelimiterHandler(',')); return resultConfig; } @@ -78,7 +78,7 @@ public class TestServletContextConfiguration extends TestAbstractConfiguration { // create a servlet context final ServletContext context = mockServletConfig(new Properties()); - return new ServletContextConfiguration(context); + return new JakartaServletContextConfiguration(context); } /** diff --git a/src/test/java/org/apache/commons/configuration2/web/TestServletFilterConfiguration.java b/src/test/java/org/apache/commons/configuration2/web/TestJakartaServletFilterConfiguration.java similarity index 87% copy from src/test/java/org/apache/commons/configuration2/web/TestServletFilterConfiguration.java copy to src/test/java/org/apache/commons/configuration2/web/TestJakartaServletFilterConfiguration.java index c3de90fa..0a062e3e 100644 --- a/src/test/java/org/apache/commons/configuration2/web/TestServletFilterConfiguration.java +++ b/src/test/java/org/apache/commons/configuration2/web/TestJakartaServletFilterConfiguration.java @@ -23,8 +23,8 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import java.util.Enumeration; import java.util.Properties; -import javax.servlet.FilterConfig; -import javax.servlet.ServletContext; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletContext; import org.apache.commons.configuration2.AbstractConfiguration; import org.apache.commons.configuration2.TestAbstractConfiguration; @@ -34,7 +34,7 @@ import org.junit.jupiter.api.Test; /** * Test case for the {@link ServletFilterConfiguration} class. */ -public class TestServletFilterConfiguration extends TestAbstractConfiguration { +public class TestJakartaServletFilterConfiguration extends TestAbstractConfiguration { private static final class MockFilterConfig implements FilterConfig { private final Properties parameters = new Properties(); @@ -49,8 +49,8 @@ public class TestServletFilterConfiguration extends TestAbstractConfiguration { } @Override - public Enumeration<?> getInitParameterNames() { - return parameters.keys(); + public Enumeration<String> getInitParameterNames() { + return (Enumeration) parameters.keys(); } @Override @@ -71,14 +71,14 @@ public class TestServletFilterConfiguration extends TestAbstractConfiguration { config.setInitParameter("list", "value1, value2"); config.setInitParameter("listesc", "value1\\,value2"); - final ServletFilterConfiguration resultConfig = new ServletFilterConfiguration(config); + final AbstractConfiguration resultConfig = new JakartaServletFilterConfiguration(config); resultConfig.setListDelimiterHandler(new DefaultListDelimiterHandler(',')); return resultConfig; } @Override protected AbstractConfiguration getEmptyConfiguration() { - return new ServletFilterConfiguration(new MockFilterConfig()); + return new JakartaServletFilterConfiguration(new MockFilterConfig()); } @Override diff --git a/src/test/java/org/apache/commons/configuration2/web/TestServletRequestConfiguration.java b/src/test/java/org/apache/commons/configuration2/web/TestJakartaServletRequestConfiguration.java similarity index 92% copy from src/test/java/org/apache/commons/configuration2/web/TestServletRequestConfiguration.java copy to src/test/java/org/apache/commons/configuration2/web/TestJakartaServletRequestConfiguration.java index cd862c12..4d7cb534 100644 --- a/src/test/java/org/apache/commons/configuration2/web/TestServletRequestConfiguration.java +++ b/src/test/java/org/apache/commons/configuration2/web/TestJakartaServletRequestConfiguration.java @@ -27,7 +27,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import org.apache.commons.configuration2.AbstractConfiguration; import org.apache.commons.configuration2.BaseConfiguration; @@ -41,14 +41,14 @@ import org.mockito.ArgumentMatchers; /** * Test case for the {@link ServletRequestConfiguration} class. */ -public class TestServletRequestConfiguration extends TestAbstractConfiguration { +public class TestJakartaServletRequestConfiguration extends TestAbstractConfiguration { /** * Returns a new servlet request configuration that is backed by the passed in configuration. * * @param base the configuration with the underlying values * @return the servlet request configuration */ - private ServletRequestConfiguration createConfiguration(final Configuration base) { + private AbstractConfiguration createConfiguration(final Configuration base) { final HttpServletRequest request = mock(HttpServletRequest.class); when(request.getParameterMap()).thenAnswer(invocation -> new ConfigurationMap(base)); when(request.getParameterValues(ArgumentMatchers.any())).thenAnswer(invocation -> { @@ -56,7 +56,7 @@ public class TestServletRequestConfiguration extends TestAbstractConfiguration { return base.getStringArray(key); }); - final ServletRequestConfiguration config = new ServletRequestConfiguration(request); + final AbstractConfiguration config = new JakartaServletRequestConfiguration(request); config.setListDelimiterHandler(new DefaultListDelimiterHandler(',')); return config; } @@ -79,7 +79,7 @@ public class TestServletRequestConfiguration extends TestAbstractConfiguration { when(request.getParameter(ArgumentMatchers.any())).thenReturn(null); when(request.getParameterMap()).thenAnswer(invocation -> new HashMap<>()); - return new ServletRequestConfiguration(request); + return new JakartaServletRequestConfiguration(request); } @Override diff --git a/src/test/java/org/apache/commons/configuration2/web/TestServletConfiguration.java b/src/test/java/org/apache/commons/configuration2/web/TestServletConfiguration.java index 05e3bc27..7426f710 100644 --- a/src/test/java/org/apache/commons/configuration2/web/TestServletConfiguration.java +++ b/src/test/java/org/apache/commons/configuration2/web/TestServletConfiguration.java @@ -61,7 +61,7 @@ public class TestServletConfiguration extends TestAbstractConfiguration { } }; - final ServletConfiguration servletConfiguration = new ServletConfiguration(servlet); + final AbstractConfiguration servletConfiguration = new ServletConfiguration(servlet); servletConfiguration.setListDelimiterHandler(new DefaultListDelimiterHandler(',')); return servletConfiguration; } diff --git a/src/test/java/org/apache/commons/configuration2/web/TestServletContextConfiguration.java b/src/test/java/org/apache/commons/configuration2/web/TestServletContextConfiguration.java index 7769c0eb..272a56c5 100644 --- a/src/test/java/org/apache/commons/configuration2/web/TestServletContextConfiguration.java +++ b/src/test/java/org/apache/commons/configuration2/web/TestServletContextConfiguration.java @@ -68,7 +68,7 @@ public class TestServletContextConfiguration extends TestAbstractConfiguration { } }; - final ServletContextConfiguration resultConfig = new ServletContextConfiguration(servlet); + final AbstractConfiguration resultConfig = new ServletContextConfiguration(servlet); resultConfig.setListDelimiterHandler(new DefaultListDelimiterHandler(',')); return resultConfig; } diff --git a/src/test/java/org/apache/commons/configuration2/web/TestServletFilterConfiguration.java b/src/test/java/org/apache/commons/configuration2/web/TestServletFilterConfiguration.java index c3de90fa..eaa1a3e4 100644 --- a/src/test/java/org/apache/commons/configuration2/web/TestServletFilterConfiguration.java +++ b/src/test/java/org/apache/commons/configuration2/web/TestServletFilterConfiguration.java @@ -71,7 +71,7 @@ public class TestServletFilterConfiguration extends TestAbstractConfiguration { config.setInitParameter("list", "value1, value2"); config.setInitParameter("listesc", "value1\\,value2"); - final ServletFilterConfiguration resultConfig = new ServletFilterConfiguration(config); + final AbstractConfiguration resultConfig = new ServletFilterConfiguration(config); resultConfig.setListDelimiterHandler(new DefaultListDelimiterHandler(',')); return resultConfig; } diff --git a/src/test/java/org/apache/commons/configuration2/web/TestServletRequestConfiguration.java b/src/test/java/org/apache/commons/configuration2/web/TestServletRequestConfiguration.java index cd862c12..7e30c97b 100644 --- a/src/test/java/org/apache/commons/configuration2/web/TestServletRequestConfiguration.java +++ b/src/test/java/org/apache/commons/configuration2/web/TestServletRequestConfiguration.java @@ -48,7 +48,7 @@ public class TestServletRequestConfiguration extends TestAbstractConfiguration { * @param base the configuration with the underlying values * @return the servlet request configuration */ - private ServletRequestConfiguration createConfiguration(final Configuration base) { + private AbstractConfiguration createConfiguration(final Configuration base) { final HttpServletRequest request = mock(HttpServletRequest.class); when(request.getParameterMap()).thenAnswer(invocation -> new ConfigurationMap(base)); when(request.getParameterValues(ArgumentMatchers.any())).thenAnswer(invocation -> { @@ -56,7 +56,7 @@ public class TestServletRequestConfiguration extends TestAbstractConfiguration { return base.getStringArray(key); }); - final ServletRequestConfiguration config = new ServletRequestConfiguration(request); + final AbstractConfiguration config = new ServletRequestConfiguration(request); config.setListDelimiterHandler(new DefaultListDelimiterHandler(',')); return config; }