public class

FastHttpDateFormat

extends Object
java.lang.Object
   ↳ org.springframework.security.web.savedrequest.FastHttpDateFormat

Class Overview

Utility class to generate HTTP dates.

This class is based on code in Apache Tomcat.

Summary

Fields
protected static String currentDate Current formatted date.
protected static long currentDateGenerated Instant on which the currentDate object was generated.
protected static final SimpleDateFormat format HTTP date format.
protected static final HashMap<LongString> formatCache Formatter cache.
protected static final SimpleDateFormat[] formats The set of SimpleDateFormat formats to use in getDateHeader().
protected static final TimeZone gmtZone GMT time zone - all HTTP dates are on GMT
protected static final HashMap<StringLong> parseCache Parser cache.
Public Constructors
FastHttpDateFormat()
Public Methods
static String formatDate(long value, DateFormat threadLocalformat)
Formats a specified date to HTTP format.
static String getCurrentDate()
Gets the current date in HTTP format.
static long parseDate(String value, DateFormat[] threadLocalformats)
Tries to parse the given date as an HTTP date.
[Expand]
Inherited Methods
From class java.lang.Object

Fields

protected static String currentDate

Current formatted date.

protected static long currentDateGenerated

Instant on which the currentDate object was generated.

protected static final SimpleDateFormat format

HTTP date format.

protected static final HashMap<LongString> formatCache

Formatter cache.

protected static final SimpleDateFormat[] formats

The set of SimpleDateFormat formats to use in getDateHeader().

protected static final TimeZone gmtZone

GMT time zone - all HTTP dates are on GMT

protected static final HashMap<StringLong> parseCache

Parser cache.

Public Constructors

public FastHttpDateFormat ()

Public Methods

public static String formatDate (long value, DateFormat threadLocalformat)

Formats a specified date to HTTP format. If local format is not null, it's used instead.

Parameters
value Date value to format
threadLocalformat The format to use (or null -- then HTTP format will be used)
Returns
  • Formatted date

public static String getCurrentDate ()

Gets the current date in HTTP format.

Returns
  • Current date in HTTP format

public static long parseDate (String value, DateFormat[] threadLocalformats)

Tries to parse the given date as an HTTP date. If local format list is not null, it's used instead.

Parameters
value The string to parse
threadLocalformats Array of formats to use for parsing. If null, HTTP formats are used.
Returns
  • Parsed date (or -1 if error occurred)