web/src/main/java/org/springframework/security/web/savedrequest/FastHttpDateFormat.java
public static String formatDate(long value, DateFormat threadLocalformat) {
		String cachedDate = null;
		Long longValue = Long.valueOf(value);

		try {
			cachedDate = formatCache.get(longValue);
		}
		catch (Exception ignored) {
		}

		if (cachedDate != null) {
			return cachedDate;
		}

		String newDate;
		Date dateValue = new Date(value);

		if (threadLocalformat != null) {
			newDate = threadLocalformat.format(dateValue);

			synchronized (formatCache) {
				updateCache(formatCache, longValue, newDate);
			}
		}
		else {
			synchronized (formatCache) {
				newDate = format.format(dateValue);
				updateCache(formatCache, longValue, newDate);
			}
		}

		return newDate;
	}
public static String formatDate(long value, DateFormat threadLocalformat) {
		String cachedDate = null;
		Long longValue = Long.valueOf(value);

		try {
			cachedDate = formatCache.get(longValue);
		}
		catch (Exception ignored) {
		}

		if (cachedDate != null) {
			return cachedDate;
		}

		String newDate;
		Date dateValue = new Date(value);

		if (threadLocalformat != null) {
			newDate = threadLocalformat.format(dateValue);

			synchronized (formatCache) {
				updateCache(formatCache, longValue, newDate);
			}
		}
		else {
			synchronized (formatCache) {
				newDate = format.format(dateValue);
				updateCache(formatCache, longValue, newDate);
			}
		}

		return newDate;
	}
Formats a specified date to HTTP format. If local format is not <code>null</code>,
it's used instead.

@param value Date value to format
@param threadLocalformat The format to use (or <code>null</code> -- then HTTP
format will be used)

@return Formatted date