question: protected MediaType selectMediaType ( ServerWebExchange exchange , List < MediaType > producibleTypes ) { List < MediaType > acceptableTypes = getAcceptableTypes ( exchange ) ; producibleTypes = getProducibleTypes ( exchange , producibleTypes ) ; Set < MediaType > compatibleMediaTypes = new LinkedHashSet < > ( ) ; for ( MediaType acceptable : acceptableTypes ) { for ( MediaType producible : producibleTypes ) { if ( acceptable . isCompatibleWith ( producible ) ) { compatibleMediaTypes . add ( selectMoreSpecificMediaType ( acceptable , producible ) ) ; } } } List < MediaType > result = new ArrayList < > ( compatibleMediaTypes ) ; MediaType . sortBySpecificityAndQuality ( result ) ; for ( MediaType mediaType : compatibleMediaTypes ) { if ( mediaType . isConcrete ( ) ) { return mediaType ; } else if ( mediaType . equals ( MediaType . ALL ) || mediaType . equals ( MEDIA_TYPE_APPLICATION_ALL ) ) { return MediaType . APPLICATION_OCTET_STREAM ; } } return null ; }
target:  Select the best media type for the current request through a content negotiation algorithm.