Class Condition

Direct Known Subclasses:

public class Condition extends Object

Condition is something that can be true or false given the Call.

Also it contains static factory methods. One should feel free to implement own conditions.

Note, that terms URL and URI have the same meaning as in Request.
See Also:
  • Constructor Details

  • Method Details

    • getPredicate

      public Predicate<Call> getPredicate()
      Returns the predicate of condition
    • check

      public boolean check(Call input)
      Check if call satisfies the condition
    • method

      public static Condition method(org.glassfish.grizzly.http.Method m)
      Checks HTTP method
    • parameter

      public static Condition parameter(String key, String... parameterValues)
      Checks HTTP parameters. Also work with multi-valued parameters
    • uri

      public static Condition uri(String uri)
      URI exactly equals to the value returned by Request.getRequestURI()
    • url

      public static Condition url(String url)
      URL exactly equals to the value returned by Request.getRequestURL()
    • endsWithUri

      public static Condition endsWithUri(String uri)
      URI ends with
    • startsWithUri

      public static Condition startsWithUri(String uri)
      URI starts with
    • matchesUri

      public static Condition matchesUri(Pattern p)
      URI starts with
    • withPostBody

      public static Condition withPostBody()
      Contains non-empty POST body
    • basicAuth

      public static Condition basicAuth(String username, String password)
      If basic authentication is provided
    • custom

      public static Condition custom(Predicate<Call> p)
      Custom condition
    • not

      public static Condition not(Condition c)
      Not condition
    • withPostBodyContaining

      public static Condition withPostBodyContaining(String str)
      With POST body containing string
    • withPostBodyContaining

      public static Condition withPostBodyContaining(Pattern pattern)
      With post body matching pattern
    • withPostBodyContainingJsonPath

      public static Condition withPostBodyContainingJsonPath(String pattern, Object value)
      With Valid Json Path. Check to see if incoming path has a valid string value selected via a JSONPath expression.
    • withHeader

      public static Condition withHeader(String key)
      With header present. Header key is case insensitive. More information here.
    • withHeader

      public static Condition withHeader(String key, String... expectedHeaders)
      With header present and equals. Header key is case insensitive. More information here.
    • get

      public static ConditionWithApplicables get(String uri)
      Method GET with given URI
    • post

      public static ConditionWithApplicables post(String uri)
      Method POST with given URI
    • put

      public static ConditionWithApplicables put(String uri)
      Method PUT with given URI
    • delete

      public static ConditionWithApplicables delete(String uri)
      Method DELETE with given URI
    • patch

      public static ConditionWithApplicables patch(String uri)
      Method PATCH with given URI
    • alwaysTrue

      public static Condition alwaysTrue()
      Always true
    • alwaysFalse

      public static Condition alwaysFalse()
      Always false
    • composite

      public static Condition composite(Condition... conditions)
      Joins many conditions with "and" operation