Class TaggableRequest
java.lang.Object
java.net.http.HttpRequest
com.github.mizosoft.methanol.TaggableRequest
- Direct Known Subclasses:
MutableRequest
An
HttpRequest that can carry arbitrary values, referred to as tags. Tags can be used to
carry application-specific data throughout interceptors and listeners. Tags
are mapped by their type. One type cannot map to more than one tag.
A TaggableRequest also carries the BodyAdapter.Hints to be used when encoding the request
body and/or decoding the response body. Hints are like tags but are meant to carry arbitrary
values to adapters rather than interceptors or listeners.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceAnHttpRequest.Builderthat allows attaching tags.Nested classes/interfaces inherited from class HttpRequest
HttpRequest.BodyPublisher, HttpRequest.BodyPublishers -
Method Summary
Modifier and TypeMethodDescriptionstatic TaggableRequestfrom(HttpRequest request) Returns either the given request if it's aTaggableRequestor a newTaggableRequestcopy with no tags otherwise.abstract BodyAdapter.Hintshints()Returns this request'sBodyAdapter.Hints.<T> Optional<T> Returns the tag associated with the given type if present.<T> Optional<T> Returns the tag associated with the given type if present.static <T> Optional<T> tagOf(HttpRequest request, TypeRef<T> typeRef) Returns the tag associated with the given type if the given request is aTaggableRequestand it has a tag with the given type, otherwise returns an emptyOptional.static <T> Optional<T> tagOf(HttpRequest request, Class<T> type) Returns the tag associated with the given type if the given request is aTaggableRequestand it has a tag with the given type, otherwise returns an emptyOptional.Methods inherited from class HttpRequest
bodyPublisher, equals, expectContinue, hashCode, headers, method, newBuilder, newBuilder, newBuilder, timeout, uri, version
-
Method Details
-
tag
-
tag
-
hints
Returns this request'sBodyAdapter.Hints. -
from
Returns either the given request if it's aTaggableRequestor a newTaggableRequestcopy with no tags otherwise. -
tagOf
Returns the tag associated with the given type if the given request is aTaggableRequestand it has a tag with the given type, otherwise returns an emptyOptional. -
tagOf
Returns the tag associated with the given type if the given request is aTaggableRequestand it has a tag with the given type, otherwise returns an emptyOptional.
-