remm 01/10/04 12:28:42
Modified: catalina/src/share/org/apache/catalina/loader Tag:
tomcat_40_branch StandardLoader.java
WebappClassLoader.java
Log:
- Merge a variety of fixes and small feature additions which have been made
and debugged in the HEAD branch, including:
- Removal of Jasper loader (merged with the shared loader).
- Fixes a lot of spec complaince issue regarding the commit state of the
response when using forwards, sendError or sendRedirect.
- Fixes cache consistency issues for static resource serving.
- Adds content caching for static resources (that's linked to the bugfix
mentioned just above).
- Merge enhanced error reporting and error page dispatching (which will be
able to display error pages for most errors returned from the pipeline -
like the 401 and 403 returned by the authenticator).
- Merge the fixes for all the other more recent bugfixes that have been
fixed in the HEAD branch.
- Passes all tester and Watchdog tests.
- Merge a variety of small enhancements to the build scripts which have been
made in the HEAD branch.
Revision Changes Path
No revision
No revision
1.28.2.1 +6 -4
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/Attic/StandardLoader.java
Index: StandardLoader.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/Attic/StandardLoader.java,v
retrieving revision 1.28
retrieving revision 1.28.2.1
diff -u -r1.28 -r1.28.2.1
--- StandardLoader.java 2001/07/22 20:25:10 1.28
+++ StandardLoader.java 2001/10/04 19:28:42 1.28.2.1
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/Attic/StandardLoader.java,v
1.28 2001/07/22 20:25:10 pier Exp $
- * $Revision: 1.28 $
- * $Date: 2001/07/22 20:25:10 $
+ * $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/Attic/StandardLoader.java,v
1.28.2.1 2001/10/04 19:28:42 remm Exp $
+ * $Revision: 1.28.2.1 $
+ * $Date: 2001/10/04 19:28:42 $
*
* ====================================================================
*
@@ -116,7 +116,9 @@
*
* @author Craig R. McClanahan
* @author Remy Maucherat
- * @version $Revision: 1.28 $ $Date: 2001/07/22 20:25:10 $
+ * @deprecated StandardLoader is slower and less robust than WebappLoader for
+ * loading web applications. Use WebappLoader instead.
+ * @version $Revision: 1.28.2.1 $ $Date: 2001/10/04 19:28:42 $
*/
public final class StandardLoader
1.15.2.4 +54 -8
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
Index: WebappClassLoader.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
retrieving revision 1.15.2.3
retrieving revision 1.15.2.4
diff -u -r1.15.2.3 -r1.15.2.4
--- WebappClassLoader.java 2001/09/25 21:57:56 1.15.2.3
+++ WebappClassLoader.java 2001/10/04 19:28:42 1.15.2.4
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
1.15.2.3 2001/09/25 21:57:56 remm Exp $
- * $Revision: 1.15.2.3 $
- * $Date: 2001/09/25 21:57:56 $
+ * $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
1.15.2.4 2001/10/04 19:28:42 remm Exp $
+ * $Revision: 1.15.2.4 $
+ * $Date: 2001/10/04 19:28:42 $
*
* ====================================================================
*
@@ -88,6 +88,7 @@
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.Vector;
import java.util.jar.JarFile;
import java.util.jar.JarEntry;
import java.util.jar.JarInputStream;
@@ -123,7 +124,7 @@
*
* @author Remy Maucherat
* @author Craig R. McClanahan
- * @version $Revision: 1.15.2.3 $ $Date: 2001/09/25 21:57:56 $
+ * @version $Revision: 1.15.2.4 $ $Date: 2001/10/04 19:28:42 $
*/
public class WebappClassLoader
extends URLClassLoader
@@ -552,7 +553,7 @@
long lastModified =
((ResourceAttributes) resources.getAttributes(jar))
- .getLastModified().getTime();
+ .getLastModified();
String[] result = new String[paths.length + 1];
for (i = 0; i < paths.length; i++) {
@@ -700,7 +701,7 @@
try {
long lastModified =
((ResourceAttributes) resources.getAttributes(paths[i]))
- .getLastModified().getTime();
+ .getLastModified();
if (lastModified != lastModifiedDates[i]) {
log(" Resource '" + paths[i]
+ "' was modified; Date is now: "
@@ -941,8 +942,53 @@
if (debug >= 3)
log(" findResources(" + name + ")");
- return (super.findResources(name));
+ Vector result = new Vector();
+
+ int jarFilesLength = jarFiles.length;
+ int repositoriesLength = repositories.length;
+
+ int i;
+
+ // Looking at the repositories
+ for (i = 0; i < repositoriesLength; i++) {
+ try {
+ String fullPath = repositories[i] + name;
+ resources.lookup(fullPath);
+ // Note : Not getting an exception here means the resource was
+ // found
+ try {
+ result.addElement(new File(files[i], name).toURL());
+ } catch (MalformedURLException e) {
+ // Ignore
+ }
+ } catch (NamingException e) {
+ }
+ }
+
+ // Looking at the JAR files
+ for (i = 0; i < jarFilesLength; i++) {
+ JarEntry jarEntry = jarFiles[i].getJarEntry(name);
+ if (jarEntry != null) {
+ try {
+ String jarFakeUrl = jarRealFiles[i].toURL().toString();
+ jarFakeUrl = "jar:" + jarFakeUrl + "!/" + name;
+ result.addElement(new URL(jarFakeUrl));
+ } catch (MalformedURLException e) {
+ // Ignore
+ }
+ }
+ }
+
+ // Adding the results of a call to the superclass
+ Enumeration otherResourcePaths = super.findResources(name);
+
+ while (otherResourcePaths.hasMoreElements()) {
+ result.addElement(otherResourcePaths.nextElement());
+ }
+
+ return result.elements();
+
}
@@ -1553,7 +1599,7 @@
ResourceAttributes attributes =
(ResourceAttributes) resources.getAttributes(fullPath);
contentLength = (int) attributes.getContentLength();
- entry.lastModified = attributes.getLastModified().getTime();
+ entry.lastModified = attributes.getLastModified();
try {
binaryStream = resource.streamContent();
} catch (IOException e) {