costin 01/05/26 10:18:54
Modified: src/share/org/apache/tomcat/util/buf DateTool.java
Log:
Added comments about deprecation of few methods. The whole thing must
be replaced with FastDateFormat.
Revision Changes Path
1.3 +45 -14
jakarta-tomcat/src/share/org/apache/tomcat/util/buf/DateTool.java
Index: DateTool.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/buf/DateTool.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DateTool.java 2001/05/21 15:07:17 1.2
+++ DateTool.java 2001/05/26 17:18:54 1.3
@@ -69,6 +69,8 @@
/**
* Common place for date utils.
*
+ * @deprecated Will be replaced with a more efficient impl, based on
+ * FastDateFormat, with an API using less objects.
* @author [EMAIL PROTECTED]
* @author Jason Hunter [[EMAIL PROTECTED]]
* @author James Todd [[EMAIL PROTECTED]]
@@ -78,16 +80,16 @@
/** US locale - all HTTP dates are in english
*/
- public final static Locale LOCALE_US = Locale.US;
+ private final static Locale LOCALE_US = Locale.US;
/** GMT timezone - all HTTP dates are on GMT
*/
- public final static TimeZone GMT_ZONE = TimeZone.getTimeZone("GMT");
+ private final static TimeZone GMT_ZONE = TimeZone.getTimeZone("GMT");
/** format for RFC 1123 date string -- "Sun, 06 Nov 1994 08:49:37 GMT"
*/
- public final static String RFC1123_PATTERN =
- "EEE, dd MMM yyyyy HH:mm:ss z";
+ private final static String RFC1123_PATTERN =
+ "EEE, dd MMM yyyy HH:mm:ss z";
// format for RFC 1036 date string -- "Sunday, 06-Nov-94 08:49:37 GMT"
private final static String rfc1036Pattern =
@@ -95,26 +97,27 @@
// format for C asctime() date string -- "Sun Nov 6 08:49:37 1994"
private final static String asctimePattern =
- "EEE MMM d HH:mm:ss yyyyy";
+ "EEE MMM d HH:mm:ss yyyy";
/** Pattern used for old cookies
*/
- public final static String OLD_COOKIE_PATTERN = "EEE, dd-MMM-yyyy HH:mm:ss z";
+ private final static String OLD_COOKIE_PATTERN = "EEE, dd-MMM-yyyy HH:mm:ss z";
- /** DateFormat to be used to format dates
+ /** DateFormat to be used to format dates. Called from MessageBytes
*/
- public final static DateFormat rfc1123Format =
+ private final static DateFormat rfc1123Format =
new SimpleDateFormat(RFC1123_PATTERN, LOCALE_US);
/** DateFormat to be used to format old netscape cookies
+ Called from ServerCookie
*/
- public final static DateFormat oldCookieFormat =
+ private final static DateFormat oldCookieFormat =
new SimpleDateFormat(OLD_COOKIE_PATTERN, LOCALE_US);
- public final static DateFormat rfc1036Format =
+ private final static DateFormat rfc1036Format =
new SimpleDateFormat(rfc1036Pattern, LOCALE_US);
- public final static DateFormat asctimeFormat =
+ private final static DateFormat asctimeFormat =
new SimpleDateFormat(asctimePattern, LOCALE_US);
static {
@@ -126,11 +129,39 @@
private static StringManager sm =
StringManager.getManager("org.apache.tomcat.resources");
-
- public static long parseDate( MessageBytes value ) {
- return parseDate( value.toString());
+
+ // Called from MessageBytes.getTime()
+ static long parseDate( MessageBytes value ) {
+ return parseDate( value.toString());
+ }
+
+ // Called from MessageBytes.setTime
+ /**
+ */
+ public static String format1123( Date d ) {
+ return rfc1123Format.format( d );
+ }
+
+
+ // Called from ServerCookie
+ /**
+ */
+ public static void formatOldCookie( Date d, StringBuffer sb,
+ FieldPosition fp )
+ {
+ oldCookieFormat.format( d, sb, fp );
+ }
+
+ // Called from ServerCookie
+ public static String formatOldCookie( Date d )
+ {
+ return oldCookieFormat.format( d );
}
+
+ /** Called from HttpServletRequest.getDateHeader().
+ Not efficient - but not very used.
+ */
public static long parseDate( String dateString ) {
Date date=null;
try {