tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteRequest.java CoyoteResponse.java
Date Fri, 03 Jan 2003 19:31:54 GMT
remm        2003/01/03 11:31:54

  Modified:    coyote/src/java/org/apache/coyote/tomcat5 CoyoteRequest.java
                        CoyoteResponse.java
  Log:
  - Implement getDateHeader and setDateHeader using FastHttpDateFormat.
  
  Revision  Changes    Path
  1.13      +22 -15    jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteRequest.java
  
  Index: CoyoteRequest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteRequest.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- CoyoteRequest.java	17 Dec 2002 20:07:38 -0000	1.12
  +++ CoyoteRequest.java	3 Jan 2003 19:31:54 -0000	1.13
  @@ -82,6 +82,7 @@
   import java.util.Iterator;
   import java.util.Locale;
   import java.util.Map;
  +import java.util.TimeZone;
   import java.util.TreeMap;
   
   import javax.servlet.FilterChain;
  @@ -99,6 +100,7 @@
   import javax.servlet.http.HttpServletResponse;
   import javax.servlet.http.HttpSession;
   
  +import org.apache.tomcat.util.http.FastHttpDateFormat;
   import org.apache.tomcat.util.http.Parameters;
   
   import org.apache.coyote.ActionCode;
  @@ -134,6 +136,19 @@
   public class CoyoteRequest
       implements HttpRequest, HttpServletRequest {
   
  +
  +    // ----------------------------------------------------------- Constructors
  +
  +
  +    public CoyoteRequest() {
  +
  +        formats[0].setTimeZone(TimeZone.getTimeZone("GMT"));
  +        formats[1].setTimeZone(TimeZone.getTimeZone("GMT"));
  +        formats[2].setTimeZone(TimeZone.getTimeZone("GMT"));
  +
  +    }
  +
  +
       // ------------------------------------------------------------- Properties
   
   
  @@ -1618,18 +1633,10 @@
           if (value == null)
               return (-1L);
   
  -        // Work around a bug in SimpleDateFormat in pre-JDK1.2b4
  -        // (Bug Parade bug #4106807)
  -        value += " ";
  -
           // Attempt to convert the date header in a variety of formats
  -        for (int i = 0; i < formats.length; i++) {
  -            try {
  -                Date date = formats[i].parse(value);
  -                return (date.getTime());
  -            } catch (ParseException e) {
  -                ;
  -            }
  +        long result = FastHttpDateFormat.parseDate(value, formats);
  +        if (result != (-1L)) {
  +            return result;
           }
           throw new IllegalArgumentException(value);
   
  
  
  
  1.17      +7 -6      jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteResponse.java
  
  Index: CoyoteResponse.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteResponse.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- CoyoteResponse.java	19 Dec 2002 09:08:50 -0000	1.16
  +++ CoyoteResponse.java	3 Jan 2003 19:31:54 -0000	1.17
  @@ -92,6 +92,7 @@
   
   import org.apache.tomcat.util.buf.CharChunk;
   import org.apache.tomcat.util.buf.UEncoder;
  +import org.apache.tomcat.util.http.FastHttpDateFormat;
   import org.apache.tomcat.util.http.MimeHeaders;
   import org.apache.tomcat.util.http.ServerCookie;
   import org.apache.tomcat.util.net.URL;
  @@ -941,7 +942,7 @@
           if (included)
               return;
   
  -        addHeader(name, format.format(new Date(value)));
  +        addHeader(name, FastHttpDateFormat.formatDate(value, format));
   
       }
   
  @@ -1192,7 +1193,7 @@
           if (included)
               return;
   
  -        setHeader(name, format.format(new Date(value)));
  +        setHeader(name, FastHttpDateFormat.formatDate(value, format));
   
       }
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message