Module methanol

Class TaggableRequest

java.lang.Object
java.net.http.HttpRequest
com.github.mizosoft.methanol.TaggableRequest
Direct Known Subclasses:
MutableRequest

public abstract class TaggableRequest extends HttpRequest
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.
  • Method Details

    • tag

      public <T> Optional<T> tag(Class<T> type)
      Returns the tag associated with the given type if present.
    • tag

      public <T> Optional<T> tag(TypeRef<T> typeRef)
      Returns the tag associated with the given type if present.
    • from

      public static TaggableRequest from(HttpRequest request)
      Returns either the given request if it's a TaggableRequest or a new TaggableRequest copy with no tags otherwise.