Class HttpDateFormat

java.lang.Object
org.glassfish.jersey.message.internal.HttpDateFormat

public final class HttpDateFormat extends Object
Helper class for HTTP specified date formats.
  • Field Details

    • RFC1123_DATE_FORMAT_PATTERN

      private static final String RFC1123_DATE_FORMAT_PATTERN
      The date format pattern for RFC 1123.
      See Also:
    • RFC1036_DATE_FORMAT_PATTERN

      private static final String RFC1036_DATE_FORMAT_PATTERN
      The date format pattern for RFC 1036.
      See Also:
    • ANSI_C_ASCTIME_DATE_FORMAT_PATTERN

      private static final String ANSI_C_ASCTIME_DATE_FORMAT_PATTERN
      The date format pattern for ANSI C asctime().
      See Also:
    • GMT_TIME_ZONE

      private static final TimeZone GMT_TIME_ZONE
    • dateFormats

      private static final ThreadLocal<List<SimpleDateFormat>> dateFormats
  • Constructor Details

    • HttpDateFormat

      private HttpDateFormat()
  • Method Details

    • createDateFormats

      private static List<SimpleDateFormat> createDateFormats()
    • getDateFormats

      private static List<SimpleDateFormat> getDateFormats()
      Return an unmodifiable list of HTTP specified date formats to use for parsing or formatting Date.

      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 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 Date readDate(String date) throws ParseException
      Read a date.
      Parameters:
      date - the date as a string.
      Returns:
      the date
      Throws:
      ParseException - in case the date string cannot be parsed.