List of usage examples for com.google.common.net MediaType withoutParameters
public MediaType withoutParameters()
From source file:demetra.cli.chart.ChartToolImpl.java
@Override public void writeChart(TsCollectionInformation col, Options options, OutputStream stream, MediaType mediaType) throws IOException { JTimeSeriesChart chart = new JTimeSeriesChart(); applyContent(chart, col);/* w w w . j av a2 s. com*/ applyOptions(chart, options); chart.doLayout(); chart.writeImage(mediaType.withoutParameters().toString(), stream); }
From source file:org.mule.module.apikit.HttpRestRequest.java
private String negotiateOutputRepresentation(List<MimeType> mimeTypes) throws MuleRestException { if (action == null || action.getResponses() == null || mimeTypes.isEmpty()) { //no response media-types defined, return no body return null; }/* w ww. j av a2 s . c om*/ MediaType bestMatch = RestContentTypeParser.bestMatch(mimeTypes, adapter.getAcceptableResponseMediaTypes()); if (bestMatch == null) { return handleNotAcceptable(); } logger.debug("=== negotiated response content-type: " + bestMatch.toString()); for (MimeType representation : mimeTypes) { if (representation.getType().equals(bestMatch.withoutParameters().toString())) { return representation.getType(); } } return handleNotAcceptable(); }