Class HeadersRequestCondition
java.lang.Object
org.springframework.web.reactive.result.condition.AbstractRequestCondition<HeadersRequestCondition>
org.springframework.web.reactive.result.condition.HeadersRequestCondition
- All Implemented Interfaces:
- RequestCondition<HeadersRequestCondition>
public final class HeadersRequestCondition
extends AbstractRequestCondition<HeadersRequestCondition>
A logical conjunction (
' && ') request condition that matches a request against
a set of header expressions with syntax defined in RequestMapping.headers().
Expressions passed to the constructor with header names 'Accept' or
'Content-Type' are ignored. See ConsumesRequestCondition and
ProducesRequestCondition for those.
- Since:
- 5.0
- Author:
- Rossen Stoyanchev
- 
Constructor SummaryConstructorsConstructorDescriptionHeadersRequestCondition(String... headers) Create a new instance from the given header expressions.
- 
Method SummaryModifier and TypeMethodDescriptioncombine(HeadersRequestCondition other) Returns a new instance with the union of the header expressions from "this" and the "other" instance.intcompareTo(HeadersRequestCondition other, ServerWebExchange exchange) Compare to another condition based on header expressions.protected Collection<org.springframework.web.reactive.result.condition.HeadersRequestCondition.HeaderExpression> Return the discrete items a request condition is composed of.Return the contained request header expressions.getMatchingCondition(ServerWebExchange exchange) Returns "this" instance if the request matches all expressions; ornullotherwise.protected StringThe notation to use when printing discrete items of content.Methods inherited from class AbstractRequestConditionequals, hashCode, isEmpty, toString
- 
Constructor Details- 
HeadersRequestConditionCreate a new instance from the given header expressions. Expressions with header names 'Accept' or 'Content-Type' are ignored. SeeConsumesRequestConditionandProducesRequestConditionfor those.- Parameters:
- headers- media type expressions with syntax defined in- RequestMapping.headers(); if 0, the condition will match to every request
 
 
- 
- 
Method Details- 
getExpressionsReturn the contained request header expressions.
- 
getContentprotected Collection<org.springframework.web.reactive.result.condition.HeadersRequestCondition.HeaderExpression> getContent()Description copied from class:AbstractRequestConditionReturn the discrete items a request condition is composed of.For example URL patterns, HTTP request methods, param expressions, etc. - Specified by:
- getContentin class- AbstractRequestCondition<HeadersRequestCondition>
- Returns:
- a collection of objects (never null)
 
- 
getToStringInfixDescription copied from class:AbstractRequestConditionThe notation to use when printing discrete items of content.For example " || "for URL patterns or" && "for param expressions.- Specified by:
- getToStringInfixin class- AbstractRequestCondition<HeadersRequestCondition>
 
- 
combineReturns a new instance with the union of the header expressions from "this" and the "other" instance.- Parameters:
- other- the condition to combine with.
- Returns:
- a request condition instance that is the result of combining the two condition instances.
 
- 
getMatchingConditionReturns "this" instance if the request matches all expressions; ornullotherwise.- Returns:
- a condition instance in case of a match or nullotherwise.
 
- 
compareToCompare to another condition based on header expressions. A condition is considered to be a more specific match, if it has:- A greater number of expressions.
- A greater number of non-negated expressions with a concrete value.
 It is assumed that both instances have been obtained via getMatchingCondition(ServerWebExchange)and each instance contains the matching header expression only or is otherwise empty.
 
-