类 RequestMethodsRequestCondition
- java.lang.Object
- org.springframework.web.reactive.result.condition.AbstractRequestCondition<RequestMethodsRequestCondition>
- org.springframework.web.reactive.result.condition.RequestMethodsRequestCondition
public final class RequestMethodsRequestCondition extends AbstractRequestCondition<RequestMethodsRequestCondition>
A logical disjunction (' || ') request condition that matches a request against a set ofRequestMethods.- 从以下版本开始:
- 5.0
- 作者:
- Rossen Stoyanchev
构造器概要
构造器 构造器 说明 RequestMethodsRequestCondition(RequestMethod... requestMethods)Create a new instance with the given request methods.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 RequestMethodsRequestConditioncombine(RequestMethodsRequestCondition other)Returns a new instance with a union of the HTTP request methods from "this" and the "other" instance.intcompareTo(RequestMethodsRequestCondition other, ServerWebExchange exchange)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'tprotected Collection<RequestMethod>getContent()Return the discrete items a request condition is composed of.RequestMethodsRequestConditiongetMatchingCondition(ServerWebExchange exchange)Check if any of the HTTP request methods match the given request and return an instance that contains the matching HTTP request method only.Set<RequestMethod>getMethods()Returns allRequestMethodscontained in this condition.protected StringgetToStringInfix()The notation to use when printing discrete items of content.从类继承的方法 org.springframework.web.reactive.result.condition.AbstractRequestCondition
equals, hashCode, isEmpty, toString
构造器详细资料
RequestMethodsRequestCondition
public RequestMethodsRequestCondition(RequestMethod... 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
方法详细资料
getMethods
public Set<RequestMethod> getMethods()
Returns allRequestMethodscontained in this condition.
getContent
protected Collection<RequestMethod> getContent()
从类复制的说明:AbstractRequestConditionReturn 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()
从类复制的说明:AbstractRequestConditionThe notation to use when printing discrete items of content.For example
" || "for URL patterns or" && "for param expressions.
combine
public RequestMethodsRequestCondition combine(RequestMethodsRequestCondition other)
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(ServerWebExchange exchange)
Check if any of the HTTP request methods match the given request and return an instance that contains the matching HTTP request method only.- 参数:
exchange- the current exchange- 返回:
- the same instance if the condition is empty (unless the request method is HTTP OPTIONS), a new condition with the matched request method, or
nullif there is no match or the condition is empty and the request method is OPTIONS.
compareTo
public int compareTo(RequestMethodsRequestCondition other, ServerWebExchange exchange)
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(ServerWebExchange)and therefore each instance contains the matching HTTP request method only or is otherwise empty.