java.lang.Object
org.glassfish.grizzly.http.util.HttpDateFormat
Utility class to generate HTTP dates.
This class is based on
FastHttpDateFormat,
but uses java.time API instead of the old java.util.Date/Calendar and java.text.DateFormat/SimpleDateFormat API.- Author:
- Bongjae Chang
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringformatDate(long value, DateTimeFormatter formatter) Get the HTTP format of the specified date.
http spec only require second precision http://tools.ietf.org/html/rfc2616#page-20
therefore we don't use the millisecond precision , but second . truncation is done in the same way for second precision in SimpleDateFormat:
(999 millisec. = 0 sec.)static StringGet the current date in HTTP format.static byte[]Get the current date in HTTP format.static longparseDate(String value, DateTimeFormatter[] formatters) Try to parse the given date as a HTTP date.
-
Constructor Details
-
HttpDateFormat
public HttpDateFormat()
-
-
Method Details
-
getCurrentDate
Get the current date in HTTP format. -
getCurrentDateBytes
public static byte[] getCurrentDateBytes()Get the current date in HTTP format. -
formatDate
Get the HTTP format of the specified date.
http spec only require second precision http://tools.ietf.org/html/rfc2616#page-20
therefore we don't use the millisecond precision , but second . truncation is done in the same way for second precision in SimpleDateFormat:
(999 millisec. = 0 sec.)- Parameters:
value- in milli-secondsformatter- theDateTimeFormatterused if cache value was not found
-
parseDate
Try to parse the given date as a HTTP date.
-