public final class HeadersRequestCondition extends AbstractRequestCondition<HeadersRequestCondition>
RequestMapping.headers()
.
Expressions passed to the constructor with header names 'Accept' or
'Content-Type' are ignored. See ConsumesRequestCondition
and
ProducesRequestCondition
for those.
Constructor and Description |
---|
HeadersRequestCondition(String... headers)
Create a new instance from the given header expressions.
|
Modifier and Type | Method and Description |
---|---|
HeadersRequestCondition |
combine(HeadersRequestCondition other)
Returns a new instance with the union of the header expressions
from "this" and the "other" instance.
|
int |
compareTo(HeadersRequestCondition other,
ServerWebExchange exchange)
Compare to another condition based on header expressions.
|
protected Collection<org.springframework.web.reactive.result.condition.HeadersRequestCondition.HeaderExpression> |
getContent()
Return the discrete items a request condition is composed of.
|
Set<NameValueExpression<String>> |
getExpressions()
Return the contained request header expressions.
|
HeadersRequestCondition |
getMatchingCondition(ServerWebExchange exchange)
Returns "this" instance if the request matches all expressions;
or
null otherwise. |
protected String |
getToStringInfix()
The notation to use when printing discrete items of content.
|
equals, hashCode, isEmpty, toString
public HeadersRequestCondition(String... headers)
ConsumesRequestCondition
and ProducesRequestCondition
for those.headers
- media type expressions with syntax defined in RequestMapping.headers()
;
if 0, the condition will match to every requestpublic Set<NameValueExpression<String>> getExpressions()
protected Collection<org.springframework.web.reactive.result.condition.HeadersRequestCondition.HeaderExpression> getContent()
AbstractRequestCondition
For example URL patterns, HTTP request methods, param expressions, etc.
getContent
in class AbstractRequestCondition<HeadersRequestCondition>
null
)protected String getToStringInfix()
AbstractRequestCondition
For example " || "
for URL patterns or " && "
for param expressions.
getToStringInfix
in class AbstractRequestCondition<HeadersRequestCondition>
public HeadersRequestCondition combine(HeadersRequestCondition other)
other
- the condition to combine with.@Nullable public HeadersRequestCondition getMatchingCondition(ServerWebExchange exchange)
null
otherwise.null
otherwise.public int compareTo(HeadersRequestCondition other, ServerWebExchange exchange)
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.