Package org.simpleframework.http
Class Cookie.CookieDate
java.lang.Object
org.simpleframework.http.Cookie.CookieDate
- Enclosing class:
Cookie
The
CookieDate
complies with the date format
used by older browsers such as Internet Explorer and
Netscape Navigator. The format of the date is not the same
as other HTTP date headers. It takes the form.
DAY, DD-MMM-YYYY HH:MM:SS GMTSupport for this format is required as many browsers do not support
max-age
and so cookies will not
expire for these browsers.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DateFormat
This is the date formatter used to build the string.private static final String
This is the format that is required for the date.private final TimeZone
This is the GMT time zone which must be used.private static final String
The cookie date must be returned in the GMT zone. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
FORMAT
This is the format that is required for the date.- See Also:
-
ZONE
The cookie date must be returned in the GMT zone.- See Also:
-
format
This is the date formatter used to build the string. -
zone
This is the GMT time zone which must be used.
-
-
Constructor Details
-
CookieDate
public CookieDate()Constructor for theCookieDate
formatter. This creates the time zone and date formatting tools that are need to convert the expiry in seconds to the correct text format for older browsers to understand.
-
-
Method Details
-
format
This takes the number of seconds the cookie will live for. In order for this to be respected by older browsers such as IE-5.0 to IE-9.0 this must return a string in the original cookie specification by Netscape.- Parameters:
seconds
- the number of seconds from now- Returns:
- a date formatted for used with old browsers
-
convert
This method is used to convert the provided time to a date that can be formatted. The time returned is the current time plus the number of seconds provided.- Parameters:
seconds
- the number of seconds from now- Returns:
- a date representing some time in the future
-