Class MediaTypeUtils
java.lang.Object
ubic.gemma.rest.util.MediaTypeUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic jakarta.ws.rs.core.MediaTypenegotiate(jakarta.ws.rs.core.HttpHeaders headers, jakarta.ws.rs.core.MediaType... types) Perform content negotiation of a given set of HTTP headers against a list of possible media types.static jakarta.ws.rs.core.MediaTypewithoutQuality(jakarta.ws.rs.core.MediaType mediaType) Create a media type without a quality indicator.static jakarta.ws.rs.core.MediaTypewithQuality(jakarta.ws.rs.core.MediaType mediaType, double quality) Create a media type with a quality indicator.
-
Constructor Details
-
MediaTypeUtils
public MediaTypeUtils()
-
-
Method Details
-
withQuality
public static jakarta.ws.rs.core.MediaType withQuality(jakarta.ws.rs.core.MediaType mediaType, double quality) Create a media type with a quality indicator. -
withoutQuality
public static jakarta.ws.rs.core.MediaType withoutQuality(jakarta.ws.rs.core.MediaType mediaType) Create a media type without a quality indicator. -
negotiate
public static jakarta.ws.rs.core.MediaType negotiate(jakarta.ws.rs.core.HttpHeaders headers, jakarta.ws.rs.core.MediaType... types) throws jakarta.ws.rs.NotAcceptableException Perform content negotiation of a given set of HTTP headers against a list of possible media types.Media type may include a quality score by setting the
qparameter. If omitted, this score defaults to1.0. The pair of compatible accepted and produced types with the highest product is returned.- Parameters:
headers- HTTP headers from the client,HttpHeaders.getAcceptableMediaTypes()is used to determine acceptable media typestypes- an array of produced media types- Returns:
- one of the produced media type, stripped if its quality score with
withoutQuality(MediaType) - Throws:
jakarta.ws.rs.NotAcceptableException- if the negotiation fails (i.e. no media types can be satisfied)
-