public class FastHttpDateFormat
extends java.lang.Object
Utility class to generate HTTP dates.
This class is based on code in Apache Tomcat.
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
currentDate
Current formatted date.
|
protected static long |
currentDateGenerated
Instant on which the currentDate object was generated.
|
protected static java.text.SimpleDateFormat |
format
HTTP date format.
|
protected static java.util.HashMap |
formatCache
Formatter cache.
|
protected static java.text.SimpleDateFormat[] |
formats
The set of SimpleDateFormat formats to use in
getDateHeader() . |
protected static java.util.TimeZone |
gmtZone
GMT timezone - all HTTP dates are on GMT
|
protected static java.util.HashMap |
parseCache
Parser cache.
|
Constructor and Description |
---|
FastHttpDateFormat() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
formatDate(long value,
java.text.DateFormat threadLocalformat)
Formats a specified date to HTTP format.
|
static java.lang.String |
getCurrentDate()
Gets the current date in HTTP format.
|
static long |
parseDate(java.lang.String value,
java.text.DateFormat[] threadLocalformats)
Tries to parse the given date as an HTTP date.
|
protected static final java.text.SimpleDateFormat format
protected static final java.text.SimpleDateFormat[] formats
getDateHeader()
.protected static final java.util.TimeZone gmtZone
protected static long currentDateGenerated
protected static java.lang.String currentDate
protected static final java.util.HashMap formatCache
protected static final java.util.HashMap parseCache
public static final java.lang.String formatDate(long value, java.text.DateFormat threadLocalformat)
null
, it's used instead.value
- Date value to formatthreadLocalformat
- The format to use (or null
-- then HTTP format will be used)public static final java.lang.String getCurrentDate()
public static final long parseDate(java.lang.String value, java.text.DateFormat[] threadLocalformats)
null
, it's used
instead.value
- The string to parsethreadLocalformats
- Array of formats to use for parsing. If null
, HTTP formats are used.