(tomcat) branch main updated: Ignore warnings in generated code
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 cee3dd152e Ignore warnings in generated code cee3dd152e is described below commit cee3dd152e256adcd415d05a08e524e211140d7c Author: Mark Thomas AuthorDate: Thu Apr 10 13:55:09 2025 +0100 Ignore warnings in generated code --- java/org/apache/tomcat/util/openssl/openssl_h_Compatibility.java | 1 + 1 file changed, 1 insertion(+) diff --git a/java/org/apache/tomcat/util/openssl/openssl_h_Compatibility.java b/java/org/apache/tomcat/util/openssl/openssl_h_Compatibility.java index f7322de3ca..2ac4e437a5 100644 --- a/java/org/apache/tomcat/util/openssl/openssl_h_Compatibility.java +++ b/java/org/apache/tomcat/util/openssl/openssl_h_Compatibility.java @@ -27,6 +27,7 @@ import static org.apache.tomcat.util.openssl.openssl_h.SSL_get1_peer_certificate /** * Methods used present in older OpenSSL versions but not in the current major version or OpenSSL derivatives. */ +@SuppressWarnings("javadoc") public class openssl_h_Compatibility { public static final boolean OPENSSL; - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) branch 11.0.x updated: Ignore warnings in generated code
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 11.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/11.0.x by this push: new ff8d94216e Ignore warnings in generated code ff8d94216e is described below commit ff8d94216e0c47d333ba02bd3c97598fa9c87b48 Author: Mark Thomas AuthorDate: Thu Apr 10 13:55:09 2025 +0100 Ignore warnings in generated code --- java/org/apache/tomcat/util/openssl/openssl_h_Compatibility.java | 1 + 1 file changed, 1 insertion(+) diff --git a/java/org/apache/tomcat/util/openssl/openssl_h_Compatibility.java b/java/org/apache/tomcat/util/openssl/openssl_h_Compatibility.java index f7322de3ca..2ac4e437a5 100644 --- a/java/org/apache/tomcat/util/openssl/openssl_h_Compatibility.java +++ b/java/org/apache/tomcat/util/openssl/openssl_h_Compatibility.java @@ -27,6 +27,7 @@ import static org.apache.tomcat.util.openssl.openssl_h.SSL_get1_peer_certificate /** * Methods used present in older OpenSSL versions but not in the current major version or OpenSSL derivatives. */ +@SuppressWarnings("javadoc") public class openssl_h_Compatibility { public static final boolean OPENSSL; - 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: Move entry to correct version
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 a50e4f4b65 Move entry to correct version a50e4f4b65 is described below commit a50e4f4b653e09064b40d49bdd6eac2b07ce17cd Author: Mark Thomas AuthorDate: Thu Apr 10 15:08:08 2025 +0100 Move entry to correct version --- webapps/docs/changelog.xml | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index e333cc86ac..9c1da0842f 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -107,6 +107,12 @@ + +69588: Enable allowLinking to be set on +PreResources, JarResources and +PostResources. If not set explicitly, the setting will be +inherited from the Resources. (markt) + 69633: Add support for Filters using context root mappings. (markt) @@ -136,12 +142,6 @@ Process possible path parameters rewrite production in the rewrite valve. (remm) - -69588: Enable allowLinking to be set on -PreResources, JarResources and -PostResources. If not set explicitly, the setting will be -inherited from the Resources. (markt) - 69643: Optimize directory listing for large amount of files. Patch submitted by Loic de l'Eprevier. (remm) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 69588] Allow linking subresources independent of in context.xml
https://bz.apache.org/bugzilla/show_bug.cgi?id=69588 Mark Thomas changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #4 from Mark Thomas --- Fixed in: - 11.0.x for 11.0.7 onwards - 10.1.x for 10.1.41 onwards - 9.0.x for 9.0.105 onwards -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) branch 11.0.x updated: Fix BZ 69635 - add support to ImportHandler for resolving inner classes
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 11.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/11.0.x by this push: new 9d2b65bcf5 Fix BZ 69635 - add support to ImportHandler for resolving inner classes 9d2b65bcf5 is described below commit 9d2b65bcf58870cb30c2ce3c2bd52b0bdc476c80 Author: Mark Thomas AuthorDate: Fri Apr 4 17:17:39 2025 +0100 Fix BZ 69635 - add support to ImportHandler for resolving inner classes https://bz.apache.org/bugzilla/show_bug.cgi?id=69635 --- java/jakarta/el/ImportHandler.java | 12 test/jakarta/el/TestImportHandler.java | 17 + test/org/apache/el/TestELInJsp.java| 10 ++ test/webapp/bug6/bug69635.jsp | 18 ++ webapps/docs/changelog.xml | 8 5 files changed, 65 insertions(+) diff --git a/java/jakarta/el/ImportHandler.java b/java/jakarta/el/ImportHandler.java index ac2e9e492a..f3fc447742 100644 --- a/java/jakarta/el/ImportHandler.java +++ b/java/jakarta/el/ImportHandler.java @@ -398,6 +398,18 @@ public class ImportHandler { clazzes.put(name, clazz); return clazz; } +// Might be an inner class +StringBuilder sb = new StringBuilder(className); +int replacementPosition = sb.lastIndexOf("."); +while (replacementPosition > -1) { +sb.setCharAt(replacementPosition, '$'); +clazz = findClass(sb.toString(), true); +if (clazz != null) { +clazzes.put(name, clazz); +return clazz; +} +replacementPosition = sb.lastIndexOf(".", replacementPosition); +} } // Search the package imports - note there may be multiple matches diff --git a/test/jakarta/el/TestImportHandler.java b/test/jakarta/el/TestImportHandler.java index db4bbf5cd9..ef3e533e4d 100644 --- a/test/jakarta/el/TestImportHandler.java +++ b/test/jakarta/el/TestImportHandler.java @@ -21,6 +21,7 @@ import java.util.ArrayList; import org.junit.Assert; import org.junit.Test; +import org.apache.catalina.authenticator.DigestAuthenticator; import org.apache.tomcat.util.res.StringManager; public class TestImportHandler { @@ -265,4 +266,20 @@ public class TestImportHandler { importHandler.resolveClass("Foo"); } + + +/** + * Support for inner classes. + * + * https://bz.apache.org/bugzilla/show_bug.cgi?id=69635 + */ +@Test +public void testResolveInnerClass() { +ImportHandler importHandler = new ImportHandler(); + + importHandler.importClass("org.apache.catalina.authenticator.DigestAuthenticator.AuthDigest"); +Class clazz = importHandler.resolveClass("AuthDigest"); + +Assert.assertEquals(DigestAuthenticator.AuthDigest.class, clazz); +} } diff --git a/test/org/apache/el/TestELInJsp.java b/test/org/apache/el/TestELInJsp.java index 4c8bfb0661..10fa44ba3f 100644 --- a/test/org/apache/el/TestELInJsp.java +++ b/test/org/apache/el/TestELInJsp.java @@ -508,6 +508,16 @@ public class TestELInJsp extends TomcatBaseTest { } +@Test +public void testBug69635() throws Exception { +getTomcatInstanceTestWebapp(true, true); + +ByteChunk res = getUrl("http://localhost:"; + getPort() + "/test/bug6/bug69635.jsp"); +String result = res.toString(); +assertEcho(result, "01-3"); +} + + // Assertion for text contained with , e.g. printed by tags:echo private static void assertEcho(String result, String expected) { Assert.assertTrue(result, result.indexOf("" + expected + "") > 0); diff --git a/test/webapp/bug6/bug69635.jsp b/test/webapp/bug6/bug69635.jsp new file mode 100644 index 00..2d2a2411a5 --- /dev/null +++ b/test/webapp/bug6/bug69635.jsp @@ -0,0 +1,18 @@ +<%-- + 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. +--%> +<%@page import="org.apache.catalina.authenticator.DigestAuthenticator.AuthDigest"%> +01-${ AuthDigest.values().length } diff --git a/webapps/docs/changelog.xml b/w
(tomcat) branch 9.0.x updated: Fix BZ 69635 - add support to ImportHandler for resolving inner classes
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 1ffc2c22e9 Fix BZ 69635 - add support to ImportHandler for resolving inner classes 1ffc2c22e9 is described below commit 1ffc2c22e9566daf0efec12ee2a01d752d296159 Author: Mark Thomas AuthorDate: Fri Apr 4 17:17:39 2025 +0100 Fix BZ 69635 - add support to ImportHandler for resolving inner classes https://bz.apache.org/bugzilla/show_bug.cgi?id=69635 --- java/javax/el/ImportHandler.java | 12 test/javax/el/TestImportHandler.java | 17 + test/org/apache/el/TestELInJsp.java | 10 ++ test/webapp/bug6/bug69635.jsp| 18 ++ webapps/docs/changelog.xml | 8 5 files changed, 65 insertions(+) diff --git a/java/javax/el/ImportHandler.java b/java/javax/el/ImportHandler.java index ee8fa97899..bc540850b4 100644 --- a/java/javax/el/ImportHandler.java +++ b/java/javax/el/ImportHandler.java @@ -401,6 +401,18 @@ public class ImportHandler { clazzes.put(name, clazz); return clazz; } +// Might be an inner class +StringBuilder sb = new StringBuilder(className); +int replacementPosition = sb.lastIndexOf("."); +while (replacementPosition > -1) { +sb.setCharAt(replacementPosition, '$'); +clazz = findClass(sb.toString(), true); +if (clazz != null) { +clazzes.put(name, clazz); +return clazz; +} +replacementPosition = sb.lastIndexOf(".", replacementPosition); +} } // Search the package imports - note there may be multiple matches diff --git a/test/javax/el/TestImportHandler.java b/test/javax/el/TestImportHandler.java index 271c39e5a4..57ed7b1ae2 100644 --- a/test/javax/el/TestImportHandler.java +++ b/test/javax/el/TestImportHandler.java @@ -21,6 +21,7 @@ import java.util.ArrayList; import org.junit.Assert; import org.junit.Test; +import org.apache.catalina.authenticator.DigestAuthenticator; import org.apache.tomcat.util.res.StringManager; public class TestImportHandler { @@ -265,4 +266,20 @@ public class TestImportHandler { importHandler.resolveClass("Foo"); } + + +/** + * Support for inner classes. + * + * https://bz.apache.org/bugzilla/show_bug.cgi?id=69635 + */ +@Test +public void testResolveInnerClass() { +ImportHandler importHandler = new ImportHandler(); + + importHandler.importClass("org.apache.catalina.authenticator.DigestAuthenticator.AuthDigest"); +Class clazz = importHandler.resolveClass("AuthDigest"); + +Assert.assertEquals(DigestAuthenticator.AuthDigest.class, clazz); +} } diff --git a/test/org/apache/el/TestELInJsp.java b/test/org/apache/el/TestELInJsp.java index e36f939af5..d1ccefa636 100644 --- a/test/org/apache/el/TestELInJsp.java +++ b/test/org/apache/el/TestELInJsp.java @@ -507,6 +507,16 @@ public class TestELInJsp extends TomcatBaseTest { } +@Test +public void testBug69635() throws Exception { +getTomcatInstanceTestWebapp(true, true); + +ByteChunk res = getUrl("http://localhost:"; + getPort() + "/test/bug6/bug69635.jsp"); +String result = res.toString(); +assertEcho(result, "01-3"); +} + + // Assertion for text contained with , e.g. printed by tags:echo private static void assertEcho(String result, String expected) { Assert.assertTrue(result, result.indexOf("" + expected + "") > 0); diff --git a/test/webapp/bug6/bug69635.jsp b/test/webapp/bug6/bug69635.jsp new file mode 100644 index 00..2d2a2411a5 --- /dev/null +++ b/test/webapp/bug6/bug69635.jsp @@ -0,0 +1,18 @@ +<%-- + 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. +--%> +<%@page import="org.apache.catalina.authenticator.DigestAuthenticator.AuthDigest"%> +01-${ AuthDigest.values().length } diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml ind
[Bug 69635] JSP fails to import nested enum or class
https://bz.apache.org/bugzilla/show_bug.cgi?id=69635 Mark Thomas changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #3 from Mark Thomas --- Fixed in: - 11.0.x for 11.0.7 onwards - 10.1.x for 10.1.41 onwards - 9.0.x for 9.0.105 onwards -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 69635] JSP fails to import nested enum or class
https://bz.apache.org/bugzilla/show_bug.cgi?id=69635 --- Comment #4 from Brice --- Amazing -- thank you so much, Mark! -- You are receiving this mail because: You are the assignee for the bug. - 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 BZ 69635 - add support to ImportHandler for resolving inner classes
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 fcf1d50010 Fix BZ 69635 - add support to ImportHandler for resolving inner classes fcf1d50010 is described below commit fcf1d5001010c5cf99861d093f7cadd66c520bf1 Author: Mark Thomas AuthorDate: Fri Apr 4 17:17:39 2025 +0100 Fix BZ 69635 - add support to ImportHandler for resolving inner classes https://bz.apache.org/bugzilla/show_bug.cgi?id=69635 --- java/jakarta/el/ImportHandler.java | 12 test/jakarta/el/TestImportHandler.java | 17 + test/org/apache/el/TestELInJsp.java| 10 ++ test/webapp/bug6/bug69635.jsp | 18 ++ webapps/docs/changelog.xml | 8 5 files changed, 65 insertions(+) diff --git a/java/jakarta/el/ImportHandler.java b/java/jakarta/el/ImportHandler.java index b70cdb4d94..44d11cece0 100644 --- a/java/jakarta/el/ImportHandler.java +++ b/java/jakarta/el/ImportHandler.java @@ -400,6 +400,18 @@ public class ImportHandler { clazzes.put(name, clazz); return clazz; } +// Might be an inner class +StringBuilder sb = new StringBuilder(className); +int replacementPosition = sb.lastIndexOf("."); +while (replacementPosition > -1) { +sb.setCharAt(replacementPosition, '$'); +clazz = findClass(sb.toString(), true); +if (clazz != null) { +clazzes.put(name, clazz); +return clazz; +} +replacementPosition = sb.lastIndexOf(".", replacementPosition); +} } // Search the package imports - note there may be multiple matches diff --git a/test/jakarta/el/TestImportHandler.java b/test/jakarta/el/TestImportHandler.java index db4bbf5cd9..ef3e533e4d 100644 --- a/test/jakarta/el/TestImportHandler.java +++ b/test/jakarta/el/TestImportHandler.java @@ -21,6 +21,7 @@ import java.util.ArrayList; import org.junit.Assert; import org.junit.Test; +import org.apache.catalina.authenticator.DigestAuthenticator; import org.apache.tomcat.util.res.StringManager; public class TestImportHandler { @@ -265,4 +266,20 @@ public class TestImportHandler { importHandler.resolveClass("Foo"); } + + +/** + * Support for inner classes. + * + * https://bz.apache.org/bugzilla/show_bug.cgi?id=69635 + */ +@Test +public void testResolveInnerClass() { +ImportHandler importHandler = new ImportHandler(); + + importHandler.importClass("org.apache.catalina.authenticator.DigestAuthenticator.AuthDigest"); +Class clazz = importHandler.resolveClass("AuthDigest"); + +Assert.assertEquals(DigestAuthenticator.AuthDigest.class, clazz); +} } diff --git a/test/org/apache/el/TestELInJsp.java b/test/org/apache/el/TestELInJsp.java index 4c8bfb0661..10fa44ba3f 100644 --- a/test/org/apache/el/TestELInJsp.java +++ b/test/org/apache/el/TestELInJsp.java @@ -508,6 +508,16 @@ public class TestELInJsp extends TomcatBaseTest { } +@Test +public void testBug69635() throws Exception { +getTomcatInstanceTestWebapp(true, true); + +ByteChunk res = getUrl("http://localhost:"; + getPort() + "/test/bug6/bug69635.jsp"); +String result = res.toString(); +assertEcho(result, "01-3"); +} + + // Assertion for text contained with , e.g. printed by tags:echo private static void assertEcho(String result, String expected) { Assert.assertTrue(result, result.indexOf("" + expected + "") > 0); diff --git a/test/webapp/bug6/bug69635.jsp b/test/webapp/bug6/bug69635.jsp new file mode 100644 index 00..2d2a2411a5 --- /dev/null +++ b/test/webapp/bug6/bug69635.jsp @@ -0,0 +1,18 @@ +<%-- + 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. +--%> +<%@page import="org.apache.catalina.authenticator.DigestAuthenticator.AuthDigest"%> +01-${ AuthDigest.values().length } diff --git a/webapps/docs/changelog.xml b/w
Buildbot failure in on tomcat-10.1.x
Build status: BUILD FAILED: failed compile (failure) Worker used: bb_worker2_ubuntu URL: https://ci2.apache.org/#builders/44/builds/1728 Blamelist: Mark Thomas Build Text: failed compile (failure) Status Detected: new failure Build Source Stamp: [branch 10.1.x] fcf1d5001010c5cf99861d093f7cadd66c520bf1 Steps: worker_preparation: 0 git: 0 shell: 0 shell_1: 0 shell_2: 0 shell_3: 0 shell_4: 0 shell_5: 0 shell_6: 0 compile: 1 shell_7: 0 shell_8: 0 shell_9: 0 shell_10: 0 Rsync docs to nightlies.apache.org: 0 shell_11: 0 Rsync RAT to nightlies.apache.org: 0 compile_1: 2 shell_12: 0 Rsync Logs to nightlies.apache.org: 0 -- ASF Buildbot - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) branch main updated: Fix BZ 69588 - enable allowLinking to be configured per ResourceSet
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 1f1dcfc613 Fix BZ 69588 - enable allowLinking to be configured per ResourceSet 1f1dcfc613 is described below commit 1f1dcfc61322701cc00c87bde74895e11392fb2a Author: Mark Thomas AuthorDate: Thu Apr 10 14:57:23 2025 +0100 Fix BZ 69588 - enable allowLinking to be configured per ResourceSet https://bz.apache.org/bugzilla/show_bug.cgi?id=69588 --- java/org/apache/catalina/WebResourceRoot.java | 8 ++-- java/org/apache/catalina/WebResourceSet.java | 15 +++ .../webresources/AbstractArchiveResourceSet.java | 19 +++ .../webresources/AbstractFileResourceSet.java | 16 +++- .../apache/catalina/webresources/DirResourceSet.java | 2 +- .../catalina/webresources/EmptyResourceSet.java | 19 +++ webapps/docs/changelog.xml| 6 ++ webapps/docs/config/resources.xml | 13 + 8 files changed, 94 insertions(+), 4 deletions(-) diff --git a/java/org/apache/catalina/WebResourceRoot.java b/java/org/apache/catalina/WebResourceRoot.java index e473d53a06..5ad9d66986 100644 --- a/java/org/apache/catalina/WebResourceRoot.java +++ b/java/org/apache/catalina/WebResourceRoot.java @@ -21,6 +21,8 @@ import java.net.URL; import java.util.List; import java.util.Set; +import org.apache.catalina.util.ResourceSet; + /** * Represents the complete set of resources for a web application. The resources for a web application consist of * multiple ResourceSets and when looking for a Resource, the ResourceSets are processed in the following order: @@ -246,14 +248,16 @@ public interface WebResourceRoot extends Lifecycle { void setContext(Context context); /** - * Configure if this resources allow the use of symbolic links. + * Configure if this web application allows the use of symbolic links by default. Individual {@link ResourceSet}s + * may override this setting. * * @param allowLinking true if symbolic links are allowed. */ void setAllowLinking(boolean allowLinking); /** - * Determine if this resources allow the use of symbolic links. + * Determine if this web application allows the use of symbolic links by default. Individual {@link ResourceSet}s + * may override this setting. * * @return true if symbolic links are allowed */ diff --git a/java/org/apache/catalina/WebResourceSet.java b/java/org/apache/catalina/WebResourceSet.java index 1d2729cfea..231434f9b6 100644 --- a/java/org/apache/catalina/WebResourceSet.java +++ b/java/org/apache/catalina/WebResourceSet.java @@ -135,4 +135,19 @@ public interface WebResourceSet extends Lifecycle { * resources. */ void gc(); + +/** + * Configure if this {@code ResourceSet} allows the use of symbolic links. + * + * @param allowLinking true if symbolic links are allowed. + */ +void setAllowLinking(boolean allowLinking); + +/** + * Determine if this {@code ResourceSet} allows the use of symbolic links. If {@link #setAllowLinking(boolean)} has + * not been called for this instance, the value of {@link WebResourceRoot#getAllowLinking()} is returned. + * + * @return true if symbolic links are allowed + */ +boolean getAllowLinking(); } diff --git a/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java b/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java index 0644a8c3d0..4b722a3985 100644 --- a/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java +++ b/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java @@ -293,6 +293,25 @@ public abstract class AbstractArchiveResourceSet extends AbstractResourceSet { throw new IllegalArgumentException(sm.getString("abstractArchiveResourceSet.setReadOnlyFalse")); } +/** + * {@inheritDoc} + * + * Calls to this method will be ignored as archives do not allow linking. + */ +@Override +public void setAllowLinking(boolean allowLinking) { +} + +/** + * {@inheritDoc} + * + * Calls to this method always return {@code false} as archives do not allow linking. + */ +@Override +public boolean getAllowLinking() { +return false; +} + protected JarFile openJarFile() throws IOException { synchronized (archiveLock) { if (archive == null) { diff --git a/java/org/apache/catalina/webresources/AbstractFileResourceSet.java b/java/org/apache/catalina/webresources/AbstractFileResourceSet.java index 25512080ea..3edfb5551b 100644 --- a/java/org/apache/catalina/webresources/AbstractFileResourceSet.java +++ b/java/org/apache/catalina/
(tomcat) branch 11.0.x updated: Fix BZ 69588 - enable allowLinking to be configured per ResourceSet
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 11.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/11.0.x by this push: new 97123c2526 Fix BZ 69588 - enable allowLinking to be configured per ResourceSet 97123c2526 is described below commit 97123c25262ac23ec04ed96e757489a5ecc7854b Author: Mark Thomas AuthorDate: Thu Apr 10 14:57:23 2025 +0100 Fix BZ 69588 - enable allowLinking to be configured per ResourceSet https://bz.apache.org/bugzilla/show_bug.cgi?id=69588 --- java/org/apache/catalina/WebResourceRoot.java | 8 ++-- java/org/apache/catalina/WebResourceSet.java | 15 +++ .../webresources/AbstractArchiveResourceSet.java | 19 +++ .../webresources/AbstractFileResourceSet.java | 16 +++- .../apache/catalina/webresources/DirResourceSet.java | 2 +- .../catalina/webresources/EmptyResourceSet.java | 19 +++ webapps/docs/changelog.xml| 6 ++ webapps/docs/config/resources.xml | 13 + 8 files changed, 94 insertions(+), 4 deletions(-) diff --git a/java/org/apache/catalina/WebResourceRoot.java b/java/org/apache/catalina/WebResourceRoot.java index e473d53a06..5ad9d66986 100644 --- a/java/org/apache/catalina/WebResourceRoot.java +++ b/java/org/apache/catalina/WebResourceRoot.java @@ -21,6 +21,8 @@ import java.net.URL; import java.util.List; import java.util.Set; +import org.apache.catalina.util.ResourceSet; + /** * Represents the complete set of resources for a web application. The resources for a web application consist of * multiple ResourceSets and when looking for a Resource, the ResourceSets are processed in the following order: @@ -246,14 +248,16 @@ public interface WebResourceRoot extends Lifecycle { void setContext(Context context); /** - * Configure if this resources allow the use of symbolic links. + * Configure if this web application allows the use of symbolic links by default. Individual {@link ResourceSet}s + * may override this setting. * * @param allowLinking true if symbolic links are allowed. */ void setAllowLinking(boolean allowLinking); /** - * Determine if this resources allow the use of symbolic links. + * Determine if this web application allows the use of symbolic links by default. Individual {@link ResourceSet}s + * may override this setting. * * @return true if symbolic links are allowed */ diff --git a/java/org/apache/catalina/WebResourceSet.java b/java/org/apache/catalina/WebResourceSet.java index 1d2729cfea..231434f9b6 100644 --- a/java/org/apache/catalina/WebResourceSet.java +++ b/java/org/apache/catalina/WebResourceSet.java @@ -135,4 +135,19 @@ public interface WebResourceSet extends Lifecycle { * resources. */ void gc(); + +/** + * Configure if this {@code ResourceSet} allows the use of symbolic links. + * + * @param allowLinking true if symbolic links are allowed. + */ +void setAllowLinking(boolean allowLinking); + +/** + * Determine if this {@code ResourceSet} allows the use of symbolic links. If {@link #setAllowLinking(boolean)} has + * not been called for this instance, the value of {@link WebResourceRoot#getAllowLinking()} is returned. + * + * @return true if symbolic links are allowed + */ +boolean getAllowLinking(); } diff --git a/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java b/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java index 0644a8c3d0..4b722a3985 100644 --- a/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java +++ b/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java @@ -293,6 +293,25 @@ public abstract class AbstractArchiveResourceSet extends AbstractResourceSet { throw new IllegalArgumentException(sm.getString("abstractArchiveResourceSet.setReadOnlyFalse")); } +/** + * {@inheritDoc} + * + * Calls to this method will be ignored as archives do not allow linking. + */ +@Override +public void setAllowLinking(boolean allowLinking) { +} + +/** + * {@inheritDoc} + * + * Calls to this method always return {@code false} as archives do not allow linking. + */ +@Override +public boolean getAllowLinking() { +return false; +} + protected JarFile openJarFile() throws IOException { synchronized (archiveLock) { if (archive == null) { diff --git a/java/org/apache/catalina/webresources/AbstractFileResourceSet.java b/java/org/apache/catalina/webresources/AbstractFileResourceSet.java index 25512080ea..3edfb5551b 100644 --- a/java/org/apache/catalina/webresources/AbstractFileResourceSet.java +++ b/java/org/apache/catal
(tomcat) branch 10.1.x updated: Fix BZ 69588 - enable allowLinking to be configured per ResourceSet
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 46d1773ee0 Fix BZ 69588 - enable allowLinking to be configured per ResourceSet 46d1773ee0 is described below commit 46d1773ee0c311227018d9b8badb8c009d601b6d Author: Mark Thomas AuthorDate: Thu Apr 10 14:57:23 2025 +0100 Fix BZ 69588 - enable allowLinking to be configured per ResourceSet https://bz.apache.org/bugzilla/show_bug.cgi?id=69588 --- java/org/apache/catalina/WebResourceRoot.java | 8 ++-- java/org/apache/catalina/WebResourceSet.java | 15 +++ .../webresources/AbstractArchiveResourceSet.java | 19 +++ .../webresources/AbstractFileResourceSet.java | 16 +++- .../apache/catalina/webresources/DirResourceSet.java | 2 +- .../catalina/webresources/EmptyResourceSet.java | 19 +++ webapps/docs/changelog.xml| 6 ++ webapps/docs/config/resources.xml | 13 + 8 files changed, 94 insertions(+), 4 deletions(-) diff --git a/java/org/apache/catalina/WebResourceRoot.java b/java/org/apache/catalina/WebResourceRoot.java index e473d53a06..5ad9d66986 100644 --- a/java/org/apache/catalina/WebResourceRoot.java +++ b/java/org/apache/catalina/WebResourceRoot.java @@ -21,6 +21,8 @@ import java.net.URL; import java.util.List; import java.util.Set; +import org.apache.catalina.util.ResourceSet; + /** * Represents the complete set of resources for a web application. The resources for a web application consist of * multiple ResourceSets and when looking for a Resource, the ResourceSets are processed in the following order: @@ -246,14 +248,16 @@ public interface WebResourceRoot extends Lifecycle { void setContext(Context context); /** - * Configure if this resources allow the use of symbolic links. + * Configure if this web application allows the use of symbolic links by default. Individual {@link ResourceSet}s + * may override this setting. * * @param allowLinking true if symbolic links are allowed. */ void setAllowLinking(boolean allowLinking); /** - * Determine if this resources allow the use of symbolic links. + * Determine if this web application allows the use of symbolic links by default. Individual {@link ResourceSet}s + * may override this setting. * * @return true if symbolic links are allowed */ diff --git a/java/org/apache/catalina/WebResourceSet.java b/java/org/apache/catalina/WebResourceSet.java index 1d2729cfea..231434f9b6 100644 --- a/java/org/apache/catalina/WebResourceSet.java +++ b/java/org/apache/catalina/WebResourceSet.java @@ -135,4 +135,19 @@ public interface WebResourceSet extends Lifecycle { * resources. */ void gc(); + +/** + * Configure if this {@code ResourceSet} allows the use of symbolic links. + * + * @param allowLinking true if symbolic links are allowed. + */ +void setAllowLinking(boolean allowLinking); + +/** + * Determine if this {@code ResourceSet} allows the use of symbolic links. If {@link #setAllowLinking(boolean)} has + * not been called for this instance, the value of {@link WebResourceRoot#getAllowLinking()} is returned. + * + * @return true if symbolic links are allowed + */ +boolean getAllowLinking(); } diff --git a/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java b/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java index 516771c441..e9379c01e2 100644 --- a/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java +++ b/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java @@ -293,6 +293,25 @@ public abstract class AbstractArchiveResourceSet extends AbstractResourceSet { throw new IllegalArgumentException(sm.getString("abstractArchiveResourceSet.setReadOnlyFalse")); } +/** + * {@inheritDoc} + * + * Calls to this method will be ignored as archives do not allow linking. + */ +@Override +public void setAllowLinking(boolean allowLinking) { +} + +/** + * {@inheritDoc} + * + * Calls to this method always return {@code false} as archives do not allow linking. + */ +@Override +public boolean getAllowLinking() { +return false; +} + @SuppressWarnings("deprecation") protected JarFile openJarFile() throws IOException { synchronized (archiveLock) { diff --git a/java/org/apache/catalina/webresources/AbstractFileResourceSet.java b/java/org/apache/catalina/webresources/AbstractFileResourceSet.java index 3e89394531..e2619bc079 100644 --- a/java/org/apache/catalina/webresources/AbstractFileResourceSet.java +++ b/java/org/apache/cat
(tomcat) branch 9.0.x updated: Fix BZ 69588 - enable allowLinking to be configured per ResourceSet
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 c4ee2a0153 Fix BZ 69588 - enable allowLinking to be configured per ResourceSet c4ee2a0153 is described below commit c4ee2a0153ebb4b4e8aca465745ba46cd4ca50a5 Author: Mark Thomas AuthorDate: Thu Apr 10 14:57:23 2025 +0100 Fix BZ 69588 - enable allowLinking to be configured per ResourceSet https://bz.apache.org/bugzilla/show_bug.cgi?id=69588 --- java/org/apache/catalina/WebResourceRoot.java | 8 ++-- java/org/apache/catalina/WebResourceSet.java | 15 +++ .../webresources/AbstractArchiveResourceSet.java | 19 +++ .../webresources/AbstractFileResourceSet.java | 16 +++- .../apache/catalina/webresources/DirResourceSet.java | 2 +- .../catalina/webresources/EmptyResourceSet.java | 19 +++ webapps/docs/changelog.xml| 6 ++ webapps/docs/config/resources.xml | 13 + 8 files changed, 94 insertions(+), 4 deletions(-) diff --git a/java/org/apache/catalina/WebResourceRoot.java b/java/org/apache/catalina/WebResourceRoot.java index e473d53a06..5ad9d66986 100644 --- a/java/org/apache/catalina/WebResourceRoot.java +++ b/java/org/apache/catalina/WebResourceRoot.java @@ -21,6 +21,8 @@ import java.net.URL; import java.util.List; import java.util.Set; +import org.apache.catalina.util.ResourceSet; + /** * Represents the complete set of resources for a web application. The resources for a web application consist of * multiple ResourceSets and when looking for a Resource, the ResourceSets are processed in the following order: @@ -246,14 +248,16 @@ public interface WebResourceRoot extends Lifecycle { void setContext(Context context); /** - * Configure if this resources allow the use of symbolic links. + * Configure if this web application allows the use of symbolic links by default. Individual {@link ResourceSet}s + * may override this setting. * * @param allowLinking true if symbolic links are allowed. */ void setAllowLinking(boolean allowLinking); /** - * Determine if this resources allow the use of symbolic links. + * Determine if this web application allows the use of symbolic links by default. Individual {@link ResourceSet}s + * may override this setting. * * @return true if symbolic links are allowed */ diff --git a/java/org/apache/catalina/WebResourceSet.java b/java/org/apache/catalina/WebResourceSet.java index 1d2729cfea..231434f9b6 100644 --- a/java/org/apache/catalina/WebResourceSet.java +++ b/java/org/apache/catalina/WebResourceSet.java @@ -135,4 +135,19 @@ public interface WebResourceSet extends Lifecycle { * resources. */ void gc(); + +/** + * Configure if this {@code ResourceSet} allows the use of symbolic links. + * + * @param allowLinking true if symbolic links are allowed. + */ +void setAllowLinking(boolean allowLinking); + +/** + * Determine if this {@code ResourceSet} allows the use of symbolic links. If {@link #setAllowLinking(boolean)} has + * not been called for this instance, the value of {@link WebResourceRoot#getAllowLinking()} is returned. + * + * @return true if symbolic links are allowed + */ +boolean getAllowLinking(); } diff --git a/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java b/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java index b055c157fe..f78a45888f 100644 --- a/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java +++ b/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java @@ -293,6 +293,25 @@ public abstract class AbstractArchiveResourceSet extends AbstractResourceSet { throw new IllegalArgumentException(sm.getString("abstractArchiveResourceSet.setReadOnlyFalse")); } +/** + * {@inheritDoc} + * + * Calls to this method will be ignored as archives do not allow linking. + */ +@Override +public void setAllowLinking(boolean allowLinking) { +} + +/** + * {@inheritDoc} + * + * Calls to this method always return {@code false} as archives do not allow linking. + */ +@Override +public boolean getAllowLinking() { +return false; +} + @SuppressWarnings("deprecation") protected JarFile openJarFile() throws IOException { synchronized (archiveLock) { diff --git a/java/org/apache/catalina/webresources/AbstractFileResourceSet.java b/java/org/apache/catalina/webresources/AbstractFileResourceSet.java index 3e89394531..e2619bc079 100644 --- a/java/org/apache/catalina/webresources/AbstractFileResourceSet.java +++ b/java/org/apache/catal
(tomcat) branch 9.0.x updated: Move BZ 69633 entry to correct version
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 36aeb5f715 Move BZ 69633 entry to correct version 36aeb5f715 is described below commit 36aeb5f715679670597de392f529e62f07138f88 Author: Mark Thomas AuthorDate: Thu Apr 10 10:28:29 2025 +0100 Move BZ 69633 entry to correct version --- webapps/docs/changelog.xml | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index eb49ce56aa..3e7297f8a1 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -105,6 +105,14 @@ issues do not "pop up" wrt. others). --> + + + +69633: Add support for Filters using context root mappings. +(markt) + + + @@ -128,10 +136,6 @@ Process possible path parameters rewrite production in the rewrite valve. (remm) - -69633: Add support for Filters using context root mappings. -(markt) - 69643: Optimize directory listing for large amount of files. Patch submitted by Loic de l'Eprevier. (remm) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 69633] Filters mapped to "" are not applied to empty string ("") special URL pattern
https://bz.apache.org/bugzilla/show_bug.cgi?id=69633 Mark Thomas changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #4 from Mark Thomas --- Fixed in: - 11.0.x for 11.0.7 onwards - 10.1.x for 10.1.41 onwards - 9.0.x for 9.0.105 onwards -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 69631] java.nio.channels.WritePendingException when using https-openssl-nio2 and virtual threads
https://bz.apache.org/bugzilla/show_bug.cgi?id=69631 --- Comment #5 from Mark Thomas --- Just a reminder that without sufficient information provided that enables this issue to be reproduced, this issue will eventually be resolved as WORKSFORME. Given you can reproduce the issue, a few things to try include that might help narrow things down: - can you reproduce the issue with a clean Tomcat install and the ROOT and/or examples web application? - do you see the same issue with different JVM vendors/versions - which operating system is being used? -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) branch main updated: Fix BZ 69633 - Add context root mapping support got filters
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 a05bb235ae Fix BZ 69633 - Add context root mapping support got filters a05bb235ae is described below commit a05bb235aeb962aea786e2537ed199b0682ada7f Author: Mark Thomas AuthorDate: Thu Apr 10 10:24:02 2025 +0100 Fix BZ 69633 - Add context root mapping support got filters https://bz.apache.org/bugzilla/show_bug.cgi?id=69633 --- java/org/apache/catalina/util/FilterUtil.java | 12 ++- test/org/apache/catalina/util/TestFilterUtil.java | 121 ++ webapps/docs/changelog.xml| 4 + 3 files changed, 136 insertions(+), 1 deletion(-) diff --git a/java/org/apache/catalina/util/FilterUtil.java b/java/org/apache/catalina/util/FilterUtil.java index 0504c95a5e..1395be1b7f 100644 --- a/java/org/apache/catalina/util/FilterUtil.java +++ b/java/org/apache/catalina/util/FilterUtil.java @@ -79,6 +79,11 @@ public class FilterUtil { return false; } +/* + * Note: Order does not matter here in terms of specification compliance because this is Filter mapping. If any + * rule matches then this method returns true. Order would matter if this was Servlet mapping. + */ + // Case 1 - Exact Match if (testPath.equals(requestPath)) { return true; @@ -109,7 +114,12 @@ public class FilterUtil { } } -// Case 4 - "Default" Match +// Case 4 - Context Root +if (testPath.isEmpty() && requestPath.equals("/")) { +return true; +} + +// Case 5 - "Default" Match return false; // NOTE - Not relevant for selecting filters } diff --git a/test/org/apache/catalina/util/TestFilterUtil.java b/test/org/apache/catalina/util/TestFilterUtil.java new file mode 100644 index 00..3af9c409a6 --- /dev/null +++ b/test/org/apache/catalina/util/TestFilterUtil.java @@ -0,0 +1,121 @@ +/* + * 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.catalina.util; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.concurrent.atomic.AtomicInteger; + +import jakarta.servlet.FilterChain; +import jakarta.servlet.GenericFilter; +import jakarta.servlet.GenericServlet; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletResponse; + +import org.junit.Assert; +import org.junit.Test; + +import org.apache.catalina.Context; +import org.apache.catalina.Wrapper; +import org.apache.catalina.startup.Tomcat; +import org.apache.catalina.startup.TomcatBaseTest; +import org.apache.tomcat.util.buf.ByteChunk; +import org.apache.tomcat.util.descriptor.web.FilterDef; +import org.apache.tomcat.util.descriptor.web.FilterMap; + +public class TestFilterUtil extends TomcatBaseTest { + +@Test +public void testContextRootMappedFilter() throws Exception { +// Setup Tomcat instance +Tomcat tomcat = getTomcatInstance(); + +// No file system docBase required +Context ctx = getProgrammaticRootContext(); + +CountingFilter countingFilter = new CountingFilter(); + +FilterDef fd = new FilterDef(); +fd.setFilter(countingFilter); +fd.setFilterName("CountingFilter"); + +FilterMap fm = new FilterMap(); +fm.setFilterName(fd.getFilterName()); +fm.addURLPattern(""); + +ctx.addFilterDef(fd); +ctx.addFilterMap(fm); + +Wrapper w = tomcat.addServlet("", "Default", new DefaultServlet()); +w.addMapping("/"); + +tomcat.start(); + +ByteChunk bc = new ByteChunk(); +int rc; + +Assert.assertEquals(0, countingFilter.getCount()); + +rc = getUrl("http://localhost:"; + getPort(), bc, false); +Assert.assertEquals(HttpServletResponse.SC_OK, rc); +Assert.assertEquals(1, countingFilter.getCount()); + +rc = getUrl("http://localhost:"; + getPort() + "
(tomcat) branch 11.0.x updated: Fix BZ 69633 - Add context root mapping support got filters
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 11.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/11.0.x by this push: new 171a58e3ab Fix BZ 69633 - Add context root mapping support got filters 171a58e3ab is described below commit 171a58e3ab57388f4b4e8b5dfe48ea858102d23c Author: Mark Thomas AuthorDate: Thu Apr 10 10:24:02 2025 +0100 Fix BZ 69633 - Add context root mapping support got filters https://bz.apache.org/bugzilla/show_bug.cgi?id=69633 --- java/org/apache/catalina/util/FilterUtil.java | 12 ++- test/org/apache/catalina/util/TestFilterUtil.java | 121 ++ webapps/docs/changelog.xml| 4 + 3 files changed, 136 insertions(+), 1 deletion(-) diff --git a/java/org/apache/catalina/util/FilterUtil.java b/java/org/apache/catalina/util/FilterUtil.java index 0504c95a5e..1395be1b7f 100644 --- a/java/org/apache/catalina/util/FilterUtil.java +++ b/java/org/apache/catalina/util/FilterUtil.java @@ -79,6 +79,11 @@ public class FilterUtil { return false; } +/* + * Note: Order does not matter here in terms of specification compliance because this is Filter mapping. If any + * rule matches then this method returns true. Order would matter if this was Servlet mapping. + */ + // Case 1 - Exact Match if (testPath.equals(requestPath)) { return true; @@ -109,7 +114,12 @@ public class FilterUtil { } } -// Case 4 - "Default" Match +// Case 4 - Context Root +if (testPath.isEmpty() && requestPath.equals("/")) { +return true; +} + +// Case 5 - "Default" Match return false; // NOTE - Not relevant for selecting filters } diff --git a/test/org/apache/catalina/util/TestFilterUtil.java b/test/org/apache/catalina/util/TestFilterUtil.java new file mode 100644 index 00..3af9c409a6 --- /dev/null +++ b/test/org/apache/catalina/util/TestFilterUtil.java @@ -0,0 +1,121 @@ +/* + * 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.catalina.util; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.concurrent.atomic.AtomicInteger; + +import jakarta.servlet.FilterChain; +import jakarta.servlet.GenericFilter; +import jakarta.servlet.GenericServlet; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletResponse; + +import org.junit.Assert; +import org.junit.Test; + +import org.apache.catalina.Context; +import org.apache.catalina.Wrapper; +import org.apache.catalina.startup.Tomcat; +import org.apache.catalina.startup.TomcatBaseTest; +import org.apache.tomcat.util.buf.ByteChunk; +import org.apache.tomcat.util.descriptor.web.FilterDef; +import org.apache.tomcat.util.descriptor.web.FilterMap; + +public class TestFilterUtil extends TomcatBaseTest { + +@Test +public void testContextRootMappedFilter() throws Exception { +// Setup Tomcat instance +Tomcat tomcat = getTomcatInstance(); + +// No file system docBase required +Context ctx = getProgrammaticRootContext(); + +CountingFilter countingFilter = new CountingFilter(); + +FilterDef fd = new FilterDef(); +fd.setFilter(countingFilter); +fd.setFilterName("CountingFilter"); + +FilterMap fm = new FilterMap(); +fm.setFilterName(fd.getFilterName()); +fm.addURLPattern(""); + +ctx.addFilterDef(fd); +ctx.addFilterMap(fm); + +Wrapper w = tomcat.addServlet("", "Default", new DefaultServlet()); +w.addMapping("/"); + +tomcat.start(); + +ByteChunk bc = new ByteChunk(); +int rc; + +Assert.assertEquals(0, countingFilter.getCount()); + +rc = getUrl("http://localhost:"; + getPort(), bc, false); +Assert.assertEquals(HttpServletResponse.SC_OK, rc); +Assert.assertEquals(1, countingFilter.getCount()); + +rc = getUrl("http://localhost:"; + getPort()
(tomcat) branch 9.0.x updated: Fix BZ 69633 - Add context root mapping support got filters
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 2ded0810d5 Fix BZ 69633 - Add context root mapping support got filters 2ded0810d5 is described below commit 2ded0810d55afc1c31dc62a91290f8a35a72c6c5 Author: Mark Thomas AuthorDate: Thu Apr 10 10:24:02 2025 +0100 Fix BZ 69633 - Add context root mapping support got filters https://bz.apache.org/bugzilla/show_bug.cgi?id=69633 --- java/org/apache/catalina/util/FilterUtil.java | 12 ++- test/org/apache/catalina/util/TestFilterUtil.java | 121 ++ webapps/docs/changelog.xml| 4 + 3 files changed, 136 insertions(+), 1 deletion(-) diff --git a/java/org/apache/catalina/util/FilterUtil.java b/java/org/apache/catalina/util/FilterUtil.java index 9d5833d015..58f119078c 100644 --- a/java/org/apache/catalina/util/FilterUtil.java +++ b/java/org/apache/catalina/util/FilterUtil.java @@ -79,6 +79,11 @@ public class FilterUtil { return false; } +/* + * Note: Order does not matter here in terms of specification compliance because this is Filter mapping. If any + * rule matches then this method returns true. Order would matter if this was Servlet mapping. + */ + // Case 1 - Exact Match if (testPath.equals(requestPath)) { return true; @@ -109,7 +114,12 @@ public class FilterUtil { } } -// Case 4 - "Default" Match +// Case 4 - Context Root +if (testPath.isEmpty() && requestPath.equals("/")) { +return true; +} + +// Case 5 - "Default" Match return false; // NOTE - Not relevant for selecting filters } diff --git a/test/org/apache/catalina/util/TestFilterUtil.java b/test/org/apache/catalina/util/TestFilterUtil.java new file mode 100644 index 00..3af9c409a6 --- /dev/null +++ b/test/org/apache/catalina/util/TestFilterUtil.java @@ -0,0 +1,121 @@ +/* + * 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.catalina.util; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.concurrent.atomic.AtomicInteger; + +import jakarta.servlet.FilterChain; +import jakarta.servlet.GenericFilter; +import jakarta.servlet.GenericServlet; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletResponse; + +import org.junit.Assert; +import org.junit.Test; + +import org.apache.catalina.Context; +import org.apache.catalina.Wrapper; +import org.apache.catalina.startup.Tomcat; +import org.apache.catalina.startup.TomcatBaseTest; +import org.apache.tomcat.util.buf.ByteChunk; +import org.apache.tomcat.util.descriptor.web.FilterDef; +import org.apache.tomcat.util.descriptor.web.FilterMap; + +public class TestFilterUtil extends TomcatBaseTest { + +@Test +public void testContextRootMappedFilter() throws Exception { +// Setup Tomcat instance +Tomcat tomcat = getTomcatInstance(); + +// No file system docBase required +Context ctx = getProgrammaticRootContext(); + +CountingFilter countingFilter = new CountingFilter(); + +FilterDef fd = new FilterDef(); +fd.setFilter(countingFilter); +fd.setFilterName("CountingFilter"); + +FilterMap fm = new FilterMap(); +fm.setFilterName(fd.getFilterName()); +fm.addURLPattern(""); + +ctx.addFilterDef(fd); +ctx.addFilterMap(fm); + +Wrapper w = tomcat.addServlet("", "Default", new DefaultServlet()); +w.addMapping("/"); + +tomcat.start(); + +ByteChunk bc = new ByteChunk(); +int rc; + +Assert.assertEquals(0, countingFilter.getCount()); + +rc = getUrl("http://localhost:"; + getPort(), bc, false); +Assert.assertEquals(HttpServletResponse.SC_OK, rc); +Assert.assertEquals(1, countingFilter.getCount()); + +rc = getUrl("http://localhost:"; + getPort() +
(tomcat) branch 10.1.x updated: Fix BZ 69633 - Add context root mapping support got filters
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 58fb25eade Fix BZ 69633 - Add context root mapping support got filters 58fb25eade is described below commit 58fb25eade0c5fa962973b08297d6462550b5877 Author: Mark Thomas AuthorDate: Thu Apr 10 10:24:02 2025 +0100 Fix BZ 69633 - Add context root mapping support got filters https://bz.apache.org/bugzilla/show_bug.cgi?id=69633 --- java/org/apache/catalina/util/FilterUtil.java | 12 ++- test/org/apache/catalina/util/TestFilterUtil.java | 121 ++ webapps/docs/changelog.xml| 4 + 3 files changed, 136 insertions(+), 1 deletion(-) diff --git a/java/org/apache/catalina/util/FilterUtil.java b/java/org/apache/catalina/util/FilterUtil.java index 0504c95a5e..1395be1b7f 100644 --- a/java/org/apache/catalina/util/FilterUtil.java +++ b/java/org/apache/catalina/util/FilterUtil.java @@ -79,6 +79,11 @@ public class FilterUtil { return false; } +/* + * Note: Order does not matter here in terms of specification compliance because this is Filter mapping. If any + * rule matches then this method returns true. Order would matter if this was Servlet mapping. + */ + // Case 1 - Exact Match if (testPath.equals(requestPath)) { return true; @@ -109,7 +114,12 @@ public class FilterUtil { } } -// Case 4 - "Default" Match +// Case 4 - Context Root +if (testPath.isEmpty() && requestPath.equals("/")) { +return true; +} + +// Case 5 - "Default" Match return false; // NOTE - Not relevant for selecting filters } diff --git a/test/org/apache/catalina/util/TestFilterUtil.java b/test/org/apache/catalina/util/TestFilterUtil.java new file mode 100644 index 00..3af9c409a6 --- /dev/null +++ b/test/org/apache/catalina/util/TestFilterUtil.java @@ -0,0 +1,121 @@ +/* + * 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.catalina.util; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.concurrent.atomic.AtomicInteger; + +import jakarta.servlet.FilterChain; +import jakarta.servlet.GenericFilter; +import jakarta.servlet.GenericServlet; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletResponse; + +import org.junit.Assert; +import org.junit.Test; + +import org.apache.catalina.Context; +import org.apache.catalina.Wrapper; +import org.apache.catalina.startup.Tomcat; +import org.apache.catalina.startup.TomcatBaseTest; +import org.apache.tomcat.util.buf.ByteChunk; +import org.apache.tomcat.util.descriptor.web.FilterDef; +import org.apache.tomcat.util.descriptor.web.FilterMap; + +public class TestFilterUtil extends TomcatBaseTest { + +@Test +public void testContextRootMappedFilter() throws Exception { +// Setup Tomcat instance +Tomcat tomcat = getTomcatInstance(); + +// No file system docBase required +Context ctx = getProgrammaticRootContext(); + +CountingFilter countingFilter = new CountingFilter(); + +FilterDef fd = new FilterDef(); +fd.setFilter(countingFilter); +fd.setFilterName("CountingFilter"); + +FilterMap fm = new FilterMap(); +fm.setFilterName(fd.getFilterName()); +fm.addURLPattern(""); + +ctx.addFilterDef(fd); +ctx.addFilterMap(fm); + +Wrapper w = tomcat.addServlet("", "Default", new DefaultServlet()); +w.addMapping("/"); + +tomcat.start(); + +ByteChunk bc = new ByteChunk(); +int rc; + +Assert.assertEquals(0, countingFilter.getCount()); + +rc = getUrl("http://localhost:"; + getPort(), bc, false); +Assert.assertEquals(HttpServletResponse.SC_OK, rc); +Assert.assertEquals(1, countingFilter.getCount()); + +rc = getUrl("http://localhost:"; + getPort()
(tomcat) branch 9.0.x updated: Fix backport
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 cf9497b5a9 Fix backport cf9497b5a9 is described below commit cf9497b5a99c0a3efdacb130b8045b99ff77856b Author: Mark Thomas AuthorDate: Thu Apr 10 11:26:19 2025 +0100 Fix backport --- test/org/apache/catalina/util/TestFilterUtil.java | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/test/org/apache/catalina/util/TestFilterUtil.java b/test/org/apache/catalina/util/TestFilterUtil.java index 3af9c409a6..3a56fd5757 100644 --- a/test/org/apache/catalina/util/TestFilterUtil.java +++ b/test/org/apache/catalina/util/TestFilterUtil.java @@ -17,16 +17,15 @@ package org.apache.catalina.util; import java.io.IOException; -import java.nio.charset.StandardCharsets; import java.util.concurrent.atomic.AtomicInteger; -import jakarta.servlet.FilterChain; -import jakarta.servlet.GenericFilter; -import jakarta.servlet.GenericServlet; -import jakarta.servlet.ServletException; -import jakarta.servlet.ServletRequest; -import jakarta.servlet.ServletResponse; -import jakarta.servlet.http.HttpServletResponse; +import javax.servlet.FilterChain; +import javax.servlet.GenericFilter; +import javax.servlet.GenericServlet; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletResponse; import org.junit.Assert; import org.junit.Test; @@ -114,7 +113,7 @@ public class TestFilterUtil extends TomcatBaseTest { @Override public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException { res.setContentType("text/plain"); -res.setCharacterEncoding(StandardCharsets.UTF_8); +res.setCharacterEncoding("UTF-8"); res.getWriter().print("OK"); } } - 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 backport
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 87949a3b27 Fix backport 87949a3b27 is described below commit 87949a3b271080d0746b372231d9aee0375570fd Author: Mark Thomas AuthorDate: Thu Apr 10 11:33:05 2025 +0100 Fix backport --- test/org/apache/catalina/util/TestFilterUtil.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/org/apache/catalina/util/TestFilterUtil.java b/test/org/apache/catalina/util/TestFilterUtil.java index 3af9c409a6..f257525fab 100644 --- a/test/org/apache/catalina/util/TestFilterUtil.java +++ b/test/org/apache/catalina/util/TestFilterUtil.java @@ -17,7 +17,6 @@ package org.apache.catalina.util; import java.io.IOException; -import java.nio.charset.StandardCharsets; import java.util.concurrent.atomic.AtomicInteger; import jakarta.servlet.FilterChain; @@ -114,7 +113,7 @@ public class TestFilterUtil extends TomcatBaseTest { @Override public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException { res.setContentType("text/plain"); -res.setCharacterEncoding(StandardCharsets.UTF_8); +res.setCharacterEncoding("UTF-8"); res.getWriter().print("OK"); } } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: [PR] Adding nonstandard support for c:set and c:remove [tomcat]
funkman commented on PR #842: URL: https://github.com/apache/tomcat/pull/842#issuecomment-2794610781 While only targeting `c:set/c:remove` - Do you also need to check the tag belongs to `http://java.sun.com/jsp/jstl/core` ? I suspect the user wouldn't enable the flag then use a different library with the same tag names, but it seems like a possible weird outcome -- 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
[ANN] Apache Tomcat 10.1.40 Available
The Apache Tomcat team announces the immediate availability of Apache Tomcat 10.1.40. Apache Tomcat 10 is an open source software implementation of the Jakarta Servlet, Jakarta Pages, Jakarta Expression Language, Jakarta WebSocket, Jakarta Authentication and Jakarta Annotations specifications. Applications that run on Tomcat 9 and earlier will not run on Tomcat 10 without changes. Java EE applications designed for Tomcat 9 and earlier may be placed in the /webapps-javaee directory and Tomcat will automatically convert them to Jakarta EE and copy them to the webapps directory. This conversion is performed using the Apache Tomcat migration tool for Jakarta EE tool which is also available as a separate download for off-line use. Apache Tomcat 10.1.40 is a bugfix and feature release. The notable changes compared to 10.1.39 include: - Remove the requirement that an MD5 implementation must be provided by JRE. - Improve the handling of %nn URL encoding in the RewriteValve - Various improvements to the JsonErrorReportValve Please refer to the change log for the complete list of changes: http://tomcat.apache.org/tomcat-10.1-doc/changelog.html Downloads: http://tomcat.apache.org/download-10.cgi Migration guides from Apache Tomcat 8.5.x and 9.0.x: http://tomcat.apache.org/migration.html Enjoy! - The Apache Tomcat team - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: [PR] Adding nonstandard support for c:set and c:remove [tomcat]
jengebr commented on PR #842: URL: https://github.com/apache/tomcat/pull/842#issuecomment-2794646560 > While only targeting `c:set/c:remove` - Do you also need to check the tag belongs to `http://java.sun.com/jsp/jstl/core` ? I suspect the user wouldn't enable the flag then use a different library with the same tag names, but it seems like a possible weird outcome Great suggestion, thank you. Edge cases are a big concern so please keep them coming! -- 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
Re: Generation javadoc in a specific locale
I have observed similar and applied a general fix for the Maven Javadoc Plugin: https://github.com/apache/maven-javadoc-plugin/pull/298/files - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org