Package org.apache.juneau.http.header
Class RetryAfter
java.lang.Object
org.apache.juneau.http.header.BasicHeader
org.apache.juneau.http.header.BasicDateHeader
org.apache.juneau.http.header.RetryAfter
- All Implemented Interfaces:
Serializable
,Cloneable
,Header
,NameValuePair
Represents a parsed Retry-After HTTP response header.
If an entity is temporarily unavailable, this instructs the client to try again later. Value could be a specified period of time (in seconds) or a HTTP-date.
Example
Retry-After: 120 Retry-After: Fri, 07 Nov 2014 23:59:59 GMT
RFC2616 Specification
The Retry-After response-header field can be used with a 503 (Service Unavailable) response to indicate how long the service is expected to be unavailable to the requesting client. This field MAY also be used with any 3xx (Redirection) response to indicate the minimum time the user-agent is asked wait before issuing the redirected request. The value of this field can be either an HTTP-date or an integer number of seconds (in decimal) after the time of the response.Retry-After = "Retry-After" ":" ( HTTP-date | delta-seconds )
Two examples of its use are
Retry-After: Fri, 31 Dec 1999 23:59:59 GMT Retry-After: 120
In the latter example, the delay is 2 minutes.
See Also:
-
Constructor Summary
ConstructorDescriptionRetryAfter
(Integer value) Constructor.RetryAfter
(String value) Constructor.RetryAfter
(ZonedDateTime value) Constructor.RetryAfter
(Supplier<?> value) Constructor with delayed value. -
Method Summary
Modifier and TypeMethodDescriptionReturns this header value as an integer.getValue()
static RetryAfter
Static creator.static RetryAfter
Static creator.static RetryAfter
of
(ZonedDateTime value) Static creator.static RetryAfter
Static creator with delayed value.Methods inherited from class org.apache.juneau.http.header.BasicDateHeader
assertZonedDateTime, asZonedDateTime, of, of, of, orElse, toZonedDateTime
Methods inherited from class org.apache.juneau.http.header.BasicHeader
assertName, assertStringValue, asString, equals, equalsIgnoreCase, get, getElements, getName, hashCode, isNotEmpty, isPresent, of, of, orElse, toString
-
Constructor Details
-
RetryAfter
Constructor.- Parameters:
value
- The header value.
Must be an RFC-1123 formated string (e.g."Sat, 29 Oct 1994 19:43:31 GMT" ) or an integer.
Can benull .
-
RetryAfter
Constructor.- Parameters:
value
- The header value.
Can benull .
-
RetryAfter
Constructor.- Parameters:
value
- The header value.
Can benull .
-
RetryAfter
Constructor with delayed value.Header value is re-evaluated on each call to
getValue()
.- Parameters:
value
- The supplier of the header value.
Supplier must supply eitherInteger
orZonedDateTime
objects.
Can benull .
-
-
Method Details
-
of
Static creator.- Parameters:
value
- The header value.
Must be an RFC-1123 formated string (e.g."Sat, 29 Oct 1994 19:43:31 GMT" ) or an integer.
Can benull .- Returns:
- A new header bean, or
null if the name isnull or empty or the value isnull .
-
of
Static creator.- Parameters:
value
- The header value.
Can benull .- Returns:
- A new header bean, or
null if the name isnull or empty or the value isnull .
-
of
Static creator.- Parameters:
value
- The header value.
Can benull .- Returns:
- A new header bean, or
null if the name isnull or empty or the value isnull .
-
of
Static creator with delayed value.Header value is re-evaluated on each call to
getValue()
.- Parameters:
value
- The supplier of the header value.
Supplier must supply eitherInteger
orZonedDateTime
objects.
Can benull .- Returns:
- A new header bean, or
null if the name isnull or empty or the value isnull .
-
getValue
- Specified by:
getValue
in interfaceNameValuePair
- Overrides:
getValue
in classBasicDateHeader
-
asInteger
Returns this header value as an integer.- Returns:
- This header value as a integer, or an empty optional if value was
null or not an integer.
-