Package io.github.mahmoudimus.http3
Record Class RequestHeaders
java.lang.Object
java.lang.Record
io.github.mahmoudimus.http3.RequestHeaders
- Record Components:
method-:methodscheme-:scheme, or null for CONNECT-:authority, or thehostfield when that is absent; null if neither is presentpath-:path, or null for CONNECTprotocol-:protocolof an extended CONNECT (RFC 9220), such aswebsocketorconnect-udp; null otherwisefields- the regular fields in order (lower-case names; cookie crumbs joined into one field)contentLength- thecontent-length, or -1 if absent
public record RequestHeaders(String method, String scheme, String authority, String path, String protocol, List<HeaderField> fields, long contentLength)
extends Record
A validated HTTP/3 request header section: the control data from the pseudo-header fields and
the remaining fields, as
Http3Headers.toRequest(long, java.util.List<io.github.mahmoudimus.http3.HeaderField>) produces it.-
Constructor Summary
ConstructorsConstructorDescriptionRequestHeaders(String method, String scheme, String authority, String path, String protocol, List<HeaderField> fields, long contentLength) Creates a request header section. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theauthorityrecord component.longReturns the value of thecontentLengthrecord component.final booleanIndicates whether some other object is "equal to" this one.fields()Returns the value of thefieldsrecord component.The value of the first field with this (lower-case) name, or null.The values of every field with this (lower-case) name.final inthashCode()Returns a hash code value for this object.booleanA CONNECT request, plain or extended.booleanAn extended CONNECT request: CONNECT with:protocol.method()Returns the value of themethodrecord component.path()Returns the value of thepathrecord component.protocol()Returns the value of theprotocolrecord component.scheme()Returns the value of theschemerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
RequestHeaders
public RequestHeaders(String method, String scheme, String authority, String path, String protocol, List<HeaderField> fields, long contentLength) Creates a request header section.- Parameters:
method-:methodscheme-:scheme, or nullauthority-:authority(orhost), or nullpath-:path, or nullprotocol-:protocol, or nullfields- the regular fields, copiedcontentLength- thecontent-length, or -1
-
-
Method Details
-
isConnect
public boolean isConnect()A CONNECT request, plain or extended.- Returns:
- whether the method is CONNECT
-
isExtendedConnect
public boolean isExtendedConnect()An extended CONNECT request: CONNECT with:protocol.- Returns:
- whether
:protocolis present
-
get
The value of the first field with this (lower-case) name, or null.- Parameters:
name- the field name- Returns:
- the value, or null
-
getAll
The values of every field with this (lower-case) name.- Parameters:
name- the field name- Returns:
- the values, possibly none
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
method
Returns the value of themethodrecord component.- Returns:
- the value of the
methodrecord component
-
scheme
Returns the value of theschemerecord component.- Returns:
- the value of the
schemerecord component
-
authority
Returns the value of theauthorityrecord component.- Returns:
- the value of the
authorityrecord component
-
path
Returns the value of thepathrecord component.- Returns:
- the value of the
pathrecord component
-
protocol
Returns the value of theprotocolrecord component.- Returns:
- the value of the
protocolrecord component
-
fields
Returns the value of thefieldsrecord component.- Returns:
- the value of the
fieldsrecord component
-
contentLength
public long contentLength()Returns the value of thecontentLengthrecord component.- Returns:
- the value of the
contentLengthrecord component
-