Package org.apache.juneau.http.header
Class BasicStringHeader
java.lang.Object
org.apache.juneau.http.header.BasicHeader
org.apache.juneau.http.header.BasicStringHeader
- All Implemented Interfaces:
- Serializable,- Cloneable,- Header,- NameValuePair
- Direct Known Subclasses:
- AcceptRanges,- Authorization,- BasicMediaRangesHeader,- BasicMediaTypeHeader,- CacheControl,- ClientVersion,- Connection,- ContentEncoding,- ContentRange,- Expect,- Forwarded,- From,- Host,- Origin,- Pragma,- ProxyAuthenticate,- ProxyAuthorization,- Range,- Server,- Trailer,- TransferEncoding,- UserAgent,- Vary,- Warning,- WwwAuthenticate
Category of headers that consist of a single string value.
 
Example
Host: www.myhost.com:8080
See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionBasicStringHeader(String name, String value) Constructor.BasicStringHeader(String name, Supplier<String> value) Constructor with delayed value.
- 
Method SummaryModifier and TypeMethodDescriptionProvides the ability to perform fluent-style assertions on this header.asString()Returns the value of this header as a string.getValue()static BasicStringHeaderStatic creator.static BasicStringHeaderStatic creator with delayed value.static BasicStringHeaderCreates aHeaderfrom a name/value pair string (e.g.Return the value if present, otherwise returnother .Methods inherited from class org.apache.juneau.http.header.BasicHeaderassertName, assertStringValue, equals, equalsIgnoreCase, get, getElements, getName, hashCode, isNotEmpty, isPresent, of, of, toString
- 
Constructor Details- 
BasicStringHeaderConstructor.- Parameters:
- name- The header name.
- value- The header value.
 Can be- null .
- Throws:
- IllegalArgumentException- If name is- null or empty.
 
- 
BasicStringHeaderConstructor 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.
 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.
 
- 
ofPairCreates aHeaderfrom a name/value pair string (e.g."Foo: bar" )- Parameters:
- pair- The pair string.
- Returns:
- A new header bean.
 
- 
getValue- Specified by:
- getValuein interface- NameValuePair
- Overrides:
- getValuein class- BasicHeader
 
- 
asStringDescription copied from class:BasicHeaderReturns the value of this header as a string.- Overrides:
- asStringin class- BasicHeader
- Returns:
- The value of this header as a string, or Optional.empty()if the value isnull 
 
- 
assertStringProvides the ability to perform fluent-style assertions on this header.Examples:// Validates the content type header is provided. client .get(URL ) .run() .getHeader("Content-Type" ).assertString().exists();- 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 asString().orElse( .other )- Overrides:
- orElsein class- BasicHeader
- Parameters:
- other- The value to be returned if there is no value present, can be- null .
- Returns:
- The value, if present, otherwise other .
 
 
-