Class Predicates


  • public final class Predicates
    extends java.lang.Object
    The request/response predicates to use with ConstrainedCacheBuilder.requestFilter(Predicate) and ConstrainedCacheBuilder.responseFilter(Predicate).
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> java.util.function.Predicate<java.net.http.HttpResponse<T>> hasHeader​(java.lang.String name)
      The Predicate that matches only HttpRequest with given header.
      static <T> java.util.function.Predicate<java.net.http.HttpResponse<T>> hasHeader​(java.lang.String name, java.lang.String value)
      The Predicate that matches only HttpResponse with given header.
      static java.util.function.Predicate<java.net.http.HttpRequest> uri​(java.net.URI uri)
      The Predicate that matches HttpRequests with given uri.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • uri

        public static java.util.function.Predicate<java.net.http.HttpRequest> uri​(java.net.URI uri)
        The Predicate that matches HttpRequests with given uri.
        Parameters:
        uri - The uri to match.
        Returns:
        The Predicate that matches HttpRequests with given uri.
      • hasHeader

        public static <T> java.util.function.Predicate<java.net.http.HttpResponse<T>> hasHeader​(java.lang.String name,
                                                                                                java.lang.String value)
        The Predicate that matches only HttpResponse with given header.
        Type Parameters:
        T - The response body type.
        Parameters:
        name - The header name.
        value - The header value.
        Returns:
        The Predicate that matches HttpResponse with given header.
      • hasHeader

        public static <T> java.util.function.Predicate<java.net.http.HttpResponse<T>> hasHeader​(java.lang.String name)
        The Predicate that matches only HttpRequest with given header.
        Type Parameters:
        T - The response body type.
        Parameters:
        name - The header name.
        Returns:
        The Predicate that matches HttpRequest with given header.