Package org.apache.juneau.http.header
Class ClientVersion
java.lang.Object
org.apache.juneau.http.header.BasicHeader
org.apache.juneau.http.header.BasicStringHeader
org.apache.juneau.http.header.ClientVersion
- All Implemented Interfaces:
Serializable
,Cloneable
,Header
,NameValuePair
Represents a parsed Client-Version HTTP request header.
Specifies a client-side version number.
Example
Client-Version: 2.0.1
Not part of the RFC2616 specification, but provided to allow for HTTP responses to be tailored to specified known client versions.
See Also:
-
Constructor Summary
ConstructorDescriptionClientVersion
(String value) Constructor.ClientVersion
(Supplier<Version> value) Constructor with delayed value.ClientVersion
(Version value) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionProvides the ability to perform fluent-style assertions on this header.Returns the header value as aVersion
object.getValue()
static ClientVersion
Static creator.static ClientVersion
Static creator with delayed value.static ClientVersion
Static creator.Methods inherited from class org.apache.juneau.http.header.BasicStringHeader
assertString, asString, of, of, ofPair, orElse
Methods inherited from class org.apache.juneau.http.header.BasicHeader
assertName, assertStringValue, equals, equalsIgnoreCase, get, getElements, getName, hashCode, isNotEmpty, isPresent, of, of, toString
-
Constructor Details
-
ClientVersion
Constructor.- Parameters:
value
- The header value.
Must be parsable byVersion.of(String)
Can benull .
-
ClientVersion
Constructor.- Parameters:
value
- The header value.
Can benull .
-
ClientVersion
Constructor with delayed value.Header value is re-evaluated on each call to
getValue()
.- Parameters:
value
- The supplier of the header value.
Can benull .
-
-
Method Details
-
of
Static creator.- Parameters:
value
- The header value.
Must be parsable byVersion.of(String)
Can benull .- Returns:
- A new header bean, or
null if the value isnull .
-
of
Static creator.- Parameters:
value
- The header value.
Can benull .- Returns:
- A new header bean, or
null if 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.
Can benull .- Returns:
- A new header bean, or
null if the value isnull .
-
getValue
- Specified by:
getValue
in interfaceNameValuePair
- Overrides:
getValue
in classBasicStringHeader
-
asVersion
Returns the header value as aVersion
object.- Returns:
- The header value as a
Version
object, orOptional.empty()
if the value isnull .
-
assertVersion
Provides the ability to perform fluent-style assertions on this header.Examples:
// Validates the response content is older than 1. client .get(URL ) .run() .getHeader(ClientVersion.class ).assertVersion().major().isGreaterThan(1);- Returns:
- A new fluent assertion object.
- Throws:
AssertionError
- If assertion failed.
-