(tomcat-tck) branch main updated: Add servlet-module
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat-tck.git The following commit(s) were added to refs/heads/main by this push: new 5289f25 Add servlet-module 5289f25 is described below commit 5289f2517776814dc529f18c3df2b76f7fdc45d9 Author: Mark Thomas AuthorDate: Thu Mar 14 15:37:41 2024 + Add servlet-module --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index bb908bc..9c89f62 100644 --- a/pom.xml +++ b/pom.xml @@ -66,6 +66,7 @@ el-tck jsp-tck +servlet-tck websocket-tck - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat-tck) branch main updated: Fix comment
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat-tck.git The following commit(s) were added to refs/heads/main by this push: new 91f7db5 Fix comment 91f7db5 is described below commit 91f7db534539b02d3ad8acdfe12cf6151c9456e4 Author: Mark Thomas AuthorDate: Mon Mar 18 12:10:02 2024 + Fix comment --- servlet-tck/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/servlet-tck/pom.xml b/servlet-tck/pom.xml index a1afe59..8b24483 100644 --- a/servlet-tck/pom.xml +++ b/servlet-tck/pom.xml @@ -33,7 +33,7 @@ jakarta.servlet tck-runtime ${tck.servlet.version} - + jakarta.servlet - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat-tck) branch main updated: Enable running Servlet TCK tests in parallel
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat-tck.git The following commit(s) were added to refs/heads/main by this push: new e065a89 Enable running Servlet TCK tests in parallel e065a89 is described below commit e065a8919e1ea187485a1e6d2105bc40a54f421a Author: Mark Thomas AuthorDate: Mon Mar 18 12:14:55 2024 + Enable running Servlet TCK tests in parallel This is achieved as follows: - configure Tomcat to listen on port 0 in arquillian.xml - on deployment, extract the actual port being used from Tomcat - then inject the correct port into the arquillian configuration This ensures that arquillian generates the correct URLs for the clients to use during the tests. --- servlet-tck/pom.xml| 4 +- .../tck/servlet/TomcatServletTckConfiguration.java | 57 ++ ...org.jboss.arquillian.core.spi.LoadableExtension | 1 + servlet-tck/src/test/resources/arquillian.xml | 7 +++ 4 files changed, 66 insertions(+), 3 deletions(-) diff --git a/servlet-tck/pom.xml b/servlet-tck/pom.xml index 8b24483..0157c03 100644 --- a/servlet-tck/pom.xml +++ b/servlet-tck/pom.xml @@ -104,11 +104,9 @@ **/*Test.java **/*Tests.java +5 false -localhost -8080 - 8443 5 true diff --git a/servlet-tck/src/test/java/org/apache/tomcat/tck/servlet/TomcatServletTckConfiguration.java b/servlet-tck/src/test/java/org/apache/tomcat/tck/servlet/TomcatServletTckConfiguration.java new file mode 100644 index 000..4cbe69a --- /dev/null +++ b/servlet-tck/src/test/java/org/apache/tomcat/tck/servlet/TomcatServletTckConfiguration.java @@ -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.tomcat.tck.servlet; + +import java.lang.reflect.Field; + +import org.apache.catalina.startup.Tomcat; +import org.jboss.arquillian.container.spi.event.container.BeforeDeploy; +import org.jboss.arquillian.core.api.annotation.Observes; +import org.jboss.arquillian.core.spi.LoadableExtension; +import org.jboss.arquillian.container.tomcat.embedded.Tomcat10EmbeddedContainer; + +public class TomcatServletTckConfiguration implements LoadableExtension { + +@Override +public void register(ExtensionBuilder builder) { +builder.observer(ServletObserver.class); +} + +public static class ServletObserver { + +public void configurePorts(@Observes final BeforeDeploy beforeDeploy) { +Tomcat10EmbeddedContainer container = (Tomcat10EmbeddedContainer) beforeDeploy.getDeployableContainer(); +try { +Field tomcatField = Tomcat10EmbeddedContainer.class.getDeclaredField("tomcat"); +tomcatField.setAccessible(true); +Tomcat tomcat = (Tomcat) tomcatField.get(container); +int localPort = tomcat.getConnector().getLocalPort(); + +Field configurationField = Tomcat10EmbeddedContainer.class.getDeclaredField("configuration"); +configurationField.setAccessible(true); +Object configuration = configurationField.get(container); + +Field portField = container.getConfigurationClass().getDeclaredField("bindHttpPort"); +portField.setAccessible(true); +portField.set(configuration, Integer.valueOf(localPort)); + +} catch (ReflectiveOperationException e) { +throw new RuntimeException(e); +} +} +} +} diff --git a/servlet-tck/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension b/servlet-tck/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension new f
Re: [PR] Unify comma-separated-value code and optimize the implementation [tomcat]
ChristopherSchultz commented on PR #707: URL: https://github.com/apache/tomcat/pull/707#issuecomment-2003805644 > Ok, so add back the protected static methods in 10.1, just in case. Sounds good. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) branch 10.1.x updated: Unify comma-separated-value code and optimize the implementation (#707)
This is an automated email from the ASF dual-hosted git repository. schultz pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/10.1.x by this push: new 2841f2d880 Unify comma-separated-value code and optimize the implementation (#707) 2841f2d880 is described below commit 2841f2d880e9477bc3b681e93bd6e29755502df6 Author: Christopher Schultz AuthorDate: Sun Mar 17 10:33:00 2024 -0400 Unify comma-separated-value code and optimize the implementation (#707) Add new StringUtils.splitCommaSeparated utility method which uses a simple search pattern for comma-separated values instead of a regular expression. --- java/org/apache/catalina/connector/Connector.java | 3 ++- .../org/apache/catalina/filters/ExpiresFilter.java | 15 ++ .../apache/catalina/filters/RemoteCIDRFilter.java | 3 ++- .../apache/catalina/filters/RemoteIpFilter.java| 15 ++ java/org/apache/catalina/realm/JNDIRealm.java | 6 -- java/org/apache/catalina/util/NetMaskSet.java | 4 +++- .../apache/catalina/valves/RemoteCIDRValve.java| 3 ++- java/org/apache/catalina/valves/RemoteIpValve.java | 18 +++- java/org/apache/tomcat/util/buf/StringUtils.java | 24 ++ .../catalina/filters/TestRemoteIpFilter.java | 4 ++-- .../apache/catalina/valves/TestRemoteIpValve.java | 5 +++-- 11 files changed, 61 insertions(+), 39 deletions(-) diff --git a/java/org/apache/catalina/connector/Connector.java b/java/org/apache/catalina/connector/Connector.java index a0c3b1bc56..fae325a740 100644 --- a/java/org/apache/catalina/connector/Connector.java +++ b/java/org/apache/catalina/connector/Connector.java @@ -42,6 +42,7 @@ import org.apache.tomcat.util.IntrospectionUtils; import org.apache.tomcat.util.buf.B2CConverter; import org.apache.tomcat.util.buf.CharsetUtil; import org.apache.tomcat.util.buf.EncodedSolidusHandling; +import org.apache.tomcat.util.buf.StringUtils; import org.apache.tomcat.util.net.SSLHostConfig; import org.apache.tomcat.util.net.openssl.OpenSSLImplementation; import org.apache.tomcat.util.res.StringManager; @@ -528,7 +529,7 @@ public class Connector extends LifecycleMBeanBase { HashSet methodSet = new HashSet<>(); if (null != methods) { -methodSet.addAll(Arrays.asList(methods.split("\\s*,\\s*"))); + methodSet.addAll(Arrays.asList(StringUtils.splitCommaSeparated(methods))); } if (methodSet.contains("TRACE")) { diff --git a/java/org/apache/catalina/filters/ExpiresFilter.java b/java/org/apache/catalina/filters/ExpiresFilter.java index fe80faa521..b2215cdb2e 100644 --- a/java/org/apache/catalina/filters/ExpiresFilter.java +++ b/java/org/apache/catalina/filters/ExpiresFilter.java @@ -28,7 +28,6 @@ import java.util.Locale; import java.util.Map; import java.util.NoSuchElementException; import java.util.StringTokenizer; -import java.util.regex.Pattern; import jakarta.servlet.FilterChain; import jakarta.servlet.FilterConfig; @@ -44,6 +43,7 @@ import jakarta.servlet.http.MappingMatch; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; +import org.apache.tomcat.util.buf.StringUtils; /** * @@ -1010,11 +1010,6 @@ public class ExpiresFilter extends FilterBase { } -/** - * {@link Pattern} for a comma delimited string that support whitespace characters - */ -private static final Pattern commaSeparatedValuesPattern = Pattern.compile("\\s*,\\s*"); - private static final String HEADER_CACHE_CONTROL = "Cache-Control"; private static final String HEADER_EXPIRES = "Expires"; @@ -1039,7 +1034,7 @@ public class ExpiresFilter extends FilterBase { * @return never {@code null} array */ protected static int[] commaDelimitedListToIntArray(String commaDelimitedInts) { -String[] intsAsStrings = commaDelimitedListToStringArray(commaDelimitedInts); +String[] intsAsStrings = StringUtils.splitCommaSeparated(commaDelimitedInts); int[] ints = new int[intsAsStrings.length]; for (int i = 0; i < intsAsStrings.length; i++) { String intAsString = intsAsStrings[i]; @@ -1059,10 +1054,12 @@ public class ExpiresFilter extends FilterBase { * @param commaDelimitedStrings the string to be split * * @return array of patterns (non {@code null}) + * + * @deprecated Unused. Will be removed in Tomcat 11. */ +@Deprecated protected static String[] commaDelimitedListToStringArray(String commaDelimitedStrings) { -return (commaDelimitedStrings == null || commaDelimitedStrings.length() == 0) ? new String[0] : -commaSeparatedValuesPattern.split(commaDelimitedStrings); +return StringUtils.splitCommaSeparated(commaDelimitedStrings); } /** diff --git a/java/org/apache/catalina/filters/RemoteCIDRFilter.
(tomcat) branch 9.0.x updated: Unify comma-separated-value code and optimize the implementation (#707)
This is an automated email from the ASF dual-hosted git repository. schultz pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/9.0.x by this push: new 848c44060b Unify comma-separated-value code and optimize the implementation (#707) 848c44060b is described below commit 848c44060b38c6b44035874dc3f7952da130446a Author: Christopher Schultz AuthorDate: Sun Mar 17 10:33:00 2024 -0400 Unify comma-separated-value code and optimize the implementation (#707) Add new StringUtils.splitCommaSeparated utility method which uses a simple search pattern for comma-separated values instead of a regular expression. --- java/org/apache/catalina/connector/Connector.java | 3 ++- .../org/apache/catalina/filters/ExpiresFilter.java | 15 ++ .../apache/catalina/filters/RemoteCIDRFilter.java | 3 ++- .../apache/catalina/filters/RemoteIpFilter.java| 15 ++ java/org/apache/catalina/realm/JNDIRealm.java | 6 -- java/org/apache/catalina/util/NetMaskSet.java | 4 +++- .../apache/catalina/valves/RemoteCIDRValve.java| 3 ++- java/org/apache/catalina/valves/RemoteIpValve.java | 18 +++- java/org/apache/tomcat/util/buf/StringUtils.java | 24 ++ .../catalina/filters/TestRemoteIpFilter.java | 4 ++-- .../apache/catalina/valves/TestRemoteIpValve.java | 5 +++-- 11 files changed, 61 insertions(+), 39 deletions(-) diff --git a/java/org/apache/catalina/connector/Connector.java b/java/org/apache/catalina/connector/Connector.java index 4266f75fda..c5476b26cd 100644 --- a/java/org/apache/catalina/connector/Connector.java +++ b/java/org/apache/catalina/connector/Connector.java @@ -44,6 +44,7 @@ import org.apache.tomcat.util.buf.B2CConverter; import org.apache.tomcat.util.buf.CharsetUtil; import org.apache.tomcat.util.buf.EncodedSolidusHandling; import org.apache.tomcat.util.buf.UDecoder; +import org.apache.tomcat.util.buf.StringUtils; import org.apache.tomcat.util.net.SSLHostConfig; import org.apache.tomcat.util.net.openssl.OpenSSLImplementation; import org.apache.tomcat.util.res.StringManager; @@ -510,7 +511,7 @@ public class Connector extends LifecycleMBeanBase { HashSet methodSet = new HashSet<>(); if (null != methods) { -methodSet.addAll(Arrays.asList(methods.split("\\s*,\\s*"))); + methodSet.addAll(Arrays.asList(StringUtils.splitCommaSeparated(methods))); } if (methodSet.contains("TRACE")) { diff --git a/java/org/apache/catalina/filters/ExpiresFilter.java b/java/org/apache/catalina/filters/ExpiresFilter.java index 75219aba1d..c9710445b7 100644 --- a/java/org/apache/catalina/filters/ExpiresFilter.java +++ b/java/org/apache/catalina/filters/ExpiresFilter.java @@ -28,7 +28,6 @@ import java.util.Locale; import java.util.Map; import java.util.NoSuchElementException; import java.util.StringTokenizer; -import java.util.regex.Pattern; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; @@ -44,6 +43,7 @@ import javax.servlet.http.MappingMatch; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; +import org.apache.tomcat.util.buf.StringUtils; /** * @@ -1010,11 +1010,6 @@ public class ExpiresFilter extends FilterBase { } -/** - * {@link Pattern} for a comma delimited string that support whitespace characters - */ -private static final Pattern commaSeparatedValuesPattern = Pattern.compile("\\s*,\\s*"); - private static final String HEADER_CACHE_CONTROL = "Cache-Control"; private static final String HEADER_EXPIRES = "Expires"; @@ -1039,7 +1034,7 @@ public class ExpiresFilter extends FilterBase { * @return never {@code null} array */ protected static int[] commaDelimitedListToIntArray(String commaDelimitedInts) { -String[] intsAsStrings = commaDelimitedListToStringArray(commaDelimitedInts); +String[] intsAsStrings = StringUtils.splitCommaSeparated(commaDelimitedInts); int[] ints = new int[intsAsStrings.length]; for (int i = 0; i < intsAsStrings.length; i++) { String intAsString = intsAsStrings[i]; @@ -1059,10 +1054,12 @@ public class ExpiresFilter extends FilterBase { * @param commaDelimitedStrings the string to be split * * @return array of patterns (non {@code null}) + * + * @deprecated Unused. Will be removed in Tomcat 11. */ +@Deprecated protected static String[] commaDelimitedListToStringArray(String commaDelimitedStrings) { -return (commaDelimitedStrings == null || commaDelimitedStrings.length() == 0) ? new String[0] : -commaSeparatedValuesPattern.split(commaDelimitedStrings); +return StringUtils.splitCommaSeparated(commaDelimitedStrings); } /** diff --git a/java/org/apache/catalina/filters/RemoteCIDRFilter.java b/java/o
(tomcat) branch main updated: Cleanup
This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new 0fa4407ded Cleanup 0fa4407ded is described below commit 0fa4407ded5bdde2a1658814c89fb33d43933ca1 Author: remm AuthorDate: Mon Mar 18 16:16:33 2024 +0100 Cleanup --- java/org/apache/tomcat/util/net/AbstractEndpoint.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/org/apache/tomcat/util/net/AbstractEndpoint.java b/java/org/apache/tomcat/util/net/AbstractEndpoint.java index 31969af460..12d70bf007 100644 --- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java +++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java @@ -523,7 +523,6 @@ public abstract class AbstractEndpoint { // Only try to negotiate if both client and server have at least // one protocol in common // Note: Tomcat does not explicitly negotiate http/1.1 -// TODO: Is this correct? Should it change? List commonProtocols = new ArrayList<>(negotiableProtocols); commonProtocols.retainAll(clientRequestedApplicationProtocols); if (commonProtocols.size() > 0) { @@ -1235,6 +1234,7 @@ public abstract class AbstractEndpoint { this.executor = null; if (executor instanceof ThreadPoolExecutor) { //this is our internal one, so we need to shut it down +@SuppressWarnings("resource") ThreadPoolExecutor tpe = (ThreadPoolExecutor) executor; tpe.shutdownNow(); long timeout = getExecutorTerminationTimeoutMillis(); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat-tck) branch main updated: Add some configuration required for tests to pass
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat-tck.git The following commit(s) were added to refs/heads/main by this push: new c1abb58 Add some configuration required for tests to pass c1abb58 is described below commit c1abb58917de0890d12a47e86ab4c361f2a5d44f Author: Mark Thomas AuthorDate: Mon Mar 18 15:38:16 2024 + Add some configuration required for tests to pass --- .../tck/servlet/TomcatServletTckConfiguration.java | 47 -- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/servlet-tck/src/test/java/org/apache/tomcat/tck/servlet/TomcatServletTckConfiguration.java b/servlet-tck/src/test/java/org/apache/tomcat/tck/servlet/TomcatServletTckConfiguration.java index 4cbe69a..afd9bfb 100644 --- a/servlet-tck/src/test/java/org/apache/tomcat/tck/servlet/TomcatServletTckConfiguration.java +++ b/servlet-tck/src/test/java/org/apache/tomcat/tck/servlet/TomcatServletTckConfiguration.java @@ -18,7 +18,12 @@ package org.apache.tomcat.tck.servlet; import java.lang.reflect.Field; +import org.apache.catalina.Container; +import org.apache.catalina.Context; +import org.apache.catalina.connector.Connector; +import org.apache.catalina.core.StandardContext; import org.apache.catalina.startup.Tomcat; +import org.jboss.arquillian.container.spi.event.container.AfterDeploy; import org.jboss.arquillian.container.spi.event.container.BeforeDeploy; import org.jboss.arquillian.core.api.annotation.Observes; import org.jboss.arquillian.core.spi.LoadableExtension; @@ -33,22 +38,58 @@ public class TomcatServletTckConfiguration implements LoadableExtension { public static class ServletObserver { -public void configurePorts(@Observes final BeforeDeploy beforeDeploy) { +public void configureTomcat(@Observes final BeforeDeploy beforeDeploy) { Tomcat10EmbeddedContainer container = (Tomcat10EmbeddedContainer) beforeDeploy.getDeployableContainer(); try { + // Obtain reference to Tomcat instance Field tomcatField = Tomcat10EmbeddedContainer.class.getDeclaredField("tomcat"); tomcatField.setAccessible(true); Tomcat tomcat = (Tomcat) tomcatField.get(container); -int localPort = tomcat.getConnector().getLocalPort(); +// Update Arquillian configuration with port being used by Tomcat +Connector connector = tomcat.getConnector(); +int localPort = connector.getLocalPort(); Field configurationField = Tomcat10EmbeddedContainer.class.getDeclaredField("configuration"); configurationField.setAccessible(true); Object configuration = configurationField.get(container); - Field portField = container.getConfigurationClass().getDeclaredField("bindHttpPort"); portField.setAccessible(true); portField.set(configuration, Integer.valueOf(localPort)); +// Add trailer headers used in TCK to allow list +connector.setProperty("allowedTrailerHeaders", "myTrailer,myTrailer2"); + +// Add expected users +tomcat.addUser("j2ee", "j2ee"); +tomcat.addRole("j2ee", "Administrator"); +tomcat.addRole("j2ee", "Employee"); +tomcat.addUser("javajoe", "javajoe"); +tomcat.addRole("javajoe", "VP"); +tomcat.addRole("javajoe", "Manager"); +} catch (ReflectiveOperationException e) { +throw new RuntimeException(e); +} +} + +public void configureContext(@Observes final AfterDeploy afterDeploy) { +Tomcat10EmbeddedContainer container = (Tomcat10EmbeddedContainer) afterDeploy.getDeployableContainer(); +try { + // Obtain reference to Tomcat instance +Field tomcatField = Tomcat10EmbeddedContainer.class.getDeclaredField("tomcat"); +tomcatField.setAccessible(true); +Tomcat tomcat = (Tomcat) tomcatField.get(container); + +// Obtain reference to web application(s) +Container contexts[] = tomcat.getHost().findChildren(); +for (Container context : contexts) { + + // Configure expected encoding mapping + StandardContext stdContext = (StandardContext) context; + stdContext.addLocaleEncodingMappingParameter("ja", "Shift_JIS"); + + // Enable cross-context dispatches + stdContext.setCrossContext(true); +} } catch (ReflectiveOperationException e) { throw new RuntimeException(e); } ---
(tomcat-tck) branch main updated: Few more configuration settings required for the TCK
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat-tck.git The following commit(s) were added to refs/heads/main by this push: new b298ae7 Few more configuration settings required for the TCK b298ae7 is described below commit b298ae74fad83f34ccf63eda39e1033be29bbdb6 Author: Mark Thomas AuthorDate: Mon Mar 18 18:06:07 2024 + Few more configuration settings required for the TCK --- .../tomcat/tck/servlet/TomcatServletTckConfiguration.java | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/servlet-tck/src/test/java/org/apache/tomcat/tck/servlet/TomcatServletTckConfiguration.java b/servlet-tck/src/test/java/org/apache/tomcat/tck/servlet/TomcatServletTckConfiguration.java index afd9bfb..27be6bf 100644 --- a/servlet-tck/src/test/java/org/apache/tomcat/tck/servlet/TomcatServletTckConfiguration.java +++ b/servlet-tck/src/test/java/org/apache/tomcat/tck/servlet/TomcatServletTckConfiguration.java @@ -17,9 +17,9 @@ package org.apache.tomcat.tck.servlet; import java.lang.reflect.Field; +import java.util.Locale; import org.apache.catalina.Container; -import org.apache.catalina.Context; import org.apache.catalina.connector.Connector; import org.apache.catalina.core.StandardContext; import org.apache.catalina.startup.Tomcat; @@ -83,12 +83,21 @@ public class TomcatServletTckConfiguration implements LoadableExtension { Container contexts[] = tomcat.getHost().findChildren(); for (Container context : contexts) { - // Configure expected encoding mapping + // Configure expected encoding mapping unless application has defined one explicitly StandardContext stdContext = (StandardContext) context; - stdContext.addLocaleEncodingMappingParameter("ja", "Shift_JIS"); + if (stdContext.getCharsetMapper().getCharset(Locale.forLanguageTag("ja")) == null) { + stdContext.addLocaleEncodingMappingParameter("ja", "Shift_JIS"); + } // Enable cross-context dispatches stdContext.setCrossContext(true); + + // Subset of STRICT_SERVLET_COMPLIANCE required by TCK + stdContext.setAlwaysAccessSession(true); + stdContext.setContextGetResourceRequiresSlash(true); + stdContext.setUseRelativeRedirects(false); + stdContext.getManager().setSessionActivityCheck(true); + stdContext.getManager().setSessionLastAccessAtStart(true); } } catch (ReflectiveOperationException e) { throw new RuntimeException(e); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) branch main updated: Fix regression in user provided SSLContext support
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new 476f3bfc50 Fix regression in user provided SSLContext support 476f3bfc50 is described below commit 476f3bfc50a4e8ee2c5bfce089f461aba5a6d87a Author: Mark Thomas AuthorDate: Mon Mar 18 20:23:53 2024 + Fix regression in user provided SSLContext support This broke the TLSCertificateReloadListener --- java/org/apache/tomcat/util/net/AbstractEndpoint.java | 8 +++- webapps/docs/changelog.xml| 7 +++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/java/org/apache/tomcat/util/net/AbstractEndpoint.java b/java/org/apache/tomcat/util/net/AbstractEndpoint.java index 12d70bf007..2c8a77ddd2 100644 --- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java +++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java @@ -409,8 +409,14 @@ public abstract class AbstractEndpoint { } SSLContext sslContext = certificate.getSslContext(); +SSLContext sslContextGenerated = certificate.getSslContextGenerated(); // Generate the SSLContext from configuration unless (e.g. embedded) an SSLContext has been provided. -if (sslContext == null) { +// Need to handle both initial configuration and reload. +// Initial, SSLContext provided - sslContext will be non-null and sslContextGenerated will be null +// Initial, SSLContext not provided - sslContext null and sslContextGenerated will be null +// Reload, SSLContext provided - sslContext will be non-null and sslContextGenerated will be null +// Reload, SSLContext not provided - sslContext non-null and equal to sslContextGenerated +if (sslContext == null || sslContext == sslContextGenerated) { try { sslContext = sslUtil.createSSLContext(negotiableProtocols); } catch (Exception e) { diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 07f1af22c5..1766e6ede2 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -153,6 +153,13 @@ configured with a Max-Age value of zero as RFC 6265 does not permit a value of zero in this case. (markt) + +Correct a regression in the support for user provided +SSLContext instances that broke the +org.apache.catalina.security.TLSCertificateReloadListener. +(markt) + + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) branch main updated: IDE says this is no longer required
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new 1972d821a0 IDE says this is no longer required 1972d821a0 is described below commit 1972d821a093002328e7a43c4a7e2ef1fb017af2 Author: Mark Thomas AuthorDate: Mon Mar 18 20:24:07 2024 + IDE says this is no longer required --- java/org/apache/tomcat/util/net/AbstractEndpoint.java | 1 - 1 file changed, 1 deletion(-) diff --git a/java/org/apache/tomcat/util/net/AbstractEndpoint.java b/java/org/apache/tomcat/util/net/AbstractEndpoint.java index 2c8a77ddd2..b63a493c27 100644 --- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java +++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java @@ -1240,7 +1240,6 @@ public abstract class AbstractEndpoint { this.executor = null; if (executor instanceof ThreadPoolExecutor) { //this is our internal one, so we need to shut it down -@SuppressWarnings("resource") ThreadPoolExecutor tpe = (ThreadPoolExecutor) executor; tpe.shutdownNow(); long timeout = getExecutorTerminationTimeoutMillis(); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) branch 10.1.x updated: Fix regression in user provided SSLContext support
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/10.1.x by this push: new 62ad0fd5b1 Fix regression in user provided SSLContext support 62ad0fd5b1 is described below commit 62ad0fd5b1dc02421e6022d4837193bdca84a3b3 Author: Mark Thomas AuthorDate: Mon Mar 18 20:23:53 2024 + Fix regression in user provided SSLContext support This broke the TLSCertificateReloadListener --- java/org/apache/tomcat/util/net/AbstractJsseEndpoint.java | 8 +++- webapps/docs/changelog.xml| 6 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/java/org/apache/tomcat/util/net/AbstractJsseEndpoint.java b/java/org/apache/tomcat/util/net/AbstractJsseEndpoint.java index b75002de38..bffb874b4a 100644 --- a/java/org/apache/tomcat/util/net/AbstractJsseEndpoint.java +++ b/java/org/apache/tomcat/util/net/AbstractJsseEndpoint.java @@ -100,8 +100,14 @@ public abstract class AbstractJsseEndpoint extends AbstractEndpoint { } SSLContext sslContext = certificate.getSslContext(); +SSLContext sslContextGenerated = certificate.getSslContextGenerated(); // Generate the SSLContext from configuration unless (e.g. embedded) an SSLContext has been provided. -if (sslContext == null) { +// Need to handle both initial configuration and reload. +// Initial, SSLContext provided - sslContext will be non-null and sslContextGenerated will be null +// Initial, SSLContext not provided - sslContext null and sslContextGenerated will be null +// Reload, SSLContext provided - sslContext will be non-null and sslContextGenerated will be null +// Reload, SSLContext not provided - sslContext non-null and equal to sslContextGenerated +if (sslContext == null || sslContext == sslContextGenerated) { try { sslContext = sslUtil.createSSLContext(negotiableProtocols); } catch (Exception e) { diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 96e1e9ef1a..79ebc663b2 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -183,6 +183,12 @@ will scale back to the configured minSpareThreads size. (remm) + +Correct a regression in the support for user provided +SSLContext instances that broke the +org.apache.catalina.security.TLSCertificateReloadListener. +(markt) + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) branch 9.0.x updated: Fix regression in user provided SSLContext support
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/9.0.x by this push: new 1324f0b2d6 Fix regression in user provided SSLContext support 1324f0b2d6 is described below commit 1324f0b2d62fa7efa875ee5cc9bea6fcadd90f52 Author: Mark Thomas AuthorDate: Mon Mar 18 20:23:53 2024 + Fix regression in user provided SSLContext support This broke the TLSCertificateReloadListener --- java/org/apache/tomcat/util/net/AbstractJsseEndpoint.java | 8 +++- webapps/docs/changelog.xml| 6 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/java/org/apache/tomcat/util/net/AbstractJsseEndpoint.java b/java/org/apache/tomcat/util/net/AbstractJsseEndpoint.java index b2a3390c6a..9676174cd1 100644 --- a/java/org/apache/tomcat/util/net/AbstractJsseEndpoint.java +++ b/java/org/apache/tomcat/util/net/AbstractJsseEndpoint.java @@ -101,8 +101,14 @@ public abstract class AbstractJsseEndpoint extends AbstractEndpoint { } SSLContext sslContext = certificate.getSslContext(); +SSLContext sslContextGenerated = certificate.getSslContextGenerated(); // Generate the SSLContext from configuration unless (e.g. embedded) an SSLContext has been provided. -if (sslContext == null) { +// Need to handle both initial configuration and reload. +// Initial, SSLContext provided - sslContext will be non-null and sslContextGenerated will be null +// Initial, SSLContext not provided - sslContext null and sslContextGenerated will be null +// Reload, SSLContext provided - sslContext will be non-null and sslContextGenerated will be null +// Reload, SSLContext not provided - sslContext non-null and equal to sslContextGenerated +if (sslContext == null || sslContext == sslContextGenerated) { try { sslContext = sslUtil.createSSLContext(negotiableProtocols); } catch (Exception e) { diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 538bd09ad0..a3f4eb131f 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -209,6 +209,12 @@ added to the backlog immediately rather than waiting until the write attempt for the remaining content. (markt) + +Correct a regression in the support for user provided +SSLContext instances that broke the +org.apache.catalina.security.TLSCertificateReloadListener. +(markt) + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: (tomcat) branch main updated: IDE says this is no longer required
On 18/03/2024 20:24, ma...@apache.org wrote: This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new 1972d821a0 IDE says this is no longer required 1972d821a0 is described below commit 1972d821a093002328e7a43c4a7e2ef1fb017af2 Author: Mark Thomas AuthorDate: Mon Mar 18 20:24:07 2024 + IDE says this is no longer required Just realised this was new rather than old. I'm guessing you are compiling with Java 22 in the IDE which is why you need this? Mark --- java/org/apache/tomcat/util/net/AbstractEndpoint.java | 1 - 1 file changed, 1 deletion(-) diff --git a/java/org/apache/tomcat/util/net/AbstractEndpoint.java b/java/org/apache/tomcat/util/net/AbstractEndpoint.java index 2c8a77ddd2..b63a493c27 100644 --- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java +++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java @@ -1240,7 +1240,6 @@ public abstract class AbstractEndpoint { this.executor = null; if (executor instanceof ThreadPoolExecutor) { //this is our internal one, so we need to shut it down -@SuppressWarnings("resource") ThreadPoolExecutor tpe = (ThreadPoolExecutor) executor; tpe.shutdownNow(); long timeout = getExecutorTerminationTimeoutMillis(); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) branch 8.5.x updated: Fix regression in user provided SSLContext support
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/8.5.x by this push: new a11bac054f Fix regression in user provided SSLContext support a11bac054f is described below commit a11bac054f4704a60c09c0ac439b1e9ef9401e2b Author: Mark Thomas AuthorDate: Mon Mar 18 20:23:53 2024 + Fix regression in user provided SSLContext support This broke the TLSCertificateReloadListener --- java/org/apache/tomcat/util/net/AbstractJsseEndpoint.java | 8 +++- webapps/docs/changelog.xml| 6 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/java/org/apache/tomcat/util/net/AbstractJsseEndpoint.java b/java/org/apache/tomcat/util/net/AbstractJsseEndpoint.java index 39179814d6..88ac4e087b 100644 --- a/java/org/apache/tomcat/util/net/AbstractJsseEndpoint.java +++ b/java/org/apache/tomcat/util/net/AbstractJsseEndpoint.java @@ -102,8 +102,14 @@ public abstract class AbstractJsseEndpoint extends AbstractEndpoint { } SSLContext sslContext = certificate.getSslContext(); +SSLContext sslContextGenerated = certificate.getSslContextGenerated(); // Generate the SSLContext from configuration unless (e.g. embedded) an SSLContext has been provided. -if (sslContext == null) { +// Need to handle both initial configuration and reload. +// Initial, SSLContext provided - sslContext will be non-null and sslContextGenerated will be null +// Initial, SSLContext not provided - sslContext null and sslContextGenerated will be null +// Reload, SSLContext provided - sslContext will be non-null and sslContextGenerated will be null +// Reload, SSLContext not provided - sslContext non-null and equal to sslContextGenerated +if (sslContext == null || sslContext == sslContextGenerated) { try { sslContext = sslUtil.createSSLContext(negotiableProtocols); } catch (Exception e) { diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index b9c69bc6a4..5ce2ccc8f2 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -155,6 +155,12 @@ added to the backlog immediately rather than waiting until the write attempt for the remaining content. (markt) + +Correct a regression in the support for user provided +SSLContext instances that broke the +org.apache.catalina.security.TLSCertificateReloadListener. +(markt) + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: (tomcat) branch main updated: IDE says this is no longer required
On Mon, Mar 18, 2024 at 9:30 PM Mark Thomas wrote: > > On 18/03/2024 20:24, ma...@apache.org wrote: > > This is an automated email from the ASF dual-hosted git repository. > > > > markt pushed a commit to branch main > > in repository https://gitbox.apache.org/repos/asf/tomcat.git > > > > > > The following commit(s) were added to refs/heads/main by this push: > > new 1972d821a0 IDE says this is no longer required > > 1972d821a0 is described below > > > > commit 1972d821a093002328e7a43c4a7e2ef1fb017af2 > > Author: Mark Thomas > > AuthorDate: Mon Mar 18 20:24:07 2024 + > > > > IDE says this is no longer required > > Just realised this was new rather than old. I'm guessing you are > compiling with Java 22 in the IDE which is why you need this? Yes, it's an IDE warning. Rémy > Mark > > > --- > > java/org/apache/tomcat/util/net/AbstractEndpoint.java | 1 - > > 1 file changed, 1 deletion(-) > > > > diff --git a/java/org/apache/tomcat/util/net/AbstractEndpoint.java > > b/java/org/apache/tomcat/util/net/AbstractEndpoint.java > > index 2c8a77ddd2..b63a493c27 100644 > > --- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java > > +++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java > > @@ -1240,7 +1240,6 @@ public abstract class AbstractEndpoint { > > this.executor = null; > > if (executor instanceof ThreadPoolExecutor) { > > //this is our internal one, so we need to shut it down > > -@SuppressWarnings("resource") > > ThreadPoolExecutor tpe = (ThreadPoolExecutor) executor; > > tpe.shutdownNow(); > > long timeout = getExecutorTerminationTimeoutMillis(); > > > > > > - > > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org > > For additional commands, e-mail: dev-h...@tomcat.apache.org > > > > - > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org > For additional commands, e-mail: dev-h...@tomcat.apache.org > - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[PR] Sort the resource list,Ensure consistency in the order of loading res… [tomcat]
zxm1234 opened a new pull request, #708: URL: https://github.com/apache/tomcat/pull/708 …ources. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org