Top Description Fields Constructors Methods
org.apache.tomcat.util.http

public final Class FastHttpDateFormat

extends Object
Class Inheritance
Imports
java.text.ParseException, java.util.Date, .Locale, .Map, .TimeZone, java.util.concurrent.ConcurrentHashMap

Utility class to generate HTTP dates.
Author
Remy Maucherat

Field Summary

Modifier and TypeField and Description
private static final int
private static String
currentDate

Current formatted date.

private static volatile long
currentDateGenerated

Instant on which the currentDate object was generated.

private static final String
private static final String
private static final String
private static final ConcurrentDateFormat
private static final ConcurrentDateFormat
private static final ConcurrentDateFormat
private static final Map<Long, String>
formatCache

Formatter cache.

private static final ConcurrentDateFormat[]
private static final Map<String, Long>
parseCache

Parser cache.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static String

Returns:

the HTTP date
formatDate
(long
The date
value
)

Get the HTTP format of the specified date.

public static String

Returns:

the HTTP date
getCurrentDate
()

Get the current date in HTTP format.

public static long

Returns:

the date as a long or -1 if the value cannot be parsed
parseDate
(String
The HTTP date
value
)

Try to parse the given date as an HTTP date.

private static void
updateFormatCache(Long key, String value)

Update cache.

private static void
updateParseCache(String key, Long value)

Update cache.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CACHE_SIZEback to summary
private static final int CACHE_SIZE
currentDateback to summary
private static String currentDate

Current formatted date.

currentDateGeneratedback to summary
private static volatile long currentDateGenerated

Instant on which the currentDate object was generated.

DATE_OBSOLETE_ASCTIMEback to summary
private static final String DATE_OBSOLETE_ASCTIME
DATE_OBSOLETE_RFC850back to summary
private static final String DATE_OBSOLETE_RFC850
DATE_RFC5322back to summary
private static final String DATE_RFC5322
FORMAT_OBSOLETE_ASCTIMEback to summary
private static final ConcurrentDateFormat FORMAT_OBSOLETE_ASCTIME
FORMAT_OBSOLETE_RFC850back to summary
private static final ConcurrentDateFormat FORMAT_OBSOLETE_RFC850
FORMAT_RFC5322back to summary
private static final ConcurrentDateFormat FORMAT_RFC5322
formatCacheback to summary
private static final Map<Long, String> formatCache

Formatter cache.

httpParseFormatsback to summary
private static final ConcurrentDateFormat[] httpParseFormats
parseCacheback to summary
private static final Map<String, Long> parseCache

Parser cache.

Constructor Detail

FastHttpDateFormatback to summary
public FastHttpDateFormat()

Method Detail

formatDateback to summary
public static String formatDate(long value)

Get the HTTP format of the specified date.

Parameters
value:long

The date

Returns:String

the HTTP date

getCurrentDateback to summary
public static String getCurrentDate()

Get the current date in HTTP format.

Returns:String

the HTTP date

parseDateback to summary
public static long parseDate(String value)

Try to parse the given date as an HTTP date.

Parameters
value:String

The HTTP date

Returns:long

the date as a long or -1 if the value cannot be parsed

updateFormatCacheback to summary
private static void updateFormatCache(Long key, String value)

Update cache.

updateParseCacheback to summary
private static void updateParseCache(String key, Long value)

Update cache.