Package org.microproxy.frames
Record Class Field
java.lang.Object
java.lang.Record
org.microproxy.frames.Field
- Record Components:
name- the field namevalue- the field valuesensitive- whether the field must never be added to a compression table (HPACK and QPACK's never-indexed literals): kept when a field is edited withwithValue(String)
One field of a decoded header block (HTTP/2 HPACK, HTTP/3 QPACK): a name, which is lower case
on the wire and starts with
: for a pseudo-header, and a value.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanisPseudo()Whether this is a pseudo-header (:method,:status, ...).name()Returns the value of thenamerecord component.booleanReturns the value of thesensitiverecord component.final StringtoString()Returns a string representation of this record class.static voidChecks thatfieldscan be sent as an HTTP/2 or HTTP/3 header block: names that are non-empty lower-case tokens; values without NUL, CR or LF and without leading or trailing white space; pseudo-headers that are known (:method,:scheme,:authority,:path,:protocolor:status), not repeated, all before the regular fields, and not mixing a request's with a response's; and no connection-specific field (connection,keep-alive,proxy-connection,transfer-encoding,upgrade, andteother thantrailers).value()Returns the value of thevaluerecord component.This field with another value.
-
Constructor Details
-
Field
Creates a field.- Parameters:
name- the field namevalue- the field valuesensitive- whether the field must never be added to a compression table- Throws:
NullPointerException- if the name or value is null
-
Field
Creates a field that compression tables may hold.- Parameters:
name- the field namevalue- the field value
-
-
Method Details
-
withValue
This field with another value.- Parameters:
newValue- the new value- Returns:
- a copy with
newValue
-
isPseudo
public boolean isPseudo()Whether this is a pseudo-header (:method,:status, ...).- Returns:
- whether the name starts with a colon
-
validate
Checks thatfieldscan be sent as an HTTP/2 or HTTP/3 header block: names that are non-empty lower-case tokens; values without NUL, CR or LF and without leading or trailing white space; pseudo-headers that are known (:method,:scheme,:authority,:path,:protocolor:status), not repeated, all before the regular fields, and not mixing a request's with a response's; and no connection-specific field (connection,keep-alive,proxy-connection,transfer-encoding,upgrade, andteother thantrailers). Whether the block is a complete request or response is not checked here.- Parameters:
fields- the header block- Throws:
IllegalArgumentException- naming the first problem
-
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 '=='. -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
value
Returns the value of thevaluerecord component.- Returns:
- the value of the
valuerecord component
-
sensitive
public boolean sensitive()Returns the value of thesensitiverecord component.- Returns:
- the value of the
sensitiverecord component
-