Class MediaTypeServerWebExchangeMatcher

java.lang.Object
org.springframework.security.web.server.util.matcher.MediaTypeServerWebExchangeMatcher
All Implemented Interfaces:
ServerWebExchangeMatcher

public class MediaTypeServerWebExchangeMatcher extends Object implements ServerWebExchangeMatcher
Matches based upon the accept headers.
Since:
5.0
  • Constructor Details

    • MediaTypeServerWebExchangeMatcher

      public MediaTypeServerWebExchangeMatcher(org.springframework.http.MediaType... matchingMediaTypes)
      Creates a new instance
      Parameters:
      matchingMediaTypes - the types to match on
    • MediaTypeServerWebExchangeMatcher

      public MediaTypeServerWebExchangeMatcher(Collection<org.springframework.http.MediaType> matchingMediaTypes)
      Creates a new instance
      Parameters:
      matchingMediaTypes - the types to match on
  • Method Details

    • 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 interface ServerWebExchangeMatcher
      Returns:
    • setUseEquals

      public void setUseEquals(boolean useEquals)
      If set to true, matches on exact MediaType, else uses MediaType.isCompatibleWith(MediaType).
      Parameters:
      useEquals - specify if equals comparison should be used.
    • setIgnoredMediaTypes

      public void setIgnoredMediaTypes(Set<org.springframework.http.MediaType> ignoredMediaTypes)
      Set the MediaType to ignore from the ContentNegotiationStrategy. This is useful if for example, you want to match on MediaType.APPLICATION_JSON but want to ignore MediaType.ALL.
      Parameters:
      ignoredMediaTypes - the MediaType's to ignore from the ContentNegotiationStrategy
    • toString

      public String toString()
      Overrides:
      toString in class Object