tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From na...@apache.org
Subject cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/generators StaticInterceptor.java
Date Sat, 24 Mar 2001 21:33:53 GMT
nacho       01/03/24 13:33:53

  Modified:    src/share/org/apache/tomcat/modules/generators
                        StaticInterceptor.java
  Log:
  tuneup If-Modified-Since honoring 3.3 style..
  
  MessageBytes has inside all the needed RFC dates parsing things..
  
  Revision  Changes    Path
  1.10      +5 -21     jakarta-tomcat/src/share/org/apache/tomcat/modules/generators/StaticInterceptor.java
  
  Index: StaticInterceptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/generators/StaticInterceptor.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- StaticInterceptor.java	2001/03/24 19:56:06	1.9
  +++ StaticInterceptor.java	2001/03/24 21:33:53	1.10
  @@ -62,6 +62,7 @@
   import org.apache.tomcat.util.res.StringManager;
   import org.apache.tomcat.util.io.FileUtil;
   import org.apache.tomcat.util.http.*;
  +import org.apache.tomcat.util.buf.*;
   import java.io.*;
   import java.net.*;
   import java.text.*;
  @@ -240,14 +241,6 @@
   final class FileHandler extends Handler  {
       int realFileNote;
       Context context;
  -    /**
  -     * The set of SimpleDateFormat formats to use in getDateHeader().
  -     */
  -    protected static final SimpleDateFormat formats[] = {
  -	new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US),
  -	new SimpleDateFormat("EEEEEE, dd-MMM-yy HH:mm:ss zzz", Locale.US),
  -	new SimpleDateFormat("EEE MMMM d HH:mm:ss yyyy", Locale.US)
  -    };
   
       FileHandler() {
   	//	setOrigin( Handler.ORIGIN_INTERNAL );
  @@ -291,22 +284,13 @@
   	}
   
   	File file = new File( absPath );
  -        String headerValue=req.getHeader("If-Modified-Since");
  -        if (headerValue != null) {
  +        MessageBytes imsMB=req.getMimeHeaders().getValue("If-Modified-Since");
   
  -            Date date = null;
  +        if (imsMB != null) {
   
  -            // Parsing the HTTP Date
  -            for (int i = 0; (date == null) && (i < formats.length); i++) {
  -                try {
  -                    date = formats[i].parse(headerValue);
  -                } catch (ParseException e) {
  -                    ;
  -                }
  -            }
  +            long date = imsMB.getTime();
   
  -            if ((date != null)
  -                && (file.lastModified() <= (date.getTime() + 1000)) ) {
  +            if ((file.lastModified() <= (date + 1000)) ) {
                   // The entity has not been modified since the date
                   // specified by the client. This is not an error case.
                   context.getContextManager().handleStatus( req, res, 304);
  
  
  

Mime
View raw message