Package org.apache.juneau.http.header
Class HttpHeaderBean
java.lang.Object
org.apache.juneau.http.header.HttpHeaderBean
- All Implemented Interfaces:
HttpHeader
- Direct Known Subclasses:
HttpBooleanHeader,HttpCsvHeader,HttpDateHeader,HttpEntityTagHeader,HttpEntityTagsHeader,HttpIntegerHeader,HttpLongHeader,HttpMediaRangesHeader,HttpMediaTypeHeader,HttpStringHeader,HttpStringRangesHeader,HttpUriHeader,IfRange,RetryAfter
Root concrete implementation of
HttpHeader.
Holds a name/value pair where the value may be supplied eagerly (as a String) or lazily
(via a Supplier). A lazy supplier returning null signals that the header should
be omitted from the request.
Create instances via the static factory methods:
See Also:
- Since:
- 9.2.1
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedHttpHeaderBean(String name, String value) Constructor.protectedHttpHeaderBean(String name, Supplier<String> valueSupplier) Constructor with lazy value supplier. -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanequalsIgnoreCase(String other) Returnstrueif the header value is equal to the given value, ignoring case.getName()Returns the header name.getValue()Returns the header value, ornull if the header has no value.inthashCode()static HttpHeaderBeanCreates anHttpHeaderBeanwith an eager string value.static HttpHeaderBeanCreates anHttpHeaderBeanwith a lazy value supplier.toString()
-
Constructor Details
-
HttpHeaderBean
Constructor.- Parameters:
name- The header name. Must not benull .value- The header value. May benull .
-
HttpHeaderBean
Constructor with lazy value supplier.- Parameters:
name- The header name. Must not benull .valueSupplier- Supplier that provides the header value at request time. Must not benull .
-
-
Method Details
-
of
Creates anHttpHeaderBeanwith an eager string value.- Parameters:
name- The header name. Must not benull .value- The header value. May benull to indicate the header should be omitted.- Returns:
- A new instance. Never
null .
-
of
Creates anHttpHeaderBeanwith a lazy value supplier.The supplier is evaluated at request-send time; if it returns
nullthe header is omitted.- Parameters:
name- The header name. Must not benull .valueSupplier- Supplier for the header value. Must not benull .- Returns:
- A new instance. Never
null .
-
getName
Description copied from interface:HttpHeaderReturns the header name.- Specified by:
getNamein interfaceHttpHeader- Returns:
- The header name. Never
null .
-
getValue
Description copied from interface:HttpHeaderReturns the header value, ornull if the header has no value.- Specified by:
getValuein interfaceHttpHeader- Returns:
- The header value, possibly
null .
-
equalsIgnoreCase
Returnstrueif the header value is equal to the given value, ignoring case.- Parameters:
other- The value to compare against. May benull .- Returns:
trueif the value is equal, ignoring case.
-
toString
-
equals
-
hashCode
-