Package org.apache.juneau.http.header
Class BasicDateHeader
java.lang.Object
org.apache.juneau.http.header.BasicHeader
org.apache.juneau.http.header.BasicDateHeader
- All Implemented Interfaces:
- Serializable,- Cloneable,- Header,- NameValuePair
- Direct Known Subclasses:
- Date,- Expires,- IfModifiedSince,- IfRange,- IfUnmodifiedSince,- LastModified,- RetryAfter
Category of headers that consist of a single HTTP-date.
 
Example
If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT
See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionBasicDateHeader(String name, String value) Constructor.BasicDateHeader(String name, ZonedDateTime value) Constructor.BasicDateHeader(String name, Supplier<ZonedDateTime> value) Constructor with delayed value.
- 
Method SummaryModifier and TypeMethodDescriptionProvides the ability to perform fluent-style assertions on this header.Returns the header value as aZonedDateTimewrapped in anOptional.getValue()static BasicDateHeaderStatic creator.static BasicDateHeaderof(String name, ZonedDateTime value) Static creator.static BasicDateHeaderof(String name, Supplier<ZonedDateTime> value) Static creator with delayed value.orElse(ZonedDateTime other) Return the value if present, otherwise returnother .Returns the header value as aZonedDateTime.Methods inherited from class org.apache.juneau.http.header.BasicHeaderassertName, assertStringValue, asString, equals, equalsIgnoreCase, get, getElements, getName, hashCode, isNotEmpty, isPresent, of, of, orElse, toString
- 
Constructor Details- 
BasicDateHeaderConstructor.- Parameters:
- name- The header name.
- value- The header value.
 Must be an RFC-1123 formated string (e.g.- "Sat, 29 Oct 1994 19:43:31 GMT" ).
 Can be- null .
- Throws:
- IllegalArgumentException- If name is- null or empty.
 
- 
BasicDateHeaderConstructor.- Parameters:
- name- The header name.
- value- The header value.
 Can be- null .
- Throws:
- IllegalArgumentException- If name is- null or empty.
 
- 
BasicDateHeaderConstructor with delayed value.Header value is re-evaluated on each call to getValue().- Parameters:
- name- The header name.
- value- The supplier of the header value.
 Can be- null .
- Throws:
- IllegalArgumentException- If name is- null or empty.
 
 
- 
- 
Method Details- 
ofStatic creator.- Parameters:
- name- The header name.
- value- The header value.
 Must be an RFC-1123 formated string (e.g.- "Sat, 29 Oct 1994 19:43:31 GMT" ).
 Can be- null .
- Returns:
- A new header bean, or null if the value isnull .
- Throws:
- IllegalArgumentException- If name is- null or empty.
 
- 
ofStatic creator.- Parameters:
- name- The header name.
- value- The header value.
 Can be- null .
- Returns:
- A new header bean, or null if the value isnull .
- Throws:
- IllegalArgumentException- If name is- null or empty.
 
- 
ofStatic creator with delayed value.Header value is re-evaluated on each call to getValue().- Parameters:
- name- The header name.
- value- The supplier of the header value.
 Can be- null .
- Returns:
- A new header bean, or null if the value isnull .
- Throws:
- IllegalArgumentException- If name is- null or empty.
 
- 
getValue- Specified by:
- getValuein interface- NameValuePair
- Overrides:
- getValuein class- BasicHeader
 
- 
asZonedDateTimeReturns the header value as aZonedDateTimewrapped in anOptional.- Returns:
- The header value as a ZonedDateTimewrapped in anOptional. Nevernull .
 
- 
toZonedDateTimeReturns the header value as aZonedDateTime.- Returns:
- The header value as a ZonedDateTime. Can benull .
 
- 
assertZonedDateTimeProvides the ability to perform fluent-style assertions on this header.Examples:// Validates the response body content is not expired. client .get(URL ) .run() .getHeader("Expires" ).asDateHeader().assertZonedDateTime().isLessThan(new Date());- Returns:
- A new fluent assertion object.
- Throws:
- AssertionError- If assertion failed.
 
- 
orElseReturn the value if present, otherwise returnother .This is a shortened form for calling asZonedDateTime().orElse( .other )- Parameters:
- other- The value to be returned if there is no value present, can be- null .
- Returns:
- The value, if present, otherwise other .
 
 
-