@Header(value="Content-Length") public class ContentLength extends BasicLongHeader
The length of the response body in octets (8-bit bytes).
Content-Length: 348
Content-Length = "Content-Length" ":" 1*DIGIT
An example is...
Content-Length: 3495
Applications SHOULD use this field to indicate the transfer-length of the message-body, unless this is prohibited by the rules in section 4.4.
Any Content-Length greater than or equal to zero is a valid value. Section 4.4 describes how to determine the length of a message-body if a Content-Length is not given.
Note that the meaning of this field is significantly different from the corresponding definition in MIME, where it is an optional field used within the "message/external-body" content-type. In HTTP, it SHOULD be sent whenever the message's length can be determined prior to being transferred, unless this is prohibited by the rules in section 4.4.
Constructor and Description |
---|
ContentLength(Object value)
Constructor.
|
ContentLength(String value)
Constructor
|
Modifier and Type | Method and Description |
---|---|
static ContentLength |
of(Object value)
Convenience creator.
|
static ContentLength |
of(Supplier<?> value)
Convenience creator using supplier.
|
asLong, assertLong, getValue, of, of
assertName, assertValue, canCast, cast, eqIC, equals, getElements, getName, getRawValue, hashCode, isSupplier, of, ofPair, toString, unwrap
public ContentLength(Object value)
value
- The header value.
Number
- Converted to a long using Number.longValue()
.
String
- Parsed using Long.parseLong(String)
.
Supplier
of anything on this list.
public ContentLength(String value)
value
- The header value.public static ContentLength of(Object value)
value
- The header value.
Number
- Converted to a long using Number.longValue()
.
String
- Parsed using Long.parseLong(String)
.
ContentLength
object.public static ContentLength of(Supplier<?> value)
Header value is re-evaluated on each call to BasicLongHeader.getValue()
.
value
- The header value supplier.
Number
- Converted to a long using Number.longValue()
.
String
- Parsed using Long.parseLong(String)
.
ContentLength
object.Copyright © 2016–2020 The Apache Software Foundation. All rights reserved.