Class MediaTypeServerWebExchangeMatcher
- java.lang.Object
-
- org.springframework.security.web.server.util.matcher.MediaTypeServerWebExchangeMatcher
-
- All Implemented Interfaces:
ServerWebExchangeMatcher
public class MediaTypeServerWebExchangeMatcher extends java.lang.Object implements ServerWebExchangeMatcher
Matches based upon the accept headers.- Since:
- 5.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher
ServerWebExchangeMatcher.MatchResult
-
-
Constructor Summary
Constructors Constructor Description MediaTypeServerWebExchangeMatcher(java.util.Collection<org.springframework.http.MediaType> matchingMediaTypes)
Creates a new instanceMediaTypeServerWebExchangeMatcher(org.springframework.http.MediaType... matchingMediaTypes)
Creates a new instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description reactor.core.publisher.Mono<ServerWebExchangeMatcher.MatchResult>
matches(org.springframework.web.server.ServerWebExchange exchange)
Determines if a request matches or notvoid
setIgnoredMediaTypes(java.util.Set<org.springframework.http.MediaType> ignoredMediaTypes)
Set theMediaType
to ignore from theContentNegotiationStrategy
.void
setUseEquals(boolean useEquals)
If set to true, matches on exactMediaType
, else usesMediaType.isCompatibleWith(MediaType)
.java.lang.String
toString()
-
-
-
Constructor Detail
-
MediaTypeServerWebExchangeMatcher
public MediaTypeServerWebExchangeMatcher(org.springframework.http.MediaType... matchingMediaTypes)
Creates a new instance- Parameters:
matchingMediaTypes
- the types to match on
-
MediaTypeServerWebExchangeMatcher
public MediaTypeServerWebExchangeMatcher(java.util.Collection<org.springframework.http.MediaType> matchingMediaTypes)
Creates a new instance- Parameters:
matchingMediaTypes
- the types to match on
-
-
Method Detail
-
matches
public reactor.core.publisher.Mono<ServerWebExchangeMatcher.MatchResult> matches(org.springframework.web.server.ServerWebExchange exchange)
Description copied from interface:ServerWebExchangeMatcher
Determines if a request matches or not- Specified by:
matches
in interfaceServerWebExchangeMatcher
- Returns:
-
setUseEquals
public void setUseEquals(boolean useEquals)
If set to true, matches on exactMediaType
, else usesMediaType.isCompatibleWith(MediaType)
.- Parameters:
useEquals
- specify if equals comparison should be used.
-
setIgnoredMediaTypes
public void setIgnoredMediaTypes(java.util.Set<org.springframework.http.MediaType> ignoredMediaTypes)
Set theMediaType
to ignore from theContentNegotiationStrategy
. This is useful if for example, you want to match onMediaType.APPLICATION_JSON
but want to ignoreMediaType.ALL
.- Parameters:
ignoredMediaTypes
- theMediaType
's to ignore from theContentNegotiationStrategy
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-