Package org.microproxy.contentviews
Record Class ContentView.Metadata
java.lang.Object
java.lang.Record
org.microproxy.contentviews.ContentView.Metadata
- Record Components:
contentType- theContent-Typefield, ornullheaders- the message's header fields (nevernull)trailers- the message's trailer fields (nevernull)path- the request's path and query (for a response, its request's), ornull; an absolute URI is reduced to its path and queryrequest- whether the body is a request's
- Enclosing interface:
ContentView
public static record ContentView.Metadata(String contentType, HttpHeaders headers, HttpHeaders trailers, String path, boolean request)
extends Record
What a view knows about a body besides its bytes.
-
Constructor Summary
ConstructorsConstructorDescriptionMetadata(String contentType, HttpHeaders headers, HttpHeaders trailers, String path, boolean request) Fills in empty header fields fornull, and reduces an absolute URI to its path. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecontentTyperecord component.final booleanIndicates whether some other object is "equal to" this one.static ContentView.MetadataforRequest(HttpRequest request) Metadata for a request's body.static ContentView.MetadataforResponse(HttpRequest request, HttpMessage response) Metadata for a response's body.final inthashCode()Returns a hash code value for this object.A header field's first value.headers()Returns the value of theheadersrecord component.Returns the media type ofcontentTypein lower case, without parameters, or "".static ContentView.MetadataMetadata with only a content type.A parameter ofcontentType, such asboundaryorcharset.path()Returns the value of thepathrecord component.booleanrequest()Returns the value of therequestrecord component.final StringtoString()Returns a string representation of this record class.trailers()Returns the value of thetrailersrecord component.This metadata with a request path.withTrailers(HttpHeaders trailers) This metadata with trailer fields.
-
Constructor Details
-
Metadata
public Metadata(String contentType, HttpHeaders headers, HttpHeaders trailers, String path, boolean request) Fills in empty header fields fornull, and reduces an absolute URI to its path.- Parameters:
contentType- theContent-Typefield, ornullheaders- the header fields, ornulltrailers- the trailer fields, ornullpath- the request's path and query, ornullrequest- whether the body is a request's
-
-
Method Details
-
of
Metadata with only a content type.- Parameters:
contentType- theContent-Typefield, ornull- Returns:
- the metadata
-
forRequest
Metadata for a request's body.- Parameters:
request- the request- Returns:
- the metadata
-
forResponse
Metadata for a response's body.- Parameters:
request- the request the response answers, ornullresponse- the response (or any message)- Returns:
- the metadata
-
withTrailers
This metadata with trailer fields.- Parameters:
trailers- the trailer fields- Returns:
- new metadata
-
withPath
This metadata with a request path.- Parameters:
path- the request's path and query, ornull- Returns:
- new metadata
-
mediaType
Returns the media type ofcontentTypein lower case, without parameters, or "".- Returns:
- the media type of
contentTypein lower case, without parameters, or ""
-
parameter
A parameter ofcontentType, such asboundaryorcharset.- Parameters:
name- the parameter's name (any case)- Returns:
- its value without quotes, or
null
-
header
A header field's first value.- Parameters:
name- the field name (any case)- Returns:
- the value, or
null
-
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 '=='. -
contentType
Returns the value of thecontentTyperecord component.- Returns:
- the value of the
contentTyperecord component
-
headers
Returns the value of theheadersrecord component.- Returns:
- the value of the
headersrecord component
-
trailers
Returns the value of thetrailersrecord component.- Returns:
- the value of the
trailersrecord component
-
path
Returns the value of thepathrecord component.- Returns:
- the value of the
pathrecord component
-
request
public boolean request()Returns the value of therequestrecord component.- Returns:
- the value of the
requestrecord component
-