[Bug 69664] Mime type for video/mp2t is missing in default web.xml

2025-04-29 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=69664

--- Comment #1 from Sebastian Lövdahl  ---
PR: https://github.com/apache/tomcat/pull/848

-- 
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 69663] New: OPG Mobility – Reliable EV Charging Solutions for Homes and Businesses

2025-04-29 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=69663

Bug ID: 69663
   Summary: OPG Mobility – Reliable EV Charging Solutions for
Homes and Businesses
   Product: Tomcat 9
   Version: 9.0.104
  Hardware: PC
Status: NEW
  Severity: normal
  Priority: P2
 Component: Examples
  Assignee: dev@tomcat.apache.org
  Reporter: opgmobili...@gmail.com
  Target Milestone: -

Discover OPG Mobility's cutting-edge electric vehicle charging infrastructure
solutions. From residential to commercial applications, we provide reliable and
efficient EV charging products and services to meet your needs. Explore the
future of mobility with the Best Electric Scooter in India 2025 and charge it
smarter with OPG Mobility.

website : https://opgmobility.com/

-- 
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 69664] New: Mime type for video/mp2t is missing in default web.xml

2025-04-29 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=69664

Bug ID: 69664
   Summary: Mime type for video/mp2t is missing in default web.xml
   Product: Tomcat 9
   Version: 9.0.x
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: Packaging
  Assignee: dev@tomcat.apache.org
  Reporter: sebastian.lovd...@hibox.tv
  Target Milestone: -

-- 
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 69659] Automatic JSP EL optimization

2025-04-29 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=69659

--- Comment #4 from John Engebretson  ---
Created attachment 40030
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=40030&action=edit
Unit test demonstrating current null behavior

Certainly - demonstration JSP attached.

-- 
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: Refactor CGI servlet to access resources via WebResources

2025-04-29 Thread markt
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 4eb32998e9 Refactor CGI servlet to access resources via WebResources
4eb32998e9 is described below

commit 4eb32998e96e44eb6157d21d0dc727fce38c0bdc
Author: Mark Thomas 
AuthorDate: Mon Apr 28 12:58:21 2025 +0100

Refactor CGI servlet to access resources via WebResources
---
 java/org/apache/catalina/servlets/CGIServlet.java  | 233 -
 .../catalina/servlets/LocalStrings.properties  |   1 -
 .../catalina/servlets/LocalStrings_fr.properties   |   1 -
 .../catalina/servlets/LocalStrings_ja.properties   |   1 -
 .../catalina/servlets/LocalStrings_ko.properties   |   1 -
 .../servlets/LocalStrings_zh_CN.properties |   1 -
 6 files changed, 93 insertions(+), 145 deletions(-)

diff --git a/java/org/apache/catalina/servlets/CGIServlet.java 
b/java/org/apache/catalina/servlets/CGIServlet.java
index 510d2782e7..db03ae1955 100644
--- a/java/org/apache/catalina/servlets/CGIServlet.java
+++ b/java/org/apache/catalina/servlets/CGIServlet.java
@@ -25,6 +25,8 @@ import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.io.Serial;
 import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
 import java.net.URLDecoder;
 import java.nio.file.Files;
 import java.util.ArrayList;
