Example usage for org.springframework.http MediaType copyQualityValue

List of usage examples for org.springframework.http MediaType copyQualityValue

Introduction

In this page you can find the example usage for org.springframework.http MediaType copyQualityValue.

Prototype

public MediaType copyQualityValue(MediaType mediaType) 

Source Link

Document

Return a replica of this instance with the quality value of the given MediaType .

Usage

From source file:org.craftercms.commons.rest.HttpMessageConvertingResponseWriter.java

/**
 * Return the more specific of the acceptable and the producible media types with the q-value of the former.
 *//*from   w ww.j  ava 2s .c  o m*/
protected MediaType getMostSpecificMediaType(MediaType acceptType, MediaType produceType) {
    produceType = produceType.copyQualityValue(acceptType);

    return MediaType.SPECIFICITY_COMPARATOR.compare(acceptType, produceType) <= 0 ? acceptType : produceType;
}

From source file:org.beadle.framework.view.ReturnTypeViewResolver.java

/**
 * Return the more specific of the acceptable and the producible media types
 * with the q-value of the former./*from w ww .  j a  v  a  2s. co  m*/
 */
private MediaType getMostSpecificMediaType(MediaType acceptType, MediaType produceType) {
    produceType = produceType.copyQualityValue(acceptType);
    return MediaType.SPECIFICITY_COMPARATOR.compare(acceptType, produceType) < 0 ? acceptType : produceType;
}

From source file:org.springframework.boot.actuate.endpoint.mvc.EndpointHandlerAdapter.java

private MediaType getMostSpecificMediaType(MediaType acceptType, MediaType produceType) {
    produceType = produceType.copyQualityValue(acceptType);
    return MediaType.SPECIFICITY_COMPARATOR.compare(acceptType, produceType) <= 0 ? acceptType : produceType;
}

From source file:org.springframework.web.reactive.result.HandlerResultHandlerSupport.java

private MediaType selectMoreSpecificMediaType(MediaType acceptable, MediaType producible) {
    producible = producible.copyQualityValue(acceptable);
    Comparator<MediaType> comparator = MediaType.SPECIFICITY_COMPARATOR;
    return (comparator.compare(acceptable, producible) <= 0 ? acceptable : producible);
}