tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@apache.org
Subject cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util/http AcceptLanguage.java ContentType.java ServerCookie.java
Date Sat, 26 May 2001 17:27:20 GMT
costin      01/05/26 10:27:20

  Modified:    src/share/org/apache/tomcat/util/http AcceptLanguage.java
                        ContentType.java ServerCookie.java
  Log:
  Added few more comments.
  
  Fixed ContentType detection ( didn't worked corectly, the value "guessed"
  from locale was overriding the user-specified value )
  
  Update ServerCookie to call methods in DateTool ( so later we can move the
  code from FastDateFormat ). ( previously it just used a static field )
  
  Revision  Changes    Path
  1.4       +4 -1      jakarta-tomcat/src/share/org/apache/tomcat/util/http/AcceptLanguage.java
  
  Index: AcceptLanguage.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/http/AcceptLanguage.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AcceptLanguage.java	2001/02/20 03:14:11	1.3
  +++ AcceptLanguage.java	2001/05/26 17:27:19	1.4
  @@ -65,7 +65,10 @@
   import java.text.*;
   
   /**
  - * 
  + * Util to process the "Accept-Language" header. Used by facade to implement
  + * getLocale() and by StaticInterceptor.
  + *
  + * Not optimized - it's very slow.
    * 
    * @author James Duncan Davidson [duncan@eng.sun.com]
    * @author James Todd [gonzo@eng.sun.com]
  
  
  
  1.5       +22 -19    jakarta-tomcat/src/share/org/apache/tomcat/util/http/ContentType.java
  
  Index: ContentType.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/http/ContentType.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ContentType.java	2001/03/15 23:06:18	1.4
  +++ ContentType.java	2001/05/26 17:27:19	1.5
  @@ -89,7 +89,7 @@
           if (charsetLocation == -1) {
               return null;
           }
  -        String afterCharset = type.substring(charsetLocation + 8);
  +	String afterCharset = type.substring(charsetLocation + 8);
           // The charset value in a Content-Type header is allowed to be quoted
           // and charset values can't contain quotes.  Just convert any quote
           // chars into spaces and let trim clean things up.
  @@ -98,25 +98,28 @@
           return encoding;
       }
   
  -    /** Utility method for parsing the mime type and setting
  -     *  the encoding to locale. Also, convert from java Locale to mime
  -     * encodings
  -     */
  -    public static String constructLocalizedContentType(String type,
  -							Locale loc) {
  -        // Cut off everything after the semicolon
  -        int semi = type.indexOf(";");
  -        if (semi != -1) {
  -            type = type.substring(0, semi);
  -        }
   
  -        // Append the appropriate charset, based on the locale
  -        String charset = LocaleToCharsetMap.getCharset(loc);
  -        if (charset != null) {
  -            type = type + "; charset=" + charset;
  -        }
  +    // Bad method: the user may set the charset explicitely
  +    
  +//     /** Utility method for parsing the mime type and setting
  +//      *  the encoding to locale. Also, convert from java Locale to mime
  +//      *  encodings
  +//      */
  +//     public static String constructLocalizedContentType(String type,
  +// 							Locale loc) {
  +//         // Cut off everything after the semicolon
  +//         int semi = type.indexOf(";");
  +//         if (semi != -1) {
  +//             type = type.substring(0, semi);
  +//         }
   
  -        return type;
  -    }
  +//         // Append the appropriate charset, based on the locale
  +//         String charset = LocaleToCharsetMap.getCharset(loc);
  +//         if (charset != null) {
  +//             type = type + "; charset=" + charset;
  +//         }
  +
  +//         return type;
  +//     }
   
   }
  
  
  
  1.9       +2 -3      jakarta-tomcat/src/share/org/apache/tomcat/util/http/ServerCookie.java
  
  Index: ServerCookie.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/http/ServerCookie.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ServerCookie.java	2001/02/20 03:14:11	1.8
  +++ ServerCookie.java	2001/05/26 17:27:19	1.9
  @@ -230,8 +230,7 @@
           }
       }
   
  -    private static final String ancientDate=DateTool.oldCookieFormat
  -	.format(new Date(10000));
  +    private static final String ancientDate=DateTool.formatOldCookie(new Date(10000));
   
       public static void appendCookieValue( StringBuffer buf,
   					  int version,
  @@ -280,7 +279,7 @@
                   if (maxAge == 0)
   		    buf.append( ancientDate );
   		else
  -                    DateTool.oldCookieFormat.format
  +                    DateTool.formatOldCookie
                           (new Date( System.currentTimeMillis() +
                                      maxAge *1000L), buf,
                            new FieldPosition(0));
  
  
  

Mime
View raw message