cvs commit: jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java WebdavServlet.java

2001-01-18 Thread remm

remm01/01/18 17:11:30

  Modified:catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java WebdavServlet.java
  Log:
  - Fix to links encoding part 1 : Now the links encoding function is called
everywhere it needs to be. This patch will be merged in TC 4.0 when
the link encoding function itself is updated.
  
  Revision  ChangesPath
  1.25  +32 -31
jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- DefaultServlet.java   2001/01/18 20:26:58 1.24
  +++ DefaultServlet.java   2001/01/19 01:11:29 1.25
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
 1.24 2001/01/18 20:26:58 remm Exp $
  - * $Revision: 1.24 $
  - * $Date: 2001/01/18 20:26:58 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
 1.25 2001/01/19 01:11:29 remm Exp $
  + * $Revision: 1.25 $
  + * $Date: 2001/01/19 01:11:29 $
*
* 
*
  @@ -78,6 +78,7 @@
   import java.io.Writer;
   import java.net.MalformedURLException;
   import java.net.URL;
  +import java.net.URLEncoder;
   import java.sql.Timestamp;
   import java.util.Date;
   import java.util.Enumeration;
  @@ -118,7 +119,7 @@
*
* @author Craig R. McClanahan
* @author Remy Maucherat
  - * @version $Revision: 1.24 $ $Date: 2001/01/18 20:26:58 $
  + * @version $Revision: 1.25 $ $Date: 2001/01/19 01:11:29 $
*/
   
   public class DefaultServlet
  @@ -895,6 +896,29 @@
   }
   
   
  +/**
  + * URL rewriter.
  + * 
  + * @param path Path which has to be rewiten
  + */
  +protected String rewriteUrl(String path) {
  +
  +String normalized = path;
  +
  + // Replace " " with "%20"
  +while (true) {
  + int index = normalized.indexOf(" ");
  + if (index < 0)
  + break;
  + normalized = normalized.substring(0, index) + "%20"
  + + normalized.substring(index + 1);
  + }
  +
  +return normalized;
  +
  +}
  +
  +
   //  Private Methods
   
   
  @@ -1435,7 +1459,7 @@
   if ((contextPath != null) && (!contextPath.equals("/"))) {
   redirectPath = contextPath + redirectPath;
   }
  -response.sendRedirect(redirectPath);
  +response.sendRedirect(rewriteUrl(redirectPath));
   return;
   }
   
  @@ -1750,7 +1774,7 @@
* @param contextPath Context path to which our internal paths are
*  relative
*/
  -public InputStream render(String contextPath, ResourceInfo resourceInfo) {
  +private InputStream render(String contextPath, ResourceInfo resourceInfo) {
   
   String name = resourceInfo.path;
   
  @@ -1798,8 +1822,8 @@
   parent = "/";
   //if (contextPath.endsWith("/"))
   //parent = parent.substring(1);
  - writer.print(parent);
  - writer.print("\">");
  + writer.print(rewriteUrl(parent));
  +writer.print("\">");
writer.print(sm.getString("directory.parent", parent));
writer.print("\r\n");
writer.print("\r\n");
  @@ -1921,29 +1945,6 @@
   }
   
   
  -/**
  - * URL rewriter.
  - * 
  - * @param path Path which has to be rewiten
  - */
  -private String rewriteUrl(String path) {
  -
  -String normalized = path;
  -
  - // Replace " " with "%20"
  - while (true) {
  - int index = normalized.indexOf(" ");
  - if (index < 0)
  - break;
  - normalized = normalized.substring(0, index) + "%20"
  - + normalized.substring(index + 1);
  - }
  -
  -return normalized;
  -
  -}
  -
  -
   // -- Range Inner Class
   
   
  
  
  
  1.11  +7 -7  
jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/WebdavServlet.java
  
  Index: WebdavServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/WebdavServlet.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- WebdavServlet.java2001/01/18 01:45:45 1.10
  +++ WebdavServ

cvs commit: jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2001-01-18 Thread remm

remm01/01/18 12:27:01

  Modified:catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java
  Log:
  - Fix inclusion problems by catching the IllegalStateException which
can be thrown by the servlet container.
  
  Revision  ChangesPath
  1.24  +19 -7 
jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- DefaultServlet.java   2001/01/15 05:51:26 1.23
  +++ DefaultServlet.java   2001/01/18 20:26:58 1.24
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
 1.23 2001/01/15 05:51:26 remm Exp $
  - * $Revision: 1.23 $
  - * $Date: 2001/01/15 05:51:26 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
 1.24 2001/01/18 20:26:58 remm Exp $
  + * $Revision: 1.24 $
  + * $Date: 2001/01/18 20:26:58 $
*
* 
*
  @@ -118,7 +118,7 @@
*
* @author Craig R. McClanahan
* @author Remy Maucherat
  - * @version $Revision: 1.23 $ $Date: 2001/01/15 05:51:26 $
  + * @version $Revision: 1.24 $ $Date: 2001/01/18 20:26:58 $
*/
   
   public class DefaultServlet
  @@ -1532,7 +1532,11 @@
   
   // Copy the input stream to our output stream (if requested)
   if (content) {
  -response.setBufferSize(output);
  +try {
  +response.setBufferSize(output);
  +} catch (IllegalStateException e) {
  +// Silent catch
  +}
   if (ostream != null) {
   copy(resourceInfo, ostream);
   } else {
  @@ -1565,7 +1569,11 @@
   }
   
   if (content) {
  -response.setBufferSize(output);
  +try {
  +response.setBufferSize(output);
  +} catch (IllegalStateException e) {
  +// Silent catch
  +}
   if (ostream != null) {
   copy(resourceInfo, ostream, range);
   } else {
  @@ -1579,7 +1587,11 @@
   + mimeSeparation);
   
   if (content) {
  -response.setBufferSize(output);
  +try {
  +response.setBufferSize(output);
  +} catch (IllegalStateException e) {
  +// Silent catch
  +}
   if (ostream != null) {
   copy(resourceInfo, ostream, ranges.elements(), 
contentType);
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




cvs commit: jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2001-01-14 Thread remm

remm01/01/14 21:51:27

  Modified:catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java
  Log:
  - Fix a bug where a directory browse page wouldn't be served if the request
included a rage header. That fixes compatibility with the HTTP browser
included with the GetRight download manager.
  
  Revision  ChangesPath
  1.23  +15 -12
jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- DefaultServlet.java   2001/01/14 02:36:52 1.22
  +++ DefaultServlet.java   2001/01/15 05:51:26 1.23
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
 1.22 2001/01/14 02:36:52 remm Exp $
  - * $Revision: 1.22 $
  - * $Date: 2001/01/14 02:36:52 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
 1.23 2001/01/15 05:51:26 remm Exp $
  + * $Revision: 1.23 $
  + * $Date: 2001/01/15 05:51:26 $
*
* 
*
  @@ -118,7 +118,7 @@
*
* @author Craig R. McClanahan
* @author Remy Maucherat
  - * @version $Revision: 1.22 $ $Date: 2001/01/14 02:36:52 $
  + * @version $Revision: 1.23 $ $Date: 2001/01/15 05:51:26 $
*/
   
   public class DefaultServlet
  @@ -1465,18 +1465,20 @@
   // Parse range specifier
   Vector ranges = null;
   if (!resourceInfo.collection) {
  +
   ranges = parseRange(request, response, resourceInfo);
  -
  -// Last-Modified header
  -if (debug > 0)
  -log("DefaultServlet.serveFile:  lastModified='" +
  -(new Timestamp(resourceInfo.date)).toString() + "'");
  -response.setDateHeader("Last-Modified", resourceInfo.date);
   
   // ETag header
   response.setHeader("ETag", getETag(resourceInfo, true));
  +
   }
   
  +// Last-Modified header
  +if (debug > 0)
  +log("DefaultServlet.serveFile:  lastModified='" +
  +(new Timestamp(resourceInfo.date)).toString() + "'");
  +response.setDateHeader("Last-Modified", resourceInfo.date);
  +
   ServletOutputStream ostream = null;
   PrintWriter writer = null;
   
  @@ -1499,8 +1501,9 @@
   
   }
   
  -if ( ((ranges == null) || (ranges.isEmpty())) 
  - && (request.getHeader("Range") == null) ) {
  +if ( (resourceInfo.collection) || 
  + ( ((ranges == null) || (ranges.isEmpty())) 
  +   && (request.getHeader("Range") == null) ) ) {
   
   // Set the appropriate output headers
   if (contentType != null) {
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




cvs commit: jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2001-01-13 Thread remm

remm01/01/13 18:36:52

  Modified:catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java
  Log:
  - Oops, I wan't normalizing the right thing, which was causing problems depending
on how the servlet mappings were configured.
  
  Revision  ChangesPath
  1.22  +6 -6  
jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- DefaultServlet.java   2001/01/13 21:24:48 1.21
  +++ DefaultServlet.java   2001/01/14 02:36:52 1.22
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
 1.21 2001/01/13 21:24:48 remm Exp $
  - * $Revision: 1.21 $
  - * $Date: 2001/01/13 21:24:48 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
 1.22 2001/01/14 02:36:52 remm Exp $
  + * $Revision: 1.22 $
  + * $Date: 2001/01/14 02:36:52 $
*
* 
*
  @@ -118,7 +118,7 @@
*
* @author Craig R. McClanahan
* @author Remy Maucherat
  - * @version $Revision: 1.21 $ $Date: 2001/01/13 21:24:48 $
  + * @version $Revision: 1.22 $ $Date: 2001/01/14 02:36:52 $
*/
   
   public class DefaultServlet
  @@ -444,14 +444,14 @@
   }
   
   // No, extract the desired path directly from the request
  -String result = normalize(request.getPathInfo());
  +String result = request.getPathInfo();
   if (result == null) {
   result = request.getServletPath();
   }
   if ((result == null) || (result.equals(""))) {
   result = "/";
   }
  -return result;
  +return normalize(result);
   
   }
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




cvs commit: jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java WebdavServlet.java

2001-01-13 Thread remm

remm01/01/13 13:24:48

  Modified:catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java WebdavServlet.java
  Log:
  - Fixes all known issues with file serving and WebDAV.
  - COPY, MOVE, DELETE now work again.
  - All the resources served / browsed / written are now accessed
through JNDI. The initial DirContext itself is retrieved inside the naming
environment (java:/comp/Resources), or inside the ServletContext if
naming is disabled.
  - There are still some dependencies with Catalina, though : four classes from
the util package (which are already independent from Catalina), and one
constant from the Globals interface. It takes two minutes to remove them,
although I anticipate that these shared servlets will be moved to a separate
Tomcat subproject.
  
  Revision  ChangesPath
  1.21  +87 -36
jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- DefaultServlet.java   2001/01/13 05:20:05 1.20
  +++ DefaultServlet.java   2001/01/13 21:24:48 1.21
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
 1.20 2001/01/13 05:20:05 remm Exp $
  - * $Revision: 1.20 $
  - * $Date: 2001/01/13 05:20:05 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
 1.21 2001/01/13 21:24:48 remm Exp $
  + * $Revision: 1.21 $
  + * $Date: 2001/01/13 21:24:48 $
*
* 
*
  @@ -118,7 +118,7 @@
*
* @author Craig R. McClanahan
* @author Remy Maucherat
  - * @version $Revision: 1.20 $ $Date: 2001/01/13 05:20:05 $
  + * @version $Revision: 1.21 $ $Date: 2001/01/13 21:24:48 $
*/
   
   public class DefaultServlet
  @@ -444,7 +444,7 @@
   }
   
   // No, extract the desired path directly from the request
  -String result = request.getPathInfo();
  +String result = normalize(request.getPathInfo());
   if (result == null) {
   result = request.getServletPath();
   }
  @@ -818,6 +818,9 @@
*/
   protected String normalize(String path) {
   
  +if (path == null)
  +return null;
  +
String normalized = path;
   
// Resolve encoded characters in the normalized path,
  @@ -911,7 +914,7 @@
   IOException exception = null;
   
   // FIXME : i18n ?
  -InputStream resourceInputStream = resourceInfo.is;
  +InputStream resourceInputStream = resourceInfo.getStream();
   InputStream istream = new BufferedInputStream
   (resourceInputStream, input);
   
  @@ -947,7 +950,7 @@
   
   IOException exception = null;
   
  -InputStream resourceInputStream = resourceInfo.is;
  +InputStream resourceInputStream = resourceInfo.getStream();
   // FIXME : i18n ?
   Reader reader = new InputStreamReader(resourceInputStream);
   
  @@ -984,7 +987,7 @@
   
   IOException exception = null;
   
  -InputStream resourceInputStream = resourceInfo.is;
  +InputStream resourceInputStream = resourceInfo.getStream();
   InputStream istream =
   new BufferedInputStream(resourceInputStream, input);
   exception = copyRange(istream, ostream, range.start, range.end);
  @@ -1019,7 +1022,7 @@
   
   IOException exception = null;
   
  -InputStream resourceInputStream = resourceInfo.is;
  +InputStream resourceInputStream = resourceInfo.getStream();
   Reader reader = new InputStreamReader(resourceInputStream);
   exception = copyRange(reader, writer, range.start, range.end);
   
  @@ -1056,7 +1059,7 @@
   
   while ( (exception == null) && (ranges.hasMoreElements()) ) {
   
  -InputStream resourceInputStream = resourceInfo.is;
  +InputStream resourceInputStream = resourceInfo.getStream();
   InputStream istream =// FIXME: internationalization???
   new BufferedInputStream(resourceInputStream, input);
   
  @@ -,7 +1114,7 @@
   
   while ( (exception == null) && (ranges.hasMoreElements()) ) {
   
  -InputStream resourceInputStream = resourceInfo.is;
  +InputStream resourceInputStream = resourceInfo.getStream();
   Reader reader = new InputStreamReader(resourceInputStream);
   
   

cvs commit: jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java LocalStrings.properties

2001-01-12 Thread remm

remm01/01/12 21:20:05

  Modified:catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java LocalStrings.properties
  Log:
  - Fix lots of path related problems.
  - Directory browser works again.
  - The only known issues are :
- writing, which will fail because of functions which are not implemented yet
  in the FileDirContext.
- accessing encoded URLs fail (like files with spaces in their names.
  - WebDAV is broken at the moment, and needs a small revision of the
algorithms.
  
  Revision  ChangesPath
  1.20  +11 -19
jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- DefaultServlet.java   2001/01/12 06:55:34 1.19
  +++ DefaultServlet.java   2001/01/13 05:20:05 1.20
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
 1.19 2001/01/12 06:55:34 remm Exp $
  - * $Revision: 1.19 $
  - * $Date: 2001/01/12 06:55:34 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
 1.20 2001/01/13 05:20:05 remm Exp $
  + * $Revision: 1.20 $
  + * $Date: 2001/01/13 05:20:05 $
*
* 
*
  @@ -118,7 +118,7 @@
*
* @author Craig R. McClanahan
* @author Remy Maucherat
  - * @version $Revision: 1.19 $ $Date: 2001/01/12 06:55:34 $
  + * @version $Revision: 1.20 $ $Date: 2001/01/13 05:20:05 $
*/
   
   public class DefaultServlet
  @@ -1439,12 +1439,6 @@
   
   }
   
  - if (!resourceInfo.exists()) {
  - response.sendError(HttpServletResponse.SC_NOT_FOUND, 
  -   resourceInfo.path);
  - return;
  - }
  -
   // Checking If headers
   if ( !checkIfHeaders(request, response, resourceInfo) ) {
   return;
  @@ -1525,7 +1519,8 @@
   
   if (content) {
   // Serve the directory browser
  -resourceInfo.is = render(resourceInfo);
  +resourceInfo.is = 
  +render(request.getContextPath(), resourceInfo);
   }
   
   }
  @@ -1738,9 +1733,8 @@
* @param contextPath Context path to which our internal paths are
*  relative
*/
  -public InputStream render(ResourceInfo resourceInfo) {
  +public InputStream render(String contextPath, ResourceInfo resourceInfo) {
   
  -String contextPath = resourceInfo.path;
   String name = resourceInfo.path;
   
// Number of characters to trim from the beginnings of filenames
  @@ -1785,8 +1779,8 @@
writer.print(rewriteUrl(contextPath));
   if (parent.equals(""))
   parent = "/";
  -if (contextPath.endsWith("/"))
  -parent = parent.substring(1);
  +//if (contextPath.endsWith("/"))
  +//parent = parent.substring(1);
writer.print(parent);
writer.print("\">");
writer.print(sm.getString("directory.parent", parent));
  @@ -1821,7 +1815,7 @@
   ResourceInfo childResourceInfo = 
   new ResourceInfo(resourceName, directory);
   
  -String trimmed = resourceName.substring(trim);
  +String trimmed = resourceName/*.substring(trim)*/;
   if (trimmed.equalsIgnoreCase("WEB-INF") ||
   trimmed.equalsIgnoreCase("META-INF"))
   continue;
  @@ -1835,9 +1829,7 @@
   writer.print("  \r\n");
   writer.print(" 0))
  -resourceName = resourceName.substring(1);
  +resourceName = rewriteUrl(name + resourceName);
   writer.print(resourceName);
   writer.print("\">");
   writer.print(trimmed);
  
  
  
  1.4   +6 -0  
jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/LocalStrings.properties
  
  Index: LocalStrings.properties
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/LocalStrings.properties,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LocalStrings.properties   2000/11/10 01:19:17 1.3
  +++ LocalStrings.properties   2001/01/13 05:20:05 1.4
  @@ -19,3 +19,9 @@
   managerServlet.reloaded=OK - Reloaded application at context pat

cvs commit: jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java WebdavServlet.java

2001-01-11 Thread remm

remm01/01/11 22:55:35

  Modified:catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java WebdavServlet.java
  Log:
  - Partly rewritten the DefaultServlet and WebdavServlet to use DirContext.
  - Some parts of the code could be simplified to take advantage of the JNDI
naming conventions. For example, when the member of a collection are
requested, JNDI does return the names relative to the parent collection's
context. Before, the Resources were returning the full names of the child
resources.
  
  Revision  ChangesPath
  1.19  +363 -43   
jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- DefaultServlet.java   2001/01/08 16:45:55 1.18
  +++ DefaultServlet.java   2001/01/12 06:55:34 1.19
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
 1.18 2001/01/08 16:45:55 remm Exp $
  - * $Revision: 1.18 $
  - * $Date: 2001/01/08 16:45:55 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
 1.19 2001/01/12 06:55:34 remm Exp $
  + * $Revision: 1.19 $
  + * $Date: 2001/01/12 06:55:34 $
*
* 
*
  @@ -66,6 +66,8 @@
   
   
   import java.io.BufferedInputStream;
  +import java.io.ByteArrayOutputStream;
  +import java.io.ByteArrayInputStream;
   import java.io.File;
   import java.io.FileInputStream;
   import java.io.InputStream;
  @@ -95,16 +97,19 @@
   import javax.servlet.http.HttpServlet;
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
  +import javax.naming.NamingException;
  +import javax.naming.InitialContext;
  +import javax.naming.Context;
  +import javax.naming.NamingEnumeration;
  +import javax.naming.NameClassPair;
  +import javax.naming.directory.DirContext;
  +import javax.naming.directory.Attribute;
  +import javax.naming.directory.Attributes;
  +import org.apache.naming.resources.Resource;
  +import org.apache.naming.resources.ResourceAttributes;
   import org.apache.catalina.Globals;
  -import org.apache.catalina.Resources;
  -import org.apache.catalina.core.ApplicationContext;
  -import org.apache.catalina.resources.ResourceBean;
  -import org.apache.catalina.resources.DirectoryBean;
   import org.apache.catalina.util.MD5Encoder;
   import org.apache.catalina.util.StringManager;
  -import org.apache.catalina.util.xml.SaxContext;
  -import org.apache.catalina.util.xml.XmlAction;
  -import org.apache.catalina.util.xml.XmlMapper;
   
   
   /**
  @@ -113,7 +118,7 @@
*
* @author Craig R. McClanahan
* @author Remy Maucherat
  - * @version $Revision: 1.18 $ $Date: 2001/01/08 16:45:55 $
  + * @version $Revision: 1.19 $ $Date: 2001/01/12 06:55:34 $
*/
   
   public class DefaultServlet
  @@ -201,6 +206,12 @@
   
   
   /**
  + * JNDI resources name.
  + */
  +protected static final String RESOURCES_JNDI_NAME = "java:/comp/Resources";
  +
  +
  +/**
* The string manager for this package.
*/
   protected static StringManager sm =
  @@ -295,6 +306,38 @@
   
   
   /**
  + * Get resources. This method will try to retrieve the resources through
  + * JNDI first, then in the servlet context if JNDI has failed (it could be
  + * disabled). It will return null.
  + * 
  + * @return A JNDI DirContext, or null.
  + */
  +protected DirContext getResources() {
  +
  +// First : try JNDI
  +try {
  +return 
  +(DirContext) new InitialContext().lookup(RESOURCES_JNDI_NAME);
  +} catch (NamingException e) {
  +// Failed
  +} catch (ClassCastException e) {
  +// Failed : Not the right type
  +}
  +
  +// If it has failed, try the servlet context
  +try {
  +return (DirContext) getServletContext()
  +.getAttribute(Globals.RESOURCES_ATTR);
  +} catch (ClassCastException e) {
  +// Failed : Not the right type
  +}
  +
  +return null;
  +
  +}
  +
  +
  +/**
* Show HTTP header information.
*/
   protected void showRequestInfo(HttpServletRequest req) {
  @@ -494,13 +537,29 @@
   resp.sendError(HttpServletResponse.SC_NOT_IMPLEMENTED);
   }
   
  -// Retrieve the Catalina context
  -ApplicationContext context = (ApplicationContext) getServletContext();
  -Resources resources = context.getResources();
  +