Record Class HttpRequestSnapshot
java.lang.Object
java.lang.Record
io.modelcontextprotocol.client.transport.HttpRequestSnapshot
- Record Components:
requestUri- the HTTP request URImethod- the HTTP methodheaders- the HTTP request headers
public record HttpRequestSnapshot(URI requestUri, String method, HttpHeaders headers)
extends Record
Captures information about an HTTP request. We use this instead of passing the plain
HttpRequest object because we want to avoid retaining a reference to the
request's HttpRequest.BodyPublisher.- Author:
- Daniel Garnier-Moiroux
-
Constructor Summary
ConstructorsConstructorDescriptionHttpRequestSnapshot(URI requestUri, String method, HttpHeaders headers) Creates an instance of aHttpRequestSnapshotrecord class. -
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.headers()Returns the value of theheadersrecord component.method()Returns the value of themethodrecord component.Returns the value of therequestUrirecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
HttpRequestSnapshot
Creates an instance of aHttpRequestSnapshotrecord class.- Parameters:
requestUri- the value for therequestUrirecord componentmethod- the value for themethodrecord componentheaders- the value for theheadersrecord component
-
-
Method Details
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
requestUri
Returns the value of therequestUrirecord component.- Returns:
- the value of the
requestUrirecord component
-
method
Returns the value of themethodrecord component.- Returns:
- the value of the
methodrecord component
-
headers
Returns the value of theheadersrecord component.- Returns:
- the value of the
headersrecord component
-