Class HttpDateTimeFormatter

java.lang.Object
org.apache.jackrabbit.webdav.util.HttpDateTimeFormatter

public class HttpDateTimeFormatter extends Object
Parsers and Serializers for HTTP dates (RFC 7231, Section 7.1.1.1), using DateTimeFormatter (from Java 8).
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    format(long millisSinceEpoch)
    Format as HTTP default date (IMF-fixdate) (see RFC 7231, Section 7.1.1.1)
    static String
    formatAscTime(long millisSinceEpoch)
    Format as HTTP "asctime-date" (see RFC 7231, Section 7.1.1.1)
    static String
    formatImfFixed(long millisSinceEpoch)
    Format as HTTP "IMF-fixdate" (see RFC 7231, Section 7.1.1.1)
    static String
    formatRfc850(long millisSinceEpoch)
    Format as HTTP "rfc850-date" (see RFC 7231, Section 7.1.1.1)
    static long
    parse(String fieldValue)
    Parse HTTP format, trying the three allowable formats defined in RFC 7231, Section 7.1.1.1
    static long
    Parse HTTP "asctime-date" format (see RFC 7231, Section 7.1.1.1)
    static long
    Parse HTTP "IMF-fixdate" format (see RFC 7231, Section 7.1.1.1)
    static long
    parseRfc850Date(String fieldValue)
    Parse HTTP "rfc850-date" format (see RFC 7231, Section 7.1.1.1)

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • HttpDateTimeFormatter

      public HttpDateTimeFormatter()
  • Method Details

    • parseImfFixedDate

      public static long parseImfFixedDate(String fieldValue)
      Parse HTTP "IMF-fixdate" format (see RFC 7231, Section 7.1.1.1)
      Parameters:
      fieldValue - string value
      Returns:
      ms since epoch throws DateTimeParseException on invalid input
    • parseRfc850Date

      public static long parseRfc850Date(String fieldValue)
      Parse HTTP "rfc850-date" format (see RFC 7231, Section 7.1.1.1)
      Parameters:
      fieldValue - string value
      Returns:
      ms since epoch throws DateTimeParseException on invalid input
    • parseAscTimeDate

      public static long parseAscTimeDate(String fieldValue)
      Parse HTTP "asctime-date" format (see RFC 7231, Section 7.1.1.1)
      Parameters:
      fieldValue - string value
      Returns:
      ms since epoch throws DateTimeParseException on invalid input
    • parse

      public static long parse(String fieldValue)
      Parse HTTP format, trying the three allowable formats defined in RFC 7231, Section 7.1.1.1
      Parameters:
      fieldValue - string value
      Returns:
      ms since epoch throws DateTimeParseException on invalid input
    • format

      public static String format(long millisSinceEpoch)
      Format as HTTP default date (IMF-fixdate) (see RFC 7231, Section 7.1.1.1)
      Parameters:
      millisSinceEpoch - ms since epoch
      Returns:
      string representation
    • formatImfFixed

      public static String formatImfFixed(long millisSinceEpoch)
      Format as HTTP "IMF-fixdate" (see RFC 7231, Section 7.1.1.1)
      Parameters:
      millisSinceEpoch - ms since epoch
      Returns:
      string representation
    • formatRfc850

      public static String formatRfc850(long millisSinceEpoch)
      Format as HTTP "rfc850-date" (see RFC 7231, Section 7.1.1.1)
      Parameters:
      millisSinceEpoch - ms since epoch
      Returns:
      string representation
    • formatAscTime

      public static String formatAscTime(long millisSinceEpoch)
      Format as HTTP "asctime-date" (see RFC 7231, Section 7.1.1.1)
      Parameters:
      millisSinceEpoch - ms since epoch
      Returns:
      string representation