Class HttpDateFormat
- java.lang.Object
-
- org.glassfish.jersey.message.internal.HttpDateFormat
-
public final class HttpDateFormat extends java.lang.Object
Helper class for HTTP specified date formats.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
ANSI_C_ASCTIME_DATE_FORMAT_PATTERN
The date format pattern for ANSI C asctime().private static java.lang.ThreadLocal<java.util.List<java.text.SimpleDateFormat>>
dateFormats
private static java.util.TimeZone
GMT_TIME_ZONE
private static java.lang.String
RFC1036_DATE_FORMAT_PATTERN
The date format pattern for RFC 1036.private static java.lang.String
RFC1123_DATE_FORMAT_PATTERN
The date format pattern for RFC 1123.
-
Constructor Summary
Constructors Modifier Constructor Description private
HttpDateFormat()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static java.util.List<java.text.SimpleDateFormat>
createDateFormats()
private static java.util.List<java.text.SimpleDateFormat>
getDateFormats()
Return an unmodifiable list of HTTP specified date formats to use for parsing or formattingDate
.static java.text.SimpleDateFormat
getPreferredDateFormat()
Get the preferred HTTP specified date format (RFC 1123).static java.util.Date
readDate(java.lang.String date)
Read a date.
-
-
-
Field Detail
-
RFC1123_DATE_FORMAT_PATTERN
private static final java.lang.String RFC1123_DATE_FORMAT_PATTERN
The date format pattern for RFC 1123.- See Also:
- Constant Field Values
-
RFC1036_DATE_FORMAT_PATTERN
private static final java.lang.String RFC1036_DATE_FORMAT_PATTERN
The date format pattern for RFC 1036.- See Also:
- Constant Field Values
-
ANSI_C_ASCTIME_DATE_FORMAT_PATTERN
private static final java.lang.String ANSI_C_ASCTIME_DATE_FORMAT_PATTERN
The date format pattern for ANSI C asctime().- See Also:
- Constant Field Values
-
GMT_TIME_ZONE
private static final java.util.TimeZone GMT_TIME_ZONE
-
dateFormats
private static final java.lang.ThreadLocal<java.util.List<java.text.SimpleDateFormat>> dateFormats
-
-
Method Detail
-
createDateFormats
private static java.util.List<java.text.SimpleDateFormat> createDateFormats()
-
getDateFormats
private static java.util.List<java.text.SimpleDateFormat> getDateFormats()
Return an unmodifiable list of HTTP specified date formats to use for parsing or formattingDate
.The list of date formats are scoped to the current thread and may be used without requiring to synchronize access to the instances when parsing or formatting.
- Returns:
- the list of data formats.
-
getPreferredDateFormat
public static java.text.SimpleDateFormat getPreferredDateFormat()
Get the preferred HTTP specified date format (RFC 1123).The date format is scoped to the current thread and may be used without requiring to synchronize access to the instance when parsing or formatting.
- Returns:
- the preferred of data format.
-
readDate
public static java.util.Date readDate(java.lang.String date) throws java.text.ParseException
Read a date.- Parameters:
date
- the date as a string.- Returns:
- the date
- Throws:
java.text.ParseException
- in case the date string cannot be parsed.
-
-