cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject cvs commit: cocoon-2.1/src/java/org/apache/cocoon/acting HttpCacheAction.java
Date Sun, 11 Jul 2004 13:22:40 GMT
antonio     2004/07/11 06:22:40

  Modified:    src/java/org/apache/cocoon/acting HttpCacheAction.java
  Log:
  Change SimpleDateFormat to FastDateFormat.
  The FastDateFormatter is threadsafe.
  SimpleDateFormat is NOT thread safe.
  
  Revision  Changes    Path
  1.3       +7 -8      cocoon-2.1/src/java/org/apache/cocoon/acting/HttpCacheAction.java
  
  Index: HttpCacheAction.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/acting/HttpCacheAction.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HttpCacheAction.java	11 Jul 2004 13:08:44 -0000	1.2
  +++ HttpCacheAction.java	11 Jul 2004 13:22:40 -0000	1.3
  @@ -24,8 +24,8 @@
   import org.apache.cocoon.environment.Response;
   import org.apache.cocoon.environment.SourceResolver;
   import org.apache.commons.lang.time.DateUtils;
  +import org.apache.commons.lang.time.FastDateFormat;
   
  -import java.text.SimpleDateFormat;
   import java.util.Calendar;
   import java.util.Collections;
   import java.util.HashMap;
  @@ -84,7 +84,7 @@
    */
   public class HttpCacheAction extends AbstractConfigurableAction implements ThreadSafe {
   
  -    private SimpleDateFormat formatter = null;
  +    private FastDateFormat formatter = null;
       int days = 0;
       int hours = 0;
       int minutes = 0;
  @@ -94,9 +94,8 @@
       throws ConfigurationException {
           super.configure(configuration);
   
  -        /* RFC-822 Date with a GMT based time zone */
  -        this.formatter = new SimpleDateFormat("EEE, dd MMM yyyy kk:mm:ss zzz");
  -        this.formatter.setTimeZone(DateUtils.UTC_TIME_ZONE);
  +        // RFC-822 Date with a GMT based time zone
  +        this.formatter = FastDateFormat.getInstance("EEE, dd MMM yyyy kk:mm:ss zzz", DateUtils.UTC_TIME_ZONE);
           this.days = configuration.getChild("days").getValueAsInteger(0);
           this.hours = configuration.getChild("hours").getValueAsInteger(0);
           this.minutes = configuration.getChild("minutes").getValueAsInteger(0);
  @@ -111,7 +110,7 @@
           Map values = new HashMap(3);
   
           /* Get the current time and output as the last modified header */
  -        String value = this.formatter.format(calendar.getTime());
  +        String value = this.formatter.format(calendar);
           long maxage = calendar.getTime().getTime();
           response.setHeader("Last-Modified", value);
           values.put("last-modified",  value);
  @@ -127,7 +126,7 @@
   
           /* If we got more than one second everything is quite normal */
           if (maxage > 1000) {
  -            value = this.formatter.format(calendar.getTime());
  +            value = this.formatter.format(calendar);
               response.setHeader("Expires", value);
               values.put("expires", value);
   
  
  
  

Mime
View raw message