Record Class SafeFetchResponse
java.lang.Object
java.lang.Record
io.meeds.commons.http.SafeFetchResponse
- Record Components:
status- the HTTP status answerednotModified- whether the server answered 304: nothing changed since the validators senttruncated- whether the body was cut at the request's limit, as the request allowedbody- the body read; empty for an answer without one, null when not modifiedcontentType- theContent-Typeheader answered, as sent, or nullheaders- the first value of every header answered, by name, case ignored; a value carrying a control character other than a tab is left out, as a request would refuse to send ituri- the URL the answer came from, after the redirects followed
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]body()Returns the value of thebodyrecord component.Returns the value of thecontentTyperecord component.booleanCompares by content: the body is an array.inthashCode()Hashes by content, the body included.The first value of a header answered.headers()Returns the value of theheadersrecord component.The media type answered: theContent-Typewithout its parameters, lower-cased.booleanReturns the value of thenotModifiedrecord component.intstatus()Returns the value of thestatusrecord component.toString()Describes the answer by its status, size and type; never the body, never the URL, which may embed a secret.booleanReturns the value of thetruncatedrecord component.uri()Returns the value of theurirecord component.
-
Constructor Details
-
SafeFetchResponse
public SafeFetchResponse(int status, boolean notModified, boolean truncated, byte[] body, String contentType, Map<String, String> headers, URI uri) Keeps the headers in a case-insensitive, unmodifiable map.- Parameters:
status- the HTTP status answerednotModified- whether the server answered 304truncated- whether the body was cut at the limitbody- the body readcontentType- theContent-Typeansweredheaders- the headers answereduri- the URL the answer came from
-
-
Method Details
-
header
-
mediaType
The media type answered: theContent-Typewithout its parameters, lower-cased.- Returns:
- the media type, or null when none was answered
-
equals
-
hashCode
-
toString
-
status
-
notModified
public boolean notModified()Returns the value of thenotModifiedrecord component.- Returns:
- the value of the
notModifiedrecord component
-
truncated
-
body
-
contentType
Returns the value of thecontentTyperecord component.- Returns:
- the value of the
contentTyperecord component
-
headers
-
uri
-