You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@locus.apache.org on 2000/02/29 23:42:45 UTC
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util URLUtil.java
costin 00/02/29 14:42:45
Modified: src/build jakarta-apache.xml main.xml
src/j2ee/org/apache/tomcat/shell/deployment Config.java
src/share/org/apache/tomcat/core Context.java
src/share/org/apache/tomcat/request SecurityCheck.java
src/share/org/apache/tomcat/util URLUtil.java
Log:
Tentative fix for Windows paths - both "absolute context" and "tag library"
problems seems to be related with getDocumentBase and URLUtil.resolve.
It should work better now - I still can't test on Windows.
Revision Changes Path
1.5 +14 -8 jakarta-tomcat/src/build/jakarta-apache.xml
Index: jakarta-apache.xml
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/build/jakarta-apache.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- jakarta-apache.xml 2000/02/24 23:01:24 1.4
+++ jakarta-apache.xml 2000/02/29 22:42:42 1.5
@@ -91,14 +91,20 @@
<!-- logs -->
<target name="logs.get" depends="init">
- <get src="ftp://tokyo.javasoft.com/pub/jakarta/tomcat-test.log"
- dest="${nightly.dir}/log/tomcat-test-SunOS-${DSTAMP}.log" ignoreErrors="true" />
- <get src="ftp://tokyo.javasoft.com/pub/jakarta/watchdog-test.log"
- dest="${nightly.dir}/log/watchdog-test-SunOS-${DSTAMP}.log" ignoreErrors="true" />
+ <get src="ftp://tokyo.javasoft.com/pub/jakarta/build.log"
+ dest="${nightly.dir}/log/build-Solaris-${DSTAMP}.log" ignoreErrors="true" />
+
+ <get src="ftp://tokyo.javasoft.com/pub/jakarta/test-tomcat.log"
+ dest="${nightly.dir}/log/test-tomcat-Solaris-${DSTAMP}.log" ignoreErrors="true" />
+
+ <get src="ftp://tokyo.javasoft.com/pub/jakarta/test-watchdog.log"
+ dest="${nightly.dir}/log/test-watchdog-Solaris-${DSTAMP}.log" ignoreErrors="true" />
+
<get src="ftp://osaka.javasoft.com/pub/jakarta/watchdog-test.log"
- dest="${nightly.dir}/log/watchdog-test-Linux-i386-${DSTAMP}.log" ignoreErrors="true" />
- <get src="ftp://osaka.javasoft.com/pub/jakarta/tomcat-test.log"
- dest="${nightly.dir}/log/tomcat-test-Linux-i386-${DSTAMP}.log" ignoreErrors="true" />
+ dest="${nightly.dir}/log/test-watchdog-Linux-i386-${DSTAMP}.log" ignoreErrors="true" />
+
+ <get src="ftp://osaka.javasoft.com/pub/jakarta/test-tomcat.log"
+ dest="${nightly.dir}/log/test-tomcat-Linux-i386-${DSTAMP}.log" ignoreErrors="true" />
</target>
<!-- native packages -->
@@ -182,7 +188,7 @@
<target name="src.snap" depends="init,remove-old,cvsget" >
</target>
- <target name="bin.snap" depends="init,binaries.get,tar" >
+ <target name="bin.snap" depends="init,binaries.get,logs.get,tar" >
</target>
</project>
1.4 +20 -15 jakarta-tomcat/src/build/main.xml
Index: main.xml
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/build/main.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- main.xml 2000/02/24 18:20:46 1.3
+++ main.xml 2000/02/29 22:42:42 1.4
@@ -1,4 +1,4 @@
-<project name="source-snapshots" default="tomcat" basedir=".">
+<project name="source-snapshots" default="all" basedir=".">
<!-- ******************** Initialization ******************** -->
<target name="init">
<tstamp />
@@ -23,8 +23,6 @@
<target name="clean" depends="init">
<deltree dir="${ws.dir}/build" />
<deltree dir="${ws.dir}/dist" />
- <deltree dir="${dist.dir}/ant" />
- <deltree dir="${dist.dir}/tomcat" />
</target>
<target name="remove-old" depends="init">
@@ -36,9 +34,9 @@
<!-- Use "native" directory structure -->
<target name="tomcat" depends="init">
- <ant dir="${ws.dir}/jakarta-tomcat" antfile="${ws.dir}/jakarta-tomcat/build.xml" target="dist" />
- <zip zipfile="${package.dir}/jakarta/tomcat-${os.name}-${DSTAMP}.zip" basedir="${ws.dir}/dist"
- items="tomcat" />
+ <ant dir="${ws.dir}/jakarta-tomcat" antfile="${ws.dir}/jakarta-tomcat/build.xml" target="dist" >
+ <property name="tomcat.home" value="${ws.dir}/dist/tomcat" />
+ </ant>
</target>
<target name="ant" depends="init">
@@ -46,20 +44,30 @@
<ant dir="${ws.dir}/jakarta-ant" antfile="${ws.dir}/jakarta-ant/build.xml" target="dist" >
<property name="ant.dist.dir" value="${ws.dir}/dist/ant" />
</ant>
- <zip zipfile="${package.dir}/jakarta/ant-${os.name}-${DSTAMP}.zip" basedir="${ws.dir}/dist" items="ant"/>
</target>
<target name="watchdog" depends="init">
- <ant dir="${ws.dir}/jakarta-watchdog" antfile="${ws.dir}/jakarta-watchdog/build.xml" target="dist" />
+ <ant dir="${ws.dir}/jakarta-watchdog" antfile="${ws.dir}/jakarta-watchdog/build.xml" target="install.dist" >
+ <property name="watchdog.dist" value="${ws.dir}/dist/watchdog" />
+ <property name="tomcat.home" value="${ws.dir}/dist/tomcat" />
+ </ant>
</target>
+ <target name="packages" depends="init">
+ <zip zipfile="${package.dir}/jakarta/tomcat-${os.name}-${DSTAMP}.zip" basedir="${ws.dir}/dist"
+ items="tomcat" />
+ <zip zipfile="${package.dir}/jakarta/ant-${os.name}-${DSTAMP}.zip" basedir="${ws.dir}/dist" items="ant"/>
+ </target>
+
<!-- ******************** Testing ******************** -->
<target name="tomcat-test" depends="init">
- <exec dir="${ws.dir}/build/tomcat/test" command="runtest" output="${package.dir}/tomcat/tomcat-test.log" />
+ <ant dir="${ws.dir}/dist/tomcat" antfile="${ws.dir}/dist/tomcat/conf/test-tomcat.xml"
+ output="${package.dir}/jakarta/test-${os.name}-${DSTAMP}.log" />
</target>
<target name="watchdog-test" depends="init">
- <exec dir="${ws.dir}/build/watchdog" command="runtest" output="${package.dir}/tomcat/watchdog-test.log" />
+ <ant dir="${ws.dir}/dist/tomcat" antfile="${ws.dir}/dist/tomcat/conf/test-tomcat.xml"
+ output="${package.dir}/jakarta/watchdog-${os.name}-${DSTAMP}.log" />
</target>
<target name="test-apache" depends="init">
@@ -106,14 +114,11 @@
</target>
<!-- ******************** Agregate targets ******************** -->
- <target name="build" depends="init,ant,tomcat">
+ <target name="build" depends="init,">
</target>
- <target name="all" depends="init,clean,build,remove-old">
+ <target name="all" depends="init,clean,ant,tomcat,watchdog,packages,remove-old">
</target>
- <target name="test" depends="init,tomcat-test,watchdog-test">
- </target>
-
</project>
1.2 +4 -4 jakarta-tomcat/src/j2ee/org/apache/tomcat/shell/deployment/Config.java
Index: Config.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/j2ee/org/apache/tomcat/shell/deployment/Config.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Config.java 2000/02/11 00:22:37 1.1
+++ Config.java 2000/02/29 22:42:43 1.2
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/src/j2ee/org/apache/tomcat/shell/deployment/Config.java,v 1.1 2000/02/11 00:22:37 costin Exp $
- * $Revision: 1.1 $
- * $Date: 2000/02/11 00:22:37 $
+ * $Header: /home/cvs/jakarta-tomcat/src/j2ee/org/apache/tomcat/shell/deployment/Config.java,v 1.2 2000/02/29 22:42:43 costin Exp $
+ * $Revision: 1.2 $
+ * $Date: 2000/02/29 22:42:43 $
*
* ====================================================================
*
@@ -142,7 +142,7 @@
// loadConfig(is, validate);
} else {
try {
- configURL = URLUtil.resolve(configFile, null);
+ configURL = URLUtil.resolve(configFile);
} catch (MalformedURLException mue) {
String msg = sm.getString("startup.loadconfig.mue",
configFile);
1.64 +25 -5 jakarta-tomcat/src/share/org/apache/tomcat/core/Context.java
Index: Context.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Context.java,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -r1.63 -r1.64
--- Context.java 2000/02/27 03:23:34 1.63
+++ Context.java 2000/02/29 22:42:44 1.64
@@ -595,7 +595,6 @@
public String toString() {
return "Ctx(" + path + "," + getDocBase() + ")";
- // + " , " + getDocumentBase() + " ) ";
}
// -------------------- Facade methods --------------------
@@ -879,12 +878,33 @@
*/
public URL getDocumentBase() {
if( documentBase == null ) {
- if( docBase != null)
+ if( docBase == null)
+ return null;
+ try {
+ String absPath=docBase;
+
+ // detect absolute path
+ if (docBase.startsWith(File.separator) ||
+ docBase.startsWith("/") ||
+ ( docBase.length() >= 2 &&
+ Character.isLetter(docBase.charAt(0)) &&
+ docBase.charAt(1) == ':')
+ ) {
+ absPath=docBase;
+ } else {
+ absPath = contextM.getHome() + File.separator + docBase;
+ }
+
try {
- documentBase=URLUtil.resolve( docBase );
- } catch( MalformedURLException ex ) {
- ex.printStackTrace();
+ absPath = new File(absPath).getCanonicalPath();
+ } catch (IOException npe) {
}
+
+ documentBase = new URL("file", "", absPath);
+
+ } catch( MalformedURLException ex ) {
+ ex.printStackTrace();
+ }
}
return documentBase;
}
1.8 +2 -1 jakarta-tomcat/src/share/org/apache/tomcat/request/SecurityCheck.java
Index: SecurityCheck.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/request/SecurityCheck.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- SecurityCheck.java 2000/02/27 02:01:24 1.7
+++ SecurityCheck.java 2000/02/29 22:42:44 1.8
@@ -181,7 +181,8 @@
session.setAttribute( "tomcat.credential", c );
} else {
// wrong password
- errorPage( req, response );
+ if( username!=null)
+ errorPage( req, response );
}
}
}
1.6 +12 -19 jakarta-tomcat/src/share/org/apache/tomcat/util/URLUtil.java
Index: URLUtil.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/URLUtil.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- URLUtil.java 2000/01/12 06:35:21 1.5
+++ URLUtil.java 2000/02/29 22:42:44 1.6
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/URLUtil.java,v 1.5 2000/01/12 06:35:21 costin Exp $
- * $Revision: 1.5 $
- * $Date: 2000/01/12 06:35:21 $
+ * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/URLUtil.java,v 1.6 2000/02/29 22:42:44 costin Exp $
+ * $Revision: 1.6 $
+ * $Date: 2000/02/29 22:42:44 $
*
* ====================================================================
*
@@ -79,14 +79,7 @@
public static URL resolve(String s)
throws MalformedURLException
{
- return resolve(s, null);
- }
-
- public static URL resolve(String s, URL url)
- throws MalformedURLException
- {
URL resolve = null;
-
// construct a URL via the following heuristics:
//
// if arg contains ":/" then
@@ -102,13 +95,13 @@
if (s.indexOf("://") > -1 ||
s.indexOf("file:") > -1 ) {
resolve = new URL(s);
- } else if (url != null) {
- resolve = new URL(url, s);
+ // } else if (url != null) {
+ // resolve = new URL(url, s);
} else if (s.startsWith(File.separator) ||
s.startsWith("/") ||
(s.length() >= 2 &&
- Character.isLetter(s.charAt(0)) &&
- s.charAt(1) == ':')) {
+ Character.isLetter(s.charAt(0)) &&
+ s.charAt(1) == ':')) {
String fName = s;
try {
@@ -124,19 +117,19 @@
resolve = new URL("file", "", path);
}
-
+
if (! resolve.getProtocol().equalsIgnoreCase("war") &&
resolve.getFile().toLowerCase().endsWith(
- "." + "war")) {
+ "." + "war")) {
URL u = new URL("war" + ":" +
- resolve.toString());
-
+ resolve.toString());
+
resolve = u;
}
resolve = new URL(trim(resolve.toString(), ".", ".."));
resolve = new URL(trim(resolve.toString(), "./"));
-
+
return resolve;
}