@@ -628,9 +630,6 @@ public final class CGIServlet extends HttpServlet {
 /** pathInfo for the current request */
 private String pathInfo = null;
 
-/** real file system directory of the enclosing servlet's web app */
-private String webAppRootDir = null;
-
 /** tempdir for context - used to expand scripts in unexpanded wars */
 private File tmpDir = null;
 
@@ -684,7 +683,6 @@ public final class CGIServlet extends HttpServlet {
  */
 protected void setupFromContext(ServletContext context) {
 this.context = context;
-this.webAppRootDir = context.getRealPath("/");
 this.tmpDir = (File) context.getAttribute(ServletContext.TEMPDIR);
 }
 
@@ -788,10 +786,9 @@ public final class CGIServlet extends HttpServlet {
  * cgiPathPrefix is defined by setting this servlet's cgiPathPrefix 
init parameter
  * 
  *
- * @param pathInfo  String from HttpServletRequest.getPathInfo()
- * @param webAppRootDir String from context.getRealPath("/")
  * @param contextPath   String as from 
HttpServletRequest.getContextPath()
  * @param servletPath   String as from 
HttpServletRequest.getServletPath()
+ * @param pathInfo  String from HttpServletRequest.getPathInfo()
  * @param cgiPathPrefix subdirectory of webAppRootDir below which the 
web app's CGIs may be stored; can be null.
  *  The CGI search path will start at 
webAppRootDir + File.separator + cgiPathPrefix (or
  *  webAppRootDir alone if cgiPathPrefix is 
null). cgiPathPrefix is defined by setting
@@ -808,59 +805,108 @@ public final class CGIServlet extends HttpServlet {
  * found
  * 
  */
-protected String[] findCGI(String pathInfo, String webAppRootDir, 
String contextPath, String servletPath,
-String cgiPathPrefix) {
-String path;
-String name;
-String scriptname;
-
-if (webAppRootDir.lastIndexOf(File.separator) == 
(webAppRootDir.length() - 1)) {
-// strip the trailing "/" from the webAppRootDir
-webAppRootDir = webAppRootDir.substring(0, 
(webAppRootDir.length() - 1));
-}
+protected String[] findCGI(String contextPath, String servletPath, 
String pathInfo, String cgiPathPrefix) {
 
-if (cgiPathPrefix != null) {
-webAppRootDir = webAppRootDir + File.separator + cgiPathPrefix;
-}
+StringBuilder cgiPath = new StringBuilder();
+StringBuilder urlPath = new StringBuilder();
 
-if (log.isTraceEnabled()) {
-log.trace(sm.getString("cgiServlet.find.path", pathInfo, 
webAppRootDir));
-}
+URL cgiScriptURL = null;
 
-File currentLocation = new File(webAppRootDir);
-StringTokenizer dirWalker = new StringTokenizer(pathInfo, "/");
-if (log.isTraceEnabled()) {
-log.trace(sm.getString("cgiServlet.find.location", 
currentLocation.getAbsolutePath()));
+if (cgiPathPrefix == null || cgiPathPrefix.isEmpty()) {
+cgiPath.append(servletPath);
+} else {
+cgiPath.append('/');
+cgiPath.append(cgiPathPrefix);
 }
-StringBuilder cg

(tomcat) branch main updated: Update change log

2025-04-29 Thread markt
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 ecb7cd35ac Update change log
ecb7cd35ac is described below

commit ecb7cd35acad3c62fb8ed434da0d8be4dd7428ae
Author: Mark Thomas 
AuthorDate: Tue Apr 29 08:44:12 2025 +0100

Update change log
---
 webapps/docs/changelog.xml | 4 
 1 file changed, 4 insertions(+)

diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 0a1308f3d5..3f7d12e5ad 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -179,6 +179,10 @@
 843: Fix off by one validation logic for partial PUT ranges
 and associated test case. Submitted by Chenjp. (remm)
   
+  
+Refactor GCI servlet to access resources via the
+WebResource API. (markt)
+  
 
   
   


-
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: Refactor CGI servlet to access resources via WebResources

2025-04-29 Thread markt
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 fab7247d2f Refactor CGI servlet to access resources via WebResources
fab7247d2f is described below

commit fab7247d2f0e3a29d5daef565f829f383e10e5e2
Author: Mark Thomas 
AuthorDate: Mon Apr 28 12:58:21 2025 +0100

Refactor CGI servlet to access resources via WebResources
---
 java/org/apache/catalina/servlets/CGIServlet.java  | 233 -
 .../catalina/servlets/LocalStrings.properties  |   1 -
 .../catalina/servlets/LocalStrings_fr.properties   |   1 -
 .../catalina/servlets/LocalStrings_ja.properties   |   1 -
 .../catalina/servlets/LocalStrings_ko.properties   |   1 -
 .../servlets/LocalStrings_zh_CN.properties |   1 -
 webapps/docs/changelog.xml |   4 +
 7 files changed, 97 insertions(+), 145 deletions(-)

diff --git a/java/org/apache/catalina/servlets/CGIServlet.java 
b/java/org/apache/catalina/servlets/CGIServlet.java
index 510d2782e7..db03ae1955 100644
--- a/java/org/apache/catalina/servlets/CGIServlet.java
+++ b/java/org/apache/catalina/servlets/CGIServlet.java
@@ -25,6 +25,8 @@ import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.io.Serial;
 import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
 import java.net.URLDecoder;
 import java.nio.file.Files;
 import java.util.ArrayList;
@@ -628,9 +630,6 @@ public final class CGIServlet extends HttpServlet {
 /** pathInfo for the current request */
 private String pathInfo = null;
 
-/** real file system directory of the enclosing servlet's web app */
-private String webAppRootDir = null;
-
 /** tempdir for context - used to expand scripts in unexpanded wars */
 private File tmpDir = null;
 
@@ -684,7 +683,6 @@ public final class CGIServlet extends HttpServlet {
  */
 protected void setupFromContext(ServletContext context) {
 this.context = context;
-this.webAppRootDir = context.getRealPath("/");
 this.tmpDir = (File) context.getAttribute(ServletContext.TEMPDIR);
 }
 
@@ -788,10 +786,9 @@ public final class CGIServlet extends HttpServlet {
  * cgiPathPrefix is defined by setting this servlet's cgiPathPrefix 
init parameter
  * 
  *
- * @param pathInfo  String from HttpServletRequest.getPathInfo()
- * @param webAppRootDir String from context.getRealPath("/")
  * @param contextPath   String as from 
HttpServletRequest.getContextPath()
  * @param servletPath   String as from 
HttpServletRequest.getServletPath()
+ * @param pathInfo  String from HttpServletRequest.getPathInfo()
  * @param cgiPathPrefix subdirectory of webAppRootDir below which the 
web app's CGIs may be stored; can be null.
  *  The CGI search path will start at 
webAppRootDir + File.separator + cgiPathPrefix (or
  *  webAppRootDir alone if cgiPathPrefix is 
null). cgiPathPrefix is defined by setting
@@ -808,59 +805,108 @@ public final class CGIServlet extends HttpServlet {
  * found
  * 
  */
-protected String[] findCGI(String pathInfo, String webAppRootDir, 
String contextPath, String servletPath,
-String cgiPathPrefix) {
-String path;
-String name;
-String scriptname;
-
-if (webAppRootDir.lastIndexOf(File.separator) == 
(webAppRootDir.length() - 1)) {
-// strip the trailing "/" from the webAppRootDir
-webAppRootDir = webAppRootDir.substring(0, 
(webAppRootDir.length() - 1));
-}
+protected String[] findCGI(String contextPath, String servletPath, 
String pathInfo, String cgiPathPrefix) {
 
-if (cgiPathPrefix != null) {
-webAppRootDir = webAppRootDir + File.separator + cgiPathPrefix;
-}
+StringBuilder cgiPath = new StringBuilder();
+StringBuilder urlPath = new StringBuilder();
 
-if (log.isTraceEnabled()) {
-log.trace(sm.getString("cgiServlet.find.path", pathInfo, 
webAppRootDir));
-}
+URL cgiScriptURL = null;
 
-File currentLocation = new File(webAppRootDir);
-StringTokenizer dirWalker = new StringTokenizer(pathInfo, "/");
-if (log.isTraceEnabled()) {
-log.trace(sm.getString("cgiServlet.find.location", 
currentLocation.getAbsolutePath()));
+if (cgiPathPrefix == null || cgiPathPrefix.isEmpty()) {
+cgiPath.append(servletPath);
+} else {
+cgiPath.append('/');
+cgiPath.app

(tomcat) branch 9.0.x updated: Refactor CGI servlet to access resources via WebResources

2025-04-29 Thread markt
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 8df00018a2 Refactor CGI servlet to access resources via WebResources
8df00018a2 is described below

commit 8df00018a252baa9497615d6420fb6c10466fa74
Author: Mark Thomas 
AuthorDate: Mon Apr 28 12:58:21 2025 +0100

Refactor CGI servlet to access resources via WebResources
---
 java/org/apache/catalina/servlets/CGIServlet.java  | 233 -
 .../catalina/servlets/LocalStrings.properties  |   1 -
 .../catalina/servlets/LocalStrings_fr.properties   |   1 -
 .../catalina/servlets/LocalStrings_ja.properties   |   1 -
 .../catalina/servlets/LocalStrings_ko.properties   |   1 -
 .../servlets/LocalStrings_zh_CN.properties |   1 -
 webapps/docs/changelog.xml |   4 +
 7 files changed, 97 insertions(+), 145 deletions(-)

diff --git a/java/org/apache/catalina/servlets/CGIServlet.java 
b/java/org/apache/catalina/servlets/CGIServlet.java
index 57a9b82c8d..d4af679a55 100644
--- a/java/org/apache/catalina/servlets/CGIServlet.java
+++ b/java/org/apache/catalina/servlets/CGIServlet.java
@@ -24,6 +24,8 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
 import java.net.URLDecoder;
 import java.nio.file.Files;
 import java.util.ArrayList;
@@ -620,9 +622,6 @@ public final class CGIServlet extends HttpServlet {
 /** pathInfo for the current request */
 private String pathInfo = null;
 
-/** real file system directory of the enclosing servlet's web app */
-private String webAppRootDir = null;
-
 /** tempdir for context - used to expand scripts in unexpanded wars */
 private File tmpDir = null;
 
@@ -676,7 +675,6 @@ public final class CGIServlet extends HttpServlet {
  */
 protected void setupFromContext(ServletContext context) {
 this.context = context;
-this.webAppRootDir = context.getRealPath("/");
 this.tmpDir = (File) context.getAttribute(ServletContext.TEMPDIR);
 }
 
@@ -780,10 +778,9 @@ public final class CGIServlet extends HttpServlet {
  * cgiPathPrefix is defined by setting this servlet's cgiPathPrefix 
init parameter
  * 
  *
- * @param pathInfo  String from HttpServletRequest.getPathInfo()
- * @param webAppRootDir String from context.getRealPath("/")
  * @param contextPath   String as from 
HttpServletRequest.getContextPath()
  * @param servletPath   String as from 
HttpServletRequest.getServletPath()
+ * @param pathInfo  String from HttpServletRequest.getPathInfo()
  * @param cgiPathPrefix subdirectory of webAppRootDir below which the 
web app's CGIs may be stored; can be null.
  *  The CGI search path will start at 
webAppRootDir + File.separator + cgiPathPrefix (or
  *  webAppRootDir alone if cgiPathPrefix is 
null). cgiPathPrefix is defined by setting
@@ -800,59 +797,108 @@ public final class CGIServlet extends HttpServlet {
  * found
  * 
  */
-protected String[] findCGI(String pathInfo, String webAppRootDir, 
String contextPath, String servletPath,
-String cgiPathPrefix) {
-String path;
-String name;
-String scriptname;
-
-if (webAppRootDir.lastIndexOf(File.separator) == 
(webAppRootDir.length() - 1)) {
-// strip the trailing "/" from the webAppRootDir
-webAppRootDir = webAppRootDir.substring(0, 
(webAppRootDir.length() - 1));
-}
+protected String[] findCGI(String contextPath, String servletPath, 
String pathInfo, String cgiPathPrefix) {
 
-if (cgiPathPrefix != null) {
-webAppRootDir = webAppRootDir + File.separator + cgiPathPrefix;
-}
+StringBuilder cgiPath = new StringBuilder();
+StringBuilder urlPath = new StringBuilder();
 
-if (log.isTraceEnabled()) {
-log.trace(sm.getString("cgiServlet.find.path", pathInfo, 
webAppRootDir));
-}
+URL cgiScriptURL = null;
 
-File currentLocation = new File(webAppRootDir);
-StringTokenizer dirWalker = new StringTokenizer(pathInfo, "/");
-if (log.isTraceEnabled()) {
-log.trace(sm.getString("cgiServlet.find.location", 
currentLocation.getAbsolutePath()));
+if (cgiPathPrefix == null || cgiPathPrefix.isEmpty()) {
+cgiPath.append(servletPath);
+} else {
+cgiPath.append('/');
+cgiPath.

(tomcat) branch 10.1.x updated: Refactor CGI servlet to access resources via WebResources

2025-04-29 Thread markt
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 2c6800111e Refactor CGI servlet to access resources via WebResources
2c6800111e is described below

commit 2c6800111e7d8d8d5403c07978ea9bff3db5a5a5
Author: Mark Thomas 
AuthorDate: Mon Apr 28 12:58:21 2025 +0100

Refactor CGI servlet to access resources via WebResources
---
 java/org/apache/catalina/servlets/CGIServlet.java  | 233 -
 .../catalina/servlets/LocalStrings.properties  |   1 -
 .../catalina/servlets/LocalStrings_fr.properties   |   1 -
 .../catalina/servlets/LocalStrings_ja.properties   |   1 -
 .../catalina/servlets/LocalStrings_ko.properties   |   1 -
 .../servlets/LocalStrings_zh_CN.properties |   1 -
 webapps/docs/changelog.xml |   4 +
 7 files changed, 97 insertions(+), 145 deletions(-)

diff --git a/java/org/apache/catalina/servlets/CGIServlet.java 
b/java/org/apache/catalina/servlets/CGIServlet.java
index 3c1b7bd6d2..b005d5621e 100644
--- a/java/org/apache/catalina/servlets/CGIServlet.java
+++ b/java/org/apache/catalina/servlets/CGIServlet.java
@@ -24,6 +24,8 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
 import java.net.URLDecoder;
 import java.nio.file.Files;
 import java.util.ArrayList;
@@ -621,9 +623,6 @@ public final class CGIServlet extends HttpServlet {
 /** pathInfo for the current request */
 private String pathInfo = null;
 
-/** real file system directory of the enclosing servlet's web app */
-private String webAppRootDir = null;
-
 /** tempdir for context - used to expand scripts in unexpanded wars */
 private File tmpDir = null;
 
@@ -677,7 +676,6 @@ public final class CGIServlet extends HttpServlet {
  */
 protected void setupFromContext(ServletContext context) {
 this.context = context;
-this.webAppRootDir = context.getRealPath("/");
 this.tmpDir = (File) context.getAttribute(ServletContext.TEMPDIR);
 }
 
@@ -781,10 +779,9 @@ public final class CGIServlet extends HttpServlet {
  * cgiPathPrefix is defined by setting this servlet's cgiPathPrefix 
init parameter
  * 
  *
- * @param pathInfo  String from HttpServletRequest.getPathInfo()
- * @param webAppRootDir String from context.getRealPath("/")
  * @param contextPath   String as from 
HttpServletRequest.getContextPath()
  * @param servletPath   String as from 
HttpServletRequest.getServletPath()
+ * @param pathInfo  String from HttpServletRequest.getPathInfo()
  * @param cgiPathPrefix subdirectory of webAppRootDir below which the 
web app's CGIs may be stored; can be null.
  *  The CGI search path will start at 
webAppRootDir + File.separator + cgiPathPrefix (or
  *  webAppRootDir alone if cgiPathPrefix is 
null). cgiPathPrefix is defined by setting
@@ -801,59 +798,108 @@ public final class CGIServlet extends HttpServlet {
  * found
  * 
  */
-protected String[] findCGI(String pathInfo, String webAppRootDir, 
String contextPath, String servletPath,
-String cgiPathPrefix) {
-String path;
-String name;
-String scriptname;
-
-if (webAppRootDir.lastIndexOf(File.separator) == 
(webAppRootDir.length() - 1)) {
-// strip the trailing "/" from the webAppRootDir
-webAppRootDir = webAppRootDir.substring(0, 
(webAppRootDir.length() - 1));
-}
+protected String[] findCGI(String contextPath, String servletPath, 
String pathInfo, String cgiPathPrefix) {
 
-if (cgiPathPrefix != null) {
-webAppRootDir = webAppRootDir + File.separator + cgiPathPrefix;
-}
+StringBuilder cgiPath = new StringBuilder();
+StringBuilder urlPath = new StringBuilder();
 
-if (log.isTraceEnabled()) {
-log.trace(sm.getString("cgiServlet.find.path", pathInfo, 
webAppRootDir));
-}
+URL cgiScriptURL = null;
 
-File currentLocation = new File(webAppRootDir);
-StringTokenizer dirWalker = new StringTokenizer(pathInfo, "/");
-if (log.isTraceEnabled()) {
-log.trace(sm.getString("cgiServlet.find.location", 
currentLocation.getAbsolutePath()));
+if (cgiPathPrefix == null || cgiPathPrefix.isEmpty()) {
+cgiPath.append(servletPath);
+} else {
+cgiPath.append('/');
+cgiPat

Re: (tomcat) branch 11.0.x updated: Refactor CGI servlet to access resources via WebResources

2025-04-29 Thread Christopher Schultz

Mark,

On 4/29/25 3:50 AM, ma...@apache.org wrote:

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 fab7247d2f Refactor CGI servlet to access resources via WebResources
fab7247d2f is described below

commit fab7247d2f0e3a29d5daef565f829f383e10e5e2
Author: Mark Thomas 
AuthorDate: Mon Apr 28 12:58:21 2025 +0100

 Refactor CGI servlet to access resources via WebResources
---
  java/org/apache/catalina/servlets/CGIServlet.java  | 233 -
  .../catalina/servlets/LocalStrings.properties  |   1 -
  .../catalina/servlets/LocalStrings_fr.properties   |   1 -
  .../catalina/servlets/LocalStrings_ja.properties   |   1 -
  .../catalina/servlets/LocalStrings_ko.properties   |   1 -
  .../servlets/LocalStrings_zh_CN.properties |   1 -
  webapps/docs/changelog.xml |   4 +
  7 files changed, 97 insertions(+), 145 deletions(-)

diff --git a/java/org/apache/catalina/servlets/CGIServlet.java 
b/java/org/apache/catalina/servlets/CGIServlet.java
index 510d2782e7..db03ae1955 100644
--- a/java/org/apache/catalina/servlets/CGIServlet.java
+++ b/java/org/apache/catalina/servlets/CGIServlet.java
@@ -25,6 +25,8 @@ import java.io.InputStreamReader;
  import java.io.OutputStream;
  import java.io.Serial;
  import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
  import java.net.URLDecoder;
  import java.nio.file.Files;
  import java.util.ArrayList;
@@ -628,9 +630,6 @@ public final class CGIServlet extends HttpServlet {
  /** pathInfo for the current request */
  private String pathInfo = null;
  
-/** real file system directory of the enclosing servlet's web app */

-private String webAppRootDir = null;
-
  /** tempdir for context - used to expand scripts in unexpanded wars */
  private File tmpDir = null;
  
@@ -684,7 +683,6 @@ public final class CGIServlet extends HttpServlet {

   */
  protected void setupFromContext(ServletContext context) {
  this.context = context;
-this.webAppRootDir = context.getRealPath("/");
  this.tmpDir = (File) context.getAttribute(ServletContext.TEMPDIR);
  }
  
@@ -788,10 +786,9 @@ public final class CGIServlet extends HttpServlet {

   * cgiPathPrefix is defined by setting this servlet's cgiPathPrefix 
init parameter
   * 
   *
- * @param pathInfo  String from HttpServletRequest.getPathInfo()
- * @param webAppRootDir String from context.getRealPath("/")
   * @param contextPath   String as from 
HttpServletRequest.getContextPath()
   * @param servletPath   String as from 
HttpServletRequest.getServletPath()
+ * @param pathInfo  String from HttpServletRequest.getPathInfo()
   * @param cgiPathPrefix subdirectory of webAppRootDir below which the 
web app's CGIs may be stored; can be null.
   *  The CGI search path will start at 
webAppRootDir + File.separator + cgiPathPrefix (or
   *  webAppRootDir alone if cgiPathPrefix is 
null). cgiPathPrefix is defined by setting
@@ -808,59 +805,108 @@ public final class CGIServlet extends HttpServlet {
   * found
   * 
   */
-protected String[] findCGI(String pathInfo, String webAppRootDir, 
String contextPath, String servletPath,
-String cgiPathPrefix) {
-String path;
-String name;
-String scriptname;
-
-if (webAppRootDir.lastIndexOf(File.separator) == 
(webAppRootDir.length() - 1)) {
-// strip the trailing "/" from the webAppRootDir
-webAppRootDir = webAppRootDir.substring(0, 
(webAppRootDir.length() - 1));
-}
+protected String[] findCGI(String contextPath, String servletPath, 
String pathInfo, String cgiPathPrefix) {


I know it wasn't your goal to clean any of this up, but I think a custom 
class would be better for this application than String[].


Any objections to be re-factoring this to use a new class?

  
-if (cgiPathPrefix != null) {

-webAppRootDir = webAppRootDir + File.separator + cgiPathPrefix;
-}
+StringBuilder cgiPath = new StringBuilder();
+StringBuilder urlPath = new StringBuilder();
  
-if (log.isTraceEnabled()) {

-log.trace(sm.getString("cgiServlet.find.path", pathInfo, 
webAppRootDir));
-}
+URL cgiScriptURL = null;
  
-File currentLocation = new File(webAppRootDir);

-StringTokenizer dirWalker = new StringTokenizer(pathInfo, "/");
-if (log.isTraceEnabled()) {
-   

[Bug 69662] New: NamingContext does not include name when throwing NamingException

2025-04-29 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=69662

Bug ID: 69662
   Summary: NamingContext does not include name when throwing
NamingException
   Product: Tomcat 10
   Version: 10.1.39
  Hardware: PC
OS: Linux
Status: NEW
  Severity: normal
  Priority: P2
 Component: Catalina
  Assignee: dev@tomcat.apache.org
  Reporter: donald.h.sm...@gmail.com
  Target Milestone: --

Tomcat threw an exception attempting to look up a JNDI name but did not include
the name it couldn't find:

[SEVERE] 2025-04-29 19:56:41.886
[org.apache.catalina.mbeans.GlobalResourcesLifecycleListener] Exception
processing global JNDI Resources
javax.naming.NamingException: Unexpected exception resolving reference
  at org.apache.naming.NamingContext.lookup(NamingContext.java:567)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:148)
  at
org.apache.naming.NamingContextBindingsEnumeration.nextElementInternal(NamingContextBindingsEnumeration.java:106)
  at
org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:66)
  at
org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:32)
  at
org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:130)
  at
org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:137)
  at
org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:106)
  at
org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEvent(GlobalResourcesLifecycleListener.java:81)
  at
org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:109)
  at
org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:389)
  at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:336)
  at
org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:858)
  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164)
  at org.apache.catalina.startup.Catalina.start(Catalina.java:761)
  at
java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
  at java.base/java.lang.reflect.Method.invoke(Method.java:580)
  at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:345)
  at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:473)

It would be very helpful to have the name that couldn't be found in the
exception message, so the problem could be investigated.

-- 
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



[PR] Bug 69662: add name to exception message when throwing NamingException in NamingContext.lookup() [tomcat]

2025-04-29 Thread via GitHub


dhsmith1001 opened a new pull request, #847:
URL: https://github.com/apache/tomcat/pull/847

   Added a parameter for name to the messages used in creating NamingException, 
and passed the name parameter in NamingContext.lookup() when creating a 
NamingException.


-- 
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