Class FastHttpDateFormat
java.lang.Object
org.springframework.security.web.savedrequest.FastHttpDateFormat
Utility class to generate HTTP dates.
This class is based on code in Apache Tomcat.
-
Field Summary
Modifier and TypeFieldDescriptionprotected static String
Current formatted date.protected static long
Instant on which the currentDate object was generated.protected static final SimpleDateFormat
HTTP date format.Formatter cache.protected static final SimpleDateFormat[]
The set of SimpleDateFormat formats to use ingetDateHeader()
.protected static final TimeZone
GMT time zone - all HTTP dates are on GMTParser cache. -
Method Summary
Modifier and TypeMethodDescriptionstatic String
formatDate
(long value, DateFormat threadLocalformat) Formats a specified date to HTTP format.static String
Gets the current date in HTTP format.static long
parseDate
(String value, DateFormat[] threadLocalformats) Tries to parse the given date as an HTTP date.
-
Field Details
-
format
HTTP date format. -
formats
The set of SimpleDateFormat formats to use ingetDateHeader()
. -
gmtZone
GMT time zone - all HTTP dates are on GMT -
currentDateGenerated
protected static long currentDateGeneratedInstant on which the currentDate object was generated. -
currentDate
Current formatted date. -
formatCache
Formatter cache. -
parseCache
Parser cache.
-
-
Method Details
-
formatDate
Formats a specified date to HTTP format. If local format is notnull
, it's used instead.- Parameters:
value
- Date value to formatthreadLocalformat
- The format to use (ornull
-- then HTTP format will be used)- Returns:
- Formatted date
-
getCurrentDate
Gets the current date in HTTP format.- Returns:
- Current date in HTTP format
-
parseDate
Tries to parse the given date as an HTTP date. If local format list is notnull
, it's used instead.- Parameters:
value
- The string to parsethreadLocalformats
- Array of formats to use for parsing. Ifnull
, HTTP formats are used.- Returns:
- Parsed date (or -1 if error occurred)
-