Class GatewayRequestPredicates

java.lang.Object
org.springframework.cloud.gateway.server.mvc.predicate.GatewayRequestPredicates

public abstract class GatewayRequestPredicates extends Object
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.springframework.web.servlet.function.RequestPredicate
    after(ZonedDateTime dateTime)
     
    static org.springframework.web.servlet.function.RequestPredicate
     
    static org.springframework.web.servlet.function.RequestPredicate
    between(ZonedDateTime dateTime1, ZonedDateTime dateTime2)
     
    static org.springframework.web.servlet.function.RequestPredicate
     
    static org.springframework.web.servlet.function.RequestPredicate
    cookie(String name)
     
    static org.springframework.web.servlet.function.RequestPredicate
    cookie(String name, @Nullable String regexp)
     
    static org.springframework.web.servlet.function.RequestPredicate
    header(String header)
     
    static org.springframework.web.servlet.function.RequestPredicate
    header(String header, @Nullable String regexp)
     
    static org.springframework.web.servlet.function.RequestPredicate
    host(String pattern)
    Return a RequestPredicate that tests the request host against the given host pattern.
    static org.springframework.web.servlet.function.RequestPredicate
    host(String... patterns)
    Return a RequestPredicate that tests the request host against the given host patterns.
    static Function<String,org.springframework.web.servlet.function.RequestPredicate>
    hostPredicates(org.springframework.web.util.pattern.PathPatternParser patternParser)
    Return a function that creates new host-matching RequestPredicates from pattern Strings using the given PathPatternParser.
    static org.springframework.web.servlet.function.RequestPredicate
    method(org.springframework.http.HttpMethod... methods)
     
    static org.springframework.web.servlet.function.RequestPredicate
    path(String pattern)
    Return a RequestPredicate that tests the request path against the given path pattern.
    static org.springframework.web.servlet.function.RequestPredicate
    path(String... patterns)
    Return a RequestPredicate that tests the request path against the given path pattern.
    static org.springframework.web.servlet.function.RequestPredicate
    query(String param)
    Return a RequestPredicate that tests the presence of a request parameter.
    static org.springframework.web.servlet.function.RequestPredicate
    query(String param, @Nullable String regexp)
    Return a RequestPredicate that tests the presence of a request parameter if the regexp is empty, or, otherwise finds if any value of the parameter matches the regexp.
    static <T> org.springframework.web.servlet.function.RequestPredicate
    readBody(Class<T> inClass, Predicate<T> predicate)
     
    static org.springframework.web.servlet.function.RequestPredicate
    version(String version)
    RequestPredicate to match to the request API version extracted from and parsed with the configured ApiVersionStrategy.
    static org.springframework.web.servlet.function.RequestPredicate
    weight(String group, int weight)
    A predicate which will select a route based on its assigned weight.

    Methods inherited from class java.lang.Object

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

    • after

      @Shortcut public static org.springframework.web.servlet.function.RequestPredicate after(ZonedDateTime dateTime)
    • before

      @Shortcut public static org.springframework.web.servlet.function.RequestPredicate before(ZonedDateTime dateTime)
    • between

      @Shortcut public static org.springframework.web.servlet.function.RequestPredicate between(ZonedDateTime dateTime1, ZonedDateTime dateTime2)
    • cloudFoundryRouteService

      public static org.springframework.web.servlet.function.RequestPredicate cloudFoundryRouteService()
    • cookie

      public static org.springframework.web.servlet.function.RequestPredicate cookie(String name)
    • cookie

      @Shortcut public static org.springframework.web.servlet.function.RequestPredicate cookie(String name, @Nullable String regexp)
    • header

      public static org.springframework.web.servlet.function.RequestPredicate header(String header)
    • header

      @Shortcut public static org.springframework.web.servlet.function.RequestPredicate header(String header, @Nullable String regexp)
    • method

      @Shortcut(type=LIST) public static org.springframework.web.servlet.function.RequestPredicate method(org.springframework.http.HttpMethod... methods)
    • host

      public static org.springframework.web.servlet.function.RequestPredicate host(String pattern)
      Return a RequestPredicate that tests the request host against the given host pattern.
      Parameters:
      pattern - the host pattern to match
      Returns:
      a predicate that tests against the given host pattern
    • host

      @Shortcut(type=LIST) public static org.springframework.web.servlet.function.RequestPredicate host(String... patterns)
      Return a RequestPredicate that tests the request host against the given host patterns.
      Parameters:
      patterns - the list of patterns to match
      Returns:
      a predicate that tests against the given host patterns
    • hostPredicates

      public static Function<String,org.springframework.web.servlet.function.RequestPredicate> hostPredicates(org.springframework.web.util.pattern.PathPatternParser patternParser)
      Return a function that creates new host-matching RequestPredicates from pattern Strings using the given PathPatternParser.

      This method can be used to specify a non-default, customized PathPatternParser when resolving path patterns.

      Parameters:
      patternParser - the parser used to parse patterns given to the returned function
      Returns:
      a function that resolves a pattern String into a path-matching RequestPredicates instance
    • path

      public static org.springframework.web.servlet.function.RequestPredicate path(String pattern)
      Return a RequestPredicate that tests the request path against the given path pattern.
      Parameters:
      pattern - the pattern to match to
      Returns:
      a predicate that tests against the given path pattern
    • path

      @Shortcut(type=LIST) public static org.springframework.web.servlet.function.RequestPredicate path(String... patterns)
      Return a RequestPredicate that tests the request path against the given path pattern.
      Parameters:
      patterns - the list of patterns to match
      Returns:
      a predicate that tests against the given path pattern
    • query

      @Shortcut public static org.springframework.web.servlet.function.RequestPredicate query(String param)
      Return a RequestPredicate that tests the presence of a request parameter.
      Parameters:
      param - the name of the query parameter
      Returns:
      a predicate that tests for the presence of a given param
    • query

      @Shortcut public static org.springframework.web.servlet.function.RequestPredicate query(String param, @Nullable String regexp)
      Return a RequestPredicate that tests the presence of a request parameter if the regexp is empty, or, otherwise finds if any value of the parameter matches the regexp.
      Parameters:
      param - the name of the query parameter
      regexp - an optional regular expression to match.
      Returns:
      a predicate that tests for the given param and regexp.
    • readBody

      public static <T> org.springframework.web.servlet.function.RequestPredicate readBody(Class<T> inClass, Predicate<T> predicate)
    • version

      @Shortcut public static org.springframework.web.servlet.function.RequestPredicate version(String version)
      RequestPredicate to match to the request API version extracted from and parsed with the configured ApiVersionStrategy.

      The version may be one of the following:

      • Fixed version ("1.2") -- match this version only.
      • Baseline version ("1.2+") -- match this and subsequent versions.

      A baseline version allows n endpoint route to continue to work in subsequent versions if it remains compatible until an incompatible change eventually leads to the creation of a new route.

      Parameters:
      version - the version to use
      Returns:
      the created predicate instance
      Since:
      5.0
    • weight

      @Shortcut public static org.springframework.web.servlet.function.RequestPredicate weight(String group, int weight)
      A predicate which will select a route based on its assigned weight.
      Parameters:
      group - the group the route belongs to
      weight - the weight for the route
      Returns:
      a predicate that tests against the given group and weight.