tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@locus.apache.org
Subject cvs commit: jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/servlets Constants.java LocalStrings.properties DefaultServlet.java
Date Sat, 24 Jun 2000 19:48:57 GMT
remm        00/06/24 12:48:57

  Modified:    proposals/catalina/src/share/org/apache/tomcat/servlets
                        DefaultServlet.java
  Added:       proposals/catalina/src/share/org/apache/tomcat/servlets
                        Constants.java LocalStrings.properties
  Log:
  - Added static file caching in DefaultServlet. The cache is not configurable right now.
By
    default, it will cache files < 32ko.
    I'll post benchmark figures soon for three servlet engines : Tomcat 3.2 dev, Catalina,
and
    Orion 1.0.
  
  - Added a directory browser based on the Tomcat 3.2 code.
  
  Revision  Changes    Path
  1.9       +449 -80   jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/servlets/DefaultServlet.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DefaultServlet.java	2000/06/13 02:49:51	1.8
  +++ DefaultServlet.java	2000/06/24 19:48:56	1.9
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/servlets/DefaultServlet.java,v
1.8 2000/06/13 02:49:51 craigmcc Exp $
  - * $Revision: 1.8 $
  - * $Date: 2000/06/13 02:49:51 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/servlets/DefaultServlet.java,v
1.9 2000/06/24 19:48:56 remm Exp $
  + * $Revision: 1.9 $
  + * $Date: 2000/06/24 19:48:56 $
    *
    * ====================================================================
    *
  @@ -79,17 +79,20 @@
   import java.util.Vector;
   import java.util.StringTokenizer;
   import java.util.Locale;
  +import java.util.Hashtable;
   import java.text.ParseException;
   import java.text.SimpleDateFormat;
   import java.security.MessageDigest;
   import java.security.NoSuchAlgorithmException;
   import javax.servlet.RequestDispatcher;
   import javax.servlet.ServletException;
  +import javax.servlet.ServletContext;
   import javax.servlet.ServletOutputStream;
   import javax.servlet.http.HttpServlet;
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
   import org.apache.tomcat.util.MD5Encoder;
  +import org.apache.tomcat.util.StringManager;
   import org.apache.tomcat.util.xml.SaxContext;
   import org.apache.tomcat.util.xml.XmlAction;
   import org.apache.tomcat.util.xml.XmlMapper;
  @@ -101,13 +104,28 @@
    *
    * @author Craig R. McClanahan
    * @author Remy Maucherat
  - * @version $Revision: 1.8 $ $Date: 2000/06/13 02:49:51 $
  + * @version $Revision: 1.9 $ $Date: 2000/06/24 19:48:56 $
    */
   
   public final class DefaultServlet
       extends HttpServlet {
   
   
  +    // -------------------------------------------------------------- Constants
  +
  +
  +    /**
  +     * Maximum file size for which content is cached. 32 ko by default.
  +     */
  +    public static final long MAX_SIZE_CACHE = 32768;
  +
  +
  +    /**
  +     * Cache entry timeout. 10s by default.
  +     */
  +    public static final long CACHE_ENTRY_TIMEOUT = 10000;
  +
  +
       // ----------------------------------------------------- Instance Variables
   
   
  @@ -163,6 +181,19 @@
       private static final String mimeSeparation = "THIS_STRING_SEPARATES";
   
   
  +    /**
  +     * File descriptor cache
  +     */
  +    private Hashtable fileCache = new Hashtable();
  +
  +
  +    /**
  +     * The string manager for this package.
  +     */
  +    private static StringManager sm =
  +	StringManager.getManager(Constants.Package);
  +
  +
       // --------------------------------------------------------- Public Methods
   
   
  @@ -303,24 +334,39 @@
        *
        * @exception IOException if an input/output error occurs
        */
  -    private void copy(File file, ServletOutputStream ostream)
  +    private void copy(CacheEntry fileInfo, ServletOutputStream ostream)
   	throws IOException {
   
  -        InputStream istream =	// FIXME: internationalization???????
  -            new BufferedInputStream(new FileInputStream(file), input);
  +        IOException exception = null;
           
  -	// Copy the input stream to the output stream
  -	IOException exception = null;
  -        if (file.length() > 0)
  -            exception = copyRange(istream, ostream);
  +        if (fileInfo.content == null) {
  +            
  +            // FIXME : i18n ?
  +            InputStream istream = new BufferedInputStream
  +                (new FileInputStream(fileInfo.file), input);
  +            
  +            // Copy the input stream to the output stream
  +            if (fileInfo.length > 0)
  +                exception = copyRange(istream, ostream);
  +            
  +            // Clean up the input and output streams
  +            try {
  +                istream.close();
  +            } catch (Throwable t) {
  +                ;
  +            }
  +            
  +        } else {
  +            
  +            try {
  +                ostream.write(fileInfo.content);
  +            } catch (IOException e) {
  +                exception = e;
  +            }
  +            
  +        }
           
  -	// Clean up the input and output streams
   	try {
  -	    istream.close();
  -	} catch (Throwable t) {
  -	    ;
  -	}
  -	try {
   	    ostream.flush();
   	} catch (Throwable t) {
   	    ;
  @@ -592,39 +638,242 @@
   
   	}
   
  -
   	// FIXME - do the directory thing
   	response.setContentType("text/html");
   	if (!content)
   	    return;
   	response.setBufferSize(output);
   	PrintWriter writer = response.getWriter();
  +        
  +        printDirectoryContents(request, directory, writer);
  +        
  +	writer.flush();
  +	writer.close();
  +
  +    }
  +
   
  -	writer.println("<html>");
  +    /**
  +     * Print directory content.
  +     * 
  +     * @param request Servlet request
  +     * @param directory File object representing this directory
  +     * @param writer Writer object
  +     *
  +     * @exception IOException if an input/output error occurs
  +     */
  +    private void printDirectoryContents(HttpServletRequest request, 
  +                                        File directory, 
  +                                        PrintWriter writer)
  +        throws IOException {
  +        
  +	String pathInfo = request.getPathInfo();
  +        String absPath = request.getPathTranslated();
  +	String requestURI = request.getRequestURI();
  +	if (pathInfo == null)
  +            pathInfo = requestURI;
  +        
  +        StringBuffer buf = new StringBuffer();
  +	
  +        buf.append("<html>\r\n");
  +        buf.append("<head>\r\n");
  +        buf.append("<title>")
  +            .append(sm.getString("defaultservlet.directorylistingfor"))
  +            .append(requestURI);
  +        buf.append("</title>\r\n</head><body bgcolor=white>\r\n");
  +
  +	buf.append("<table width=90% cellspacing=0 ");
  +	buf.append("cellpadding=5 align=center>");
  +	buf.append("<tr><td colspan=3><font size=+2><strong>");
  +	buf.append(sm.getString("defaultservlet.directorylistingfor"))
  +	    .append(requestURI);
  +	buf.append("</strong></td></tr>\r\n");
  +
  +	if (! pathInfo.equals("/")) {
  +	    buf.append("<tr><td colspan=3 bgcolor=#ffffff>");
  +	    //buf.append("<a href=\"../\">Up one directory");
  +	    
  +	    String toPath = requestURI;
   
  -	writer.println("<head>");
  -	writer.println("<title>Directory of " + request.getRequestURI() +
  -	               "</title>");
  -	writer.println("</head>");
  -
  -	writer.println("<body bgcolor=\"white\">");
  -	writer.println("Files in this directory:");
  -	writer.println("<ul>");
  -	String filenames[] = directory.list();
  -	for (int i = 0; i < filenames.length; i++) {
  -	    writer.println("<li>" + filenames[i]);
  +	    if (toPath.endsWith("/")) {
  +		toPath = toPath.substring(0, toPath.length() - 1);
  +	    }
  +	    
  +	    toPath = toPath.substring(0, toPath.lastIndexOf("/"));
  +	    
  +	    if (toPath.length() == 0) {
  +		toPath = "/";
  +	    }
  +	    
  +	    buf.append("<a href=\"" + toPath + "\"><tt>"+
  +		       sm.getString("defaultservlet.upto")+ toPath);
  +	    buf.append("</tt></a></td></tr>\r\n");
   	}
  -	writer.println("</ul>");
  -	writer.println("</body>");
   
  -	writer.println("</html>");
  -	writer.flush();
  -	writer.close();
  +	// Pre-calculate the request URI for efficiency
   
  +	// Make another URI that definitely ends with a /
  +	String slashedRequestURI = null;
  +
  +	if (requestURI.endsWith("/")) {
  +	    slashedRequestURI = requestURI;
  +	} else {
  +	    slashedRequestURI = requestURI + "/";
  +	}
  +
  +	String[] fileNames = directory.list();
  +	boolean dirsHead=true;
  +	boolean shaderow = false;
  +
  +	for (int i = 0; i < fileNames.length; i++) {
  +	    String fileName = fileNames[i];
  +
  +            // Don't display special dirs at top level
  +	    if( "/".equals(pathInfo) &&
  +		"WEB-INF".equalsIgnoreCase(fileName) ||
  +		"META-INF".equalsIgnoreCase(fileName) )
  +		continue;
  +	    
  +	    File f = new File(directory, fileName);
  +
  +	    if (f.isDirectory()) {
  +		if( dirsHead ) {
  +		    dirsHead=false;
  +		    buf.append("<tr><td colspan=3 bgcolor=#cccccc>");
  +		    buf.append("<font size=+2><strong>").
  +			append( sm.getString("defaultservlet.subdirectories")).
  +			append( "</strong>\r\n");
  +		    buf.append("</font></td></tr>\r\n");
  +		}
  +
  +                String fileN = f.getName();
  +
  +                buf.append("<tr");
  +
  +                if (shaderow) buf.append(" bgcolor=#eeeeee");
  +		shaderow = !shaderow;
  +		
  +                buf.append("><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
  +                buf.append("<tt><a href=\"")
  +		    .append(slashedRequestURI)
  +                    .append(fileN)
  +		    .append("\">")
  +		    .append(fileN)
  +                    .append("/</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
  +                    .append("</tt>\r\n");
  +                buf.append("</td><td><tt>&nbsp;&nbsp;</tt></td>");
  +                buf.append("<td align=right><tt>");
  +		buf.append(formats[0].format(new Date(f.lastModified())));
  +                buf.append("</tt></td></tr>\r\n");
  +	    }
  +	}
  +
  +	shaderow = false;
  +	buf.append("<tr><td colspan=3 bgcolor=#ffffff>&nbsp;</td></tr>");
  +	boolean fileHead=true;
  +	
  +	for (int i = 0; i < fileNames.length; i++) {
  +	    File f = new File(directory, fileNames[i]);
  +
  +	    if (f.isFile()) {
  +		String fileN = f.getName();
  +		
  +		if( fileHead ) {
  +		    fileHead=false;
  +		    buf.append("<tr><td colspan=4 bgcolor=#cccccc>");
  +		    buf.append("<font size=+2><strong>")
  +			.append(sm.getString("defaultservlet.files"))
  +			.append("</strong></font></td></tr>");
  +		}
  +
  +		buf.append("<tr");
  +
  +		if (shaderow) buf.append(" bgcolor=#eeeeee");
  +		shaderow = ! shaderow;
  +		
  +		buf.append("><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\r\n");
  +
  +		buf.append("<tt><a href=\"")
  +		    .append(slashedRequestURI)
  +		    .append(fileN).append("\">")
  +		    .append( fileN )
  +		    .append( "</a>");
  +		buf.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt>");
  +		buf.append("</td>\r\n");
  +
  +		buf.append("<td align=right><tt>");
  +		displaySize( buf, (int)f.length());
  +		buf.append("</tt></td>");
  +
  +		buf.append("<td align=right><tt>");
  +		buf.append(formats[0].format(new Date(f.lastModified())));
  +		buf.append("</tt></td></tr>\r\n");
  +	    }
  +	    
  +	    buf.append("\r\n");
  +	}
  +	
  +	buf.append("<tr><td colspan=3 bgcolor=#ffffff>&nbsp;</td></tr>");
  +	buf.append("<tr><td colspan=3 bgcolor=#cccccc>");
  +	buf.append("<font size=-1>");
  +	buf.append(Constants.TOMCAT_NAME);
  +	buf.append(" v");
  +	buf.append(Constants.TOMCAT_VERSION);
  +	buf.append("</font></td></tr></table>");
  +	
  +        buf.append("</body></html>\r\n");
  +        
  +        writer.print(buf);
  +        
       }
   
   
       /**
  +     * Display the size of a file.
  +     */
  +    private void displaySize(StringBuffer buf, int filesize) {
  +        
  +	int leftside = filesize / 1024;
  +	int rightside = (filesize % 1024) / 103;  // makes 1 digit
  +	// To avoid 0.0 for non-zero file, we bump to 0.1
  +	if (leftside == 0 && rightside == 0 && filesize != 0) 
  +	    rightside = 1;
  +	buf.append(leftside).append(".").append(rightside);
  +	buf.append(" KB");
  +        
  +    }
  +    
  +    
  +    /**
  +     * Check to see if a default page exists.
  +     * 
  +     * @param pathname Pathname of the file to be served
  +     */
  +    private CacheEntry checkWelcomeFiles(String pathname) {
  +        
  +        if (pathname.endsWith("/")) {
  +            
  +            // Serve a welcome resource or file if one exists
  +            // FIXME - update the welcome files list?
  +            for (int i = 0; i < welcomes.size(); i++) {
  +                
  +                // Does the specified resource exist?
  +                String fileName = pathname + welcomes.elementAt(i);
  +                CacheEntry fileInfo = (CacheEntry) fileCache.get(fileName);
  +                if ((fileInfo != null) && (fileInfo.isValid())) {
  +                    return fileInfo;
  +                }
  +                
  +            }
  +            
  +        }
  +        
  +        return null;
  +        
  +    }
  +
  +
  +    /**
        * Serve the specified file, optionally including the data content.
        *
        * @param request The servlet request we are processing
  @@ -641,34 +890,82 @@
                              boolean content)
   	throws IOException, ServletException {
   
  -	// Open the file (if it actually exists)
  -	File file = new File(pathname);
  -	if (!file.exists() || !file.canRead()) {
  -	    response.sendError(HttpServletResponse.SC_NOT_FOUND, pathname);
  -	    return;
  -	}
  -	if (file.isDirectory()) {
  -	    serveDirectory(request, response, file, content);
  -	    return;
  -	}
  -	if (debug > 0)
  -	    log("DefaultServlet.serveFile: Serving '" + pathname + "'");
  +        // Do a lookup in the cache
  +        CacheEntry fileInfo = (CacheEntry) fileCache.get(pathname);
  +        
  +        if (fileInfo == null) {
  +            fileInfo = checkWelcomeFiles(pathname);
  +        }
  +        
  +        if (fileInfo == null) {
  +            
  +            // Open the file (if it actually exists)
  +            File file = new File(pathname);
  +            if (!file.exists() || !file.canRead()) {
  +                response.sendError(HttpServletResponse.SC_NOT_FOUND, pathname);
  +                return;
  +            }
  +            if (file.isDirectory()) {
  +                serveDirectory(request, response, file, content);
  +                return;
  +            }
  +            if (debug > 0)
  +                log("DefaultServlet.serveFile: Serving '" + pathname + "'");
  +            
  +            fileInfo = new CacheEntry(pathname);
  +            fileCache.put(pathname, fileInfo);
  +            
  +        } else {
  +            
  +            //System.out.println("Cache hit : " + pathname);
  +            
  +            if (!fileInfo.isValid()) {
  +                
  +                //System.out.println("Cache invalid");
  +                
  +                if (!fileInfo.revalidate()) {
  +                    
  +                    fileInfo = null;
  +                    
  +                    // Open the file (if it actually exists)
  +                    File file = new File(pathname);
  +                    if (!file.exists() || !file.canRead()) {
  +                        response.sendError
  +                            (HttpServletResponse.SC_NOT_FOUND, pathname);
  +                        return;
  +                    }
  +                    if (file.isDirectory()) {
  +                        serveDirectory(request, response, file, content);
  +                        return;
  +                    }
  +                    if (debug > 0)
  +                        log("DefaultServlet.serveFile: Serving '" 
  +                            + pathname + "'");
  +                    
  +                    fileInfo = new CacheEntry(pathname);
  +                    fileCache.put(pathname, fileInfo);
  +                    
  +                }
  +            }
  +
  +        }
   
  +
           // Checking If headers
  -        if ( !checkIfHeaders(request, response, file) )
  +        if ( !checkIfHeaders(request, response, fileInfo) )
               return;
           
           // Parse range specifier
  -        Vector ranges = parseRange(request, response, file);
  +        Vector ranges = parseRange(request, response, fileInfo);
           
           // Last-Modified header
           if (debug > 0)
               log("DefaultServlet.serveFile:  lastModified='" +
  -                (new Timestamp(file.lastModified())).toString() + "'");
  -        response.setDateHeader("Last-Modified", file.lastModified());
  +                (new Timestamp(fileInfo.date)).toString() + "'");
  +        response.setDateHeader("Last-Modified", fileInfo.date);
           
           // ETag header
  -        response.setHeader("ETag", getETag(file, true));
  +        response.setHeader("ETag", getETag(fileInfo, true));
           
           // Find content type.
           String contentType = getServletContext().getMimeType(pathname);
  @@ -682,7 +979,7 @@
                           contentType + "'");
                   response.setContentType(contentType);
               }
  -            long contentLength = file.length();
  +            long contentLength = fileInfo.length;
               if (contentLength >= 0) {
                   if (debug > 0)
                       log("DefaultServlet.serveFile:  contentLength=" +
  @@ -690,13 +987,10 @@
                   response.setContentLength((int) contentLength);
               }
               
  -            InputStream istream =	// FIXME: internationalization???????
  -                new BufferedInputStream(new FileInputStream(pathname), input);
  -            
               // Copy the input stream to our output stream (if requested)
               if (content) {
                   response.setBufferSize(output);
  -                copy(file, response.getOutputStream());
  +                copy(fileInfo, response.getOutputStream());
               }
               
           } else {
  @@ -725,7 +1019,7 @@
                   
                   if (content) {
                       response.setBufferSize(output);
  -                    copy(file, response.getOutputStream(), range);
  +                    copy(fileInfo.file, response.getOutputStream(), range);
                   }
                   
               } else {
  @@ -735,7 +1029,7 @@
                   
                   if (content) {
                       response.setBufferSize(output);
  -                    copy(file, response.getOutputStream(), 
  +                    copy(fileInfo.file, response.getOutputStream(), 
                            ranges.elements(), contentType);
                   }
                   
  @@ -814,19 +1108,19 @@
        * 
        * @param request The servlet request we are processing
        * @param response The servlet response we are creating
  -     * @param file File object
  +     * @param fileInfo File object
        * @return boolean true if the resource meets all the specified conditions,
        * and false if any of the conditions is not satisfied, in which case
        * request processing is stopped
        */
       private boolean checkIfHeaders(HttpServletRequest request,
                                      HttpServletResponse response, 
  -                                   File file)
  +                                   CacheEntry fileInfo)
           throws IOException {
           
  -        String eTag = getETag(file, true);
  -        long fileLength = file.length();
  -        long lastModified = file.lastModified();
  +        String eTag = getETag(fileInfo, true);
  +        long fileLength = fileInfo.length;
  +        long lastModified = fileInfo.date;
           
           StringTokenizer commaTokenizer;
           
  @@ -922,7 +1216,7 @@
                   }
                   
               } else {
  -                if (file.exists()) {
  +                if (fileInfo.file.exists()) {
                       
                   }
               }
  @@ -960,29 +1254,29 @@
       /**
        * Get the ETag value associated with a file.
        * 
  -     * @param file File object
  +     * @param fileInfo File object
        * @param strong True if we want a strong ETag, in which case a checksum
        * of the file has to be calculated
        */
  -    private String getETagValue(File file, boolean strong) {
  +    private String getETagValue(CacheEntry fileInfo, boolean strong) {
           // FIXME : Compute a strong ETag if requested, using an MD5 digest
           // of the file contents
  -        return file.length() + "-" + file.lastModified();
  +        return fileInfo.length + "-" + fileInfo.date;
       }
   
   
       /**
        * Get the ETag associated with a file.
        * 
  -     * @param file File object
  +     * @param fileInfo File object
        * @param strong True if we want a strong ETag, in which case a checksum
        * of the file has to be calculated
        */
  -    private String getETag(File file, boolean strong) {
  +    private String getETag(CacheEntry fileInfo, boolean strong) {
           if (strong)
  -            return "\"" + getETagValue(file, strong) + "\"";
  +            return "\"" + getETagValue(fileInfo, strong) + "\"";
           else
  -            return "W/\"" + getETagValue(file, strong) + "\"";
  +            return "W/\"" + getETagValue(fileInfo, strong) + "\"";
       }
   
   
  @@ -994,15 +1288,16 @@
        * @return Vector of ranges
        */
       private Vector parseRange(HttpServletRequest request, 
  -                              HttpServletResponse response, File file) 
  +                              HttpServletResponse response, 
  +                              CacheEntry fileInfo) 
           throws IOException {
           
           // Checking If-Range
           String headerValue = request.getHeader("If-Range");
           if (headerValue != null) {
               
  -            String eTag = getETag(file, true);
  -            long lastModified = file.lastModified();
  +            String eTag = getETag(fileInfo, true);
  +            long lastModified = fileInfo.date;
               
               Date date = null;
               
  @@ -1034,7 +1329,7 @@
               
           }
           
  -        long fileLength = file.length();
  +        long fileLength = fileInfo.length;
           
           if (fileLength == 0)
               return null;
  @@ -1133,13 +1428,87 @@
            * Validate range.
            */
           public boolean validate() {
  -            if ( (start >= 0) && (end >= 0) && (length > 0)
  -                 && (start <= end) && (end < length) )
  +            return ( (start >= 0) && (end >= 0) && (length > 0)
  +                     && (start <= end) && (end < length) );
  +        }
  +        
  +    }
  +
  +
  +    // ------------------------------------------------  CacheEntry Inner Class
  +
  +
  +    private class CacheEntry {
  +
  +
  +        /**
  +         * Constructor.
  +         * 
  +         * @param pathname Path name of the file
  +         */
  +        public CacheEntry(String fileName) 
  +            throws IOException {
  +            
  +            this.validUntil = System.currentTimeMillis() + CACHE_ENTRY_TIMEOUT;
  +            this.fileName = fileName;
  +            this.file = new File(fileName);
  +            this.date = file.lastModified();
  +            this.httpDate = formats[0].format(new Date(date));
  +            this.length = file.length();
  +            
  +            // Copying the file contents into the cache, if and only if the
  +            // file size is smaller than the amount specified
  +            if (this.length < MAX_SIZE_CACHE) {
  +                content = new byte[(int) this.length];
  +                InputStream istream = new FileInputStream(file);
  +                
  +                int pos = 0;
  +                while (pos < this.length) {
  +                    pos += istream.read(content, pos, (int) this.length - pos);
  +                }
  +            }
  +            
  +        }
  +
  +
  +        public long validUntil;
  +        public String fileName;
  +        public File file;
  +        public String httpDate;
  +        public long date;
  +        public long length;
  +        public byte[] content;
  +
  +
  +        /**
  +         * Is the cache entry still valid ?
  +         */
  +        public boolean isValid() {
  +            return (System.currentTimeMillis() <= validUntil);
  +        }
  +
  +
  +        /**
  +         * Revalidate a cache entry.
  +         */
  +        public boolean revalidate() {
  +            if ((file.length() == length) && (file.lastModified() == date)) {
  +                validUntil = System.currentTimeMillis() + CACHE_ENTRY_TIMEOUT;
                   return true;
  -            else
  +            } else {
                   return false;
  +            }
           }
  -        
  +
  +
  +        /**
  +         * String representation.
  +         */
  +        public String toString() {
  +            return fileName;
  +        }
  +
  +
       }
   
   
  
  
  
  1.1                  jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/servlets/Constants.java
  
  Index: Constants.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/servlets/Constants.java,v
1.1 2000/06/24 19:48:56 remm Exp $
   * $Revision: 1.1 $
   * $Date: 2000/06/24 19:48:56 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */ 
  
  
  package org.apache.tomcat.servlets;
  
  
  public class Constants {
  
      public static final String Package = "org.apache.tomcat.servlets";
  
      public static final String TOMCAT_NAME = "Tomcat Catalina";
  
      public static final String TOMCAT_VERSION = "4.0";
  
  }
  
  
  
  
  1.1                  jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/servlets/LocalStrings.properties
  
  Index: LocalStrings.properties
  ===================================================================
  defaultservlet.directorylistingfor=Directory Listing for:
  defaultservlet.upto=Up to:
  defaultservlet.subdirectories=Subdirectories:
  defaultservlet.files=Files:
  
  
  

Mime
View raw message