Package org.apache.juneau.http.header
Class BasicUriHeader
java.lang.Object
org.apache.juneau.http.header.BasicHeader
org.apache.juneau.http.header.BasicUriHeader
- All Implemented Interfaces:
Serializable
,Cloneable
,Header
,NameValuePair
- Direct Known Subclasses:
ContentLocation
,Location
,Referer
Category of headers that consist of a single URL value.
Example
Location: http://www.w3.org/pub/WWW/People.html
See Also:
-
Constructor Summary
ConstructorDescriptionBasicUriHeader
(String name, String value) Constructor.BasicUriHeader
(String name, URI value) Constructor.BasicUriHeader
(String name, Supplier<URI> value) Constructor with delayed value. -
Method Summary
Modifier and TypeMethodDescriptionasUri()
getValue()
static BasicUriHeader
Static creator.static BasicUriHeader
Static creator.static BasicUriHeader
Static creator with delayed value.Return the value if present, otherwise returnother .toUri()
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
-
BasicUriHeader
Constructor.- Parameters:
name
- The header name.value
- The header value.
Must be parsable byURI.create(String)
.
Can benull .- Throws:
IllegalArgumentException
- If name isnull or empty.
-
BasicUriHeader
Constructor.- Parameters:
name
- The header name.value
- The header value.
Can benull .- Throws:
IllegalArgumentException
- If name isnull or empty.
-
BasicUriHeader
Constructor 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 benull .- Throws:
IllegalArgumentException
- If name isnull or empty.
-
-
Method Details
-
of
Static creator.- Parameters:
name
- The header name.value
- The header value.
Must be parsable byURI.create(String)
.
Can benull .- Returns:
- A new header bean, or
null if the value isnull . - Throws:
IllegalArgumentException
- If name isnull or empty.
-
of
Static creator.- Parameters:
name
- The header name.value
- The header value.
Can benull .- Returns:
- A new header bean, or
null if the value isnull . - Throws:
IllegalArgumentException
- If name isnull or empty.
-
of
Static 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 benull .- Returns:
- A new header bean, or
null if the value isnull . - Throws:
IllegalArgumentException
- If name isnull or empty.
-
getValue
- Specified by:
getValue
in interfaceNameValuePair
- Overrides:
getValue
in classBasicHeader
-
asUri
-
toUri
-
orElse
Return the value if present, otherwise returnother .This is a shortened form for calling
asUri().orElse( .other )- Parameters:
other
- The value to be returned if there is no value present, can benull .- Returns:
- The value, if present, otherwise
other .
-