类 RequestMethodsRequestCondition

java.lang.Object
cn.taketoday.web.handler.condition.AbstractRequestCondition<RequestMethodsRequestCondition>
cn.taketoday.web.handler.condition.RequestMethodsRequestCondition
所有已实现的接口:
RequestCondition<RequestMethodsRequestCondition>

public final class RequestMethodsRequestCondition extends AbstractRequestCondition<RequestMethodsRequestCondition>
A logical disjunction (' || ') request condition that matches a request against a set of HttpMethods.
从以下版本开始:
4.0
作者:
Arjen Poutsma, Rossen Stoyanchev
  • 字段详细资料

  • 构造器详细资料

    • RequestMethodsRequestCondition

      public RequestMethodsRequestCondition(HttpMethod... requestMethods)
      Create a new instance with the given request methods.
      参数:
      requestMethods - 0 or more HTTP request methods; if, 0 the condition will match to every request
    • RequestMethodsRequestCondition

      private RequestMethodsRequestCondition(Set<HttpMethod> methods)
      Private constructor for internal use when combining conditions.
  • 方法详细资料

    • getMethods

      public Set<HttpMethod> getMethods()
      Returns all RequestMethods contained in this condition.
    • getContent

      protected Collection<HttpMethod> getContent()
      从类复制的说明: AbstractRequestCondition
      Return the discrete items a request condition is composed of.

      For example URL patterns, HTTP request methods, param expressions, etc.

      指定者:
      getContent 在类中 AbstractRequestCondition<RequestMethodsRequestCondition>
      返回:
      a collection of objects (never null)
    • getToStringInfix

      protected String getToStringInfix()
      从类复制的说明: AbstractRequestCondition
      The notation to use when printing discrete items of content.

      For example " || " for URL patterns or " && " for param expressions.

      指定者:
      getToStringInfix 在类中 AbstractRequestCondition<RequestMethodsRequestCondition>
    • combine

      Returns a new instance with a union of the HTTP request methods from "this" and the "other" instance.
      参数:
      other - the condition to combine with.
      返回:
      a request condition instance that is the result of combining the two condition instances.
    • getMatchingCondition

      @Nullable public RequestMethodsRequestCondition getMatchingCondition(RequestContext request)
      Check if any of the HTTP request methods match the given request and return an instance that contains the matching HTTP request method only.
      参数:
      request - the current request
      返回:
      the same instance if the condition is empty (unless the request method is HTTP OPTIONS), a new condition with the matched request method, or null if there is no match or the condition is empty and the request method is OPTIONS.
    • matchPreFlight

      @Nullable private RequestMethodsRequestCondition matchPreFlight(RequestContext request)
      On a pre-flight request match to the would-be, actual request. Hence empty conditions is a match, otherwise try to match to the HTTP method in the "Access-Control-Request-Method" header.
    • matchRequestMethod

      @Nullable private RequestMethodsRequestCondition matchRequestMethod(HttpMethod requestMethod)
    • compareTo

      public int compareTo(RequestMethodsRequestCondition other, RequestContext request)
      Returns:
      • 0 if the two conditions contain the same number of HTTP request methods
      • Less than 0 if "this" instance has an HTTP request method but "other" doesn't
      • Greater than 0 "other" has an HTTP request method but "this" doesn't

      It is assumed that both instances have been obtained via getMatchingCondition(RequestContext) and therefore each instance contains the matching HTTP request method only or is otherwise empty.

      request - the current request context