You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by cr...@locus.apache.org on 2000/06/19 23:46:51 UTC
cvs commit: jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/resources StandardResources.java
craigmcc 00/06/19 14:46:50
Modified: proposals/catalina/src/bin catalina.sh
proposals/catalina/src/share/org/apache/tomcat/core
ApplicationDispatcher.java
proposals/catalina/src/share/org/apache/tomcat/resources
StandardResources.java
Log:
Add a "debug" option on the startup script to start Catalina in a
debugger.
Add debugging output to ApplicationDispatcher and StandardResources.
Revision Changes Path
1.9 +12 -2 jakarta-tomcat/proposals/catalina/src/bin/catalina.sh
Index: catalina.sh
===================================================================
RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/bin/catalina.sh,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- catalina.sh 2000/06/11 01:16:37 1.8
+++ catalina.sh 2000/06/19 21:46:47 1.9
@@ -13,7 +13,7 @@
# files must be in your Java2 extensions directory.
# JAVA_HOME Must point at your Java Development Kit installation.
#
-# $Id: catalina.sh,v 1.8 2000/06/11 01:16:37 craigmcc Exp $
+# $Id: catalina.sh,v 1.9 2000/06/19 21:46:47 craigmcc Exp $
# -----------------------------------------------------------------------------
@@ -50,8 +50,17 @@
# ----- Execute The Requested Command -----------------------------------------
-if [ "$1" = "env" ] ; then
+if [ "$1" = "debug" ] ; then
+ pushd $CATALINA_HOME
+ jdb \
+ -sourcepath ../../jakarta-tomcat/proposals/catalina:../../jakarta-tomcat \
+ -classpath $CP -Dcatalina.home=$CATALINA_HOME \
+ org.apache.tomcat.startup.Catalina "$@" start
+ popd
+
+elif [ "$1" = "env" ] ; then
+
export CATALINA_HOME CP
exit 0
@@ -71,6 +80,7 @@
echo "Usage: catalina.sh ( env | run | start | stop)"
echo "Commands:"
+ echo " debug - Start Catalina in a debugger"
echo " env - Set up environment variables that Catalina would use"
echo " run - Start Catalina in the current window"
echo " start - Start Catalina in a separate window"
1.5 +31 -17 jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/ApplicationDispatcher.java
Index: ApplicationDispatcher.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/ApplicationDispatcher.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ApplicationDispatcher.java 2000/06/13 02:49:51 1.4
+++ ApplicationDispatcher.java 2000/06/19 21:46:49 1.5
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/ApplicationDispatcher.java,v 1.4 2000/06/13 02:49:51 craigmcc Exp $
- * $Revision: 1.4 $
- * $Date: 2000/06/13 02:49:51 $
+ * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/ApplicationDispatcher.java,v 1.5 2000/06/19 21:46:49 craigmcc Exp $
+ * $Revision: 1.5 $
+ * $Date: 2000/06/19 21:46:49 $
*
* ====================================================================
*
@@ -93,7 +93,7 @@
* from this resource.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.4 $ $Date: 2000/06/13 02:49:51 $
+ * @version $Revision: 1.5 $ $Date: 2000/06/19 21:46:49 $
*/
final class ApplicationDispatcher
@@ -145,7 +145,7 @@
/**
* The debugging detail level for this component.
*/
- private int debug = 0;
+ private int debug = 2;
/**
@@ -387,18 +387,32 @@
if (pathInfo != null)
sb.append(pathInfo);
ServletRequest sr = wrequest.getRequest();
- if (debug >= 1)
- log(" requestURI=" + sb.toString());
- if (sb.length() > 0)
- sr.setAttribute("javax.servlet.include.request_uri", sb.toString());
- if (contextPath != null)
- sr.setAttribute("javax.servlet.include.context_path", sb.toString());
- if (servletPath != null)
- sr.setAttribute("javax.servlet.include.servlet_path", sb.toString());
- if (pathInfo != null)
- sr.setAttribute("javax.servlet.include.path_info", sb.toString());
- if (queryString != null)
- sr.setAttribute("javax.servlet.include.query_string", sb.toString());
+ if (sb.length() > 0) {
+ if (debug >= 1)
+ log(" requestURI=" + sb.toString());
+ sr.setAttribute("javax.servlet.include.request_uri",
+ sb.toString());
+ }
+ if (contextPath != null) {
+ if (debug >= 1)
+ log(" contextPath=" + contextPath);
+ sr.setAttribute("javax.servlet.include.context_path", contextPath);
+ }
+ if (servletPath != null) {
+ if (debug >= 1)
+ log(" servletPath=" + servletPath);
+ sr.setAttribute("javax.servlet.include.servlet_path", servletPath);
+ }
+ if (pathInfo != null) {
+ if (debug >= 1)
+ log(" pathInfo=" + pathInfo);
+ sr.setAttribute("javax.servlet.include.path_info", pathInfo);
+ }
+ if (queryString != null) {
+ if (debug >= 1)
+ log(" queryString=" + queryString);
+ sr.setAttribute("javax.servlet.include.query_string", queryString);
+ }
try {
wrapper.invoke(wrequest, hresponse);
1.10 +33 -10 jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/resources/StandardResources.java
Index: StandardResources.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/resources/StandardResources.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- StandardResources.java 2000/05/21 02:39:57 1.9
+++ StandardResources.java 2000/06/19 21:46:50 1.10
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/resources/StandardResources.java,v 1.9 2000/05/21 02:39:57 craigmcc Exp $
- * $Revision: 1.9 $
- * $Date: 2000/05/21 02:39:57 $
+ * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/resources/StandardResources.java,v 1.10 2000/06/19 21:46:50 craigmcc Exp $
+ * $Revision: 1.10 $
+ * $Date: 2000/06/19 21:46:50 $
*
* ====================================================================
*
@@ -101,7 +101,7 @@
* </ul>
*
* @author Craig R. McClanahan
- * @version $Revision: 1.9 $ $Date: 2000/05/21 02:39:57 $
+ * @version $Revision: 1.10 $ $Date: 2000/06/19 21:46:50 $
*/
public final class StandardResources
@@ -389,12 +389,12 @@
if ((fileBase == null) || (path == null) ||
(!path.startsWith("/") && !path.startsWith("\\"))) {
-// if (debug >= 2)
-// log("getRealPath(" + path + ") --> null");
+ if (debug >= 2)
+ log("getRealPath(" + path + ") --> null");
return (null);
} else {
-// if (debug >= 2)
-// log("getRealPath(" + path + ") --> " + fileBase + path);
+ if (debug >= 2)
+ log("getRealPath(" + path + ") --> " + fileBase + path);
return (fileBase + path);
}
@@ -489,27 +489,50 @@
*/
public InputStream getResourceAsStream(String path) {
- if (path == null)
+ if (path == null) {
+ if (debug >= 2)
+ log("getResourceAsStream(" + path +
+ ") --> null due to null argument");
return (null);
- if (path.indexOf("/..") >= 0)
+ }
+ if (path.indexOf("/..") >= 0) {
+ if (debug >= 2)
+ log("getResourceAsStream(" + path +
+ ") --> null due to '/..' in path");
return (null); // Refuse to interpret relative paths
+ }
// Deal with URL-based document root
if (fileBase == null) {
try {
URL url = getResource(path);
+ if (debug >= 2)
+ log("getResourceAsStream(" + path +
+ ") --> URL " + url.toString());
return (url.openStream());
} catch (MalformedURLException e) {
+ if (debug >= 2)
+ log("getResourceAsStream(" + path +
+ ") --> null due to MalformedURLException", e);
return (null);
} catch (IOException e) {
+ if (debug >= 2)
+ log("getResourceAsStream(" + path +
+ ") --> null due to IOException", e);
return (null);
}
}
// Deal with file-based document root
try {
+ if (debug >= 2)
+ log("getResourceAsStream(" + path +
+ ") --> FileInputStream(" + fileBase + path + ")");
return (new FileInputStream(fileBase + path));
} catch (Throwable t) {
+ if (debug >= 2)
+ log("getResourceAsStream(" + path +
+ ") --> null due to Throwable", t);
return (null);
}