Fields Summary |
---|
private static final Locale | LOCALE_USUS locale - all HTTP dates are in english |
public static final TimeZone | GMT_ZONEGMT timezone - all HTTP dates are on GMT |
public static final String | RFC1123_PATTERNformat for RFC 1123 date string -- "Sun, 06 Nov 1994 08:49:37 GMT" |
public static final String | rfc1036Pattern |
public static final String | asctimePattern |
private static final String | OLD_COOKIE_PATTERNPattern used for old cookies |
private static final DateFormat | rfc1123FormatDateFormat to be used to format dates. Called from MessageBytes |
private static final DateFormat | oldCookieFormatDateFormat to be used to format old netscape cookies
Called from ServerCookie |
private static final DateFormat | rfc1036Format |
private static final DateFormat | asctimeFormat |
private static String | rfc1123DS |
private static long | rfc1123Sec |
private static org.apache.tomcat.util.res.StringManager | sm |
Methods Summary |
---|
public static java.lang.String | format1123(java.util.Date d)
String dstr=null;
synchronized(rfc1123Format) {
dstr = format1123(d, rfc1123Format);
}
return dstr;
|
public static java.lang.String | format1123(java.util.Date d, java.text.DateFormat df)
long dt = d.getTime() / 1000;
if ((rfc1123DS != null) && (dt == rfc1123Sec))
return rfc1123DS;
rfc1123DS = df.format( d );
rfc1123Sec = dt;
return rfc1123DS;
|
public static void | formatOldCookie(java.util.Date d, java.lang.StringBuffer sb, java.text.FieldPosition fp)
synchronized(oldCookieFormat) {
oldCookieFormat.format( d, sb, fp );
}
|
public static java.lang.String | formatOldCookie(java.util.Date d)
String ocf=null;
synchronized(oldCookieFormat) {
ocf= oldCookieFormat.format( d );
}
return ocf;
|
static long | parseDate(MessageBytes value)
// Called from MessageBytes.getTime()
return parseDate( value.toString());
|
public static long | parseDate(java.lang.String dateString)Called from HttpServletRequest.getDateHeader().
Not efficient - but not very used.
DateFormat [] format = {rfc1123Format,rfc1036Format,asctimeFormat};
return parseDate(dateString,format);
|
public static long | parseDate(java.lang.String dateString, java.text.DateFormat[] format)
Date date=null;
for(int i=0; i < format.length; i++) {
try {
date = format[i].parse(dateString);
return date.getTime();
} catch (ParseException e) { }
catch (StringIndexOutOfBoundsException e) { }
}
String msg = sm.getString("httpDate.pe", dateString);
throw new IllegalArgumentException(msg);
|