当前位置: 首页>>代码示例>>Java>>正文


Java MediaType.toString方法代码示例

本文整理汇总了Java中javax.ws.rs.core.MediaType.toString方法的典型用法代码示例。如果您正苦于以下问题:Java MediaType.toString方法的具体用法?Java MediaType.toString怎么用?Java MediaType.toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.ws.rs.core.MediaType的用法示例。


在下文中一共展示了MediaType.toString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDocumentationMessageMapper

import javax.ws.rs.core.MediaType; //导入方法依赖的package包/类
/**
 * Returns the right {@link DocumentationMessageMapper} for the provided
 * {@code MediaType} that supports writing the provided {@link
 * Documentation}.
 *
 * @param  mediaType the request's {@code MediaType}
 * @param  documentation the {@code Documentation} to write
 * @return the {@code DocumentationMessageMapper} that writes the {@code
 *         Documentation} in the {@code MediaType}
 */
protected DocumentationMessageMapper getDocumentationMessageMapper(
	MediaType mediaType, Documentation documentation) {

	Stream<DocumentationMessageMapper> stream =
		_documentationMessageMappers.stream();

	String mediaTypeString = mediaType.toString();

	return stream.filter(
		bodyWriter ->
			mediaTypeString.equals(bodyWriter.getMediaType()) &&
			bodyWriter.supports(documentation, _httpHeaders)
	).findFirst(
	).orElseThrow(
		() -> new MustHaveDocumentationMessageMapper(mediaTypeString)
	);
}
 
开发者ID:liferay,项目名称:com-liferay-apio-architect,代码行数:28,代码来源:DocumentationMessageBodyWriter.java

示例2: getSingleModelMessageMapper

import javax.ws.rs.core.MediaType; //导入方法依赖的package包/类
/**
 * Returns the right {@link SingleModelMessageMapper} for the provided
 * {@code MediaType} that supports writing the provided {@link SingleModel}.
 *
 * @param  mediaType the request's {@code MediaType}
 * @param  singleModel the single model to write
 * @return the {@code SingleModelMessageMapper} that writes the {@code
 *         SingleModel} in the {@code MediaType}
 */
protected SingleModelMessageMapper<T> getSingleModelMessageMapper(
	MediaType mediaType, SingleModel<T> singleModel) {

	Stream<SingleModelMessageMapper<T>> stream =
		_singleModelMessageMappers.stream();

	String mediaTypeString = mediaType.toString();

	return stream.filter(
		messageMapper ->
			mediaTypeString.equals(messageMapper.getMediaType()) &&
			 messageMapper.supports(singleModel, _httpHeaders)
	).findFirst(
	).orElseThrow(
		() -> new ApioDeveloperError.MustHaveMessageMapper(
			mediaTypeString, singleModel.getModelClass())
	);
}
 
开发者ID:liferay,项目名称:com-liferay-apio-architect,代码行数:28,代码来源:SingleModelMessageBodyWriter.java

示例3: getPageMessageMapper

import javax.ws.rs.core.MediaType; //导入方法依赖的package包/类
/**
 * Returns the right {@link PageMessageMapper} for the provided {@code
 * MediaType} that supports writing the provided {@link Page}.
 *
 * @param  mediaType the request's {@code MediaType}
 * @param  page the {@code Page} to write
 * @return the {@code PageMessageMapper} that writes the {@code Page} in the
 *         {@code MediaType}
 */
protected PageMessageMapper<T> getPageMessageMapper(
	MediaType mediaType, Page<T> page) {

	Stream<PageMessageMapper<T>> stream = _pageMessageMappers.stream();

	String mediaTypeString = mediaType.toString();

	return stream.filter(
		bodyWriter ->
			mediaTypeString.equals(bodyWriter.getMediaType()) &&
			bodyWriter.supports(page, _httpHeaders)
	).findFirst(
	).orElseThrow(
		() -> new MustHaveMessageMapper(
			mediaTypeString, page.getModelClass())
	);
}
 
开发者ID:liferay,项目名称:com-liferay-apio-architect,代码行数:27,代码来源:PageMessageBodyWriter.java

示例4: getFormMessageMapper

import javax.ws.rs.core.MediaType; //导入方法依赖的package包/类
/**
 * Returns the right {@link FormMessageMapper} for the provided {@code
 * MediaType} that supports writing the provided {@link Form}.
 *
 * @param  mediaType the request's {@code MediaType}
 * @param  form the {@code Form} to write
 * @return the {@code FormMessageMapper} that writes the {@code Form} in the
 *         {@code MediaType}
 */
protected FormMessageMapper getFormMessageMapper(
	MediaType mediaType, Form form) {

	Stream<FormMessageMapper> stream = _formMessageMappers.stream();

	String mediaTypeString = mediaType.toString();

	return stream.filter(
		bodyWriter ->
			mediaTypeString.equals(bodyWriter.getMediaType()) &&
			bodyWriter.supports(form, _httpHeaders)
	).findFirst(
	).orElseThrow(
		() -> new MustHaveFormMessageMapper(mediaTypeString)
	);
}
 
开发者ID:liferay,项目名称:com-liferay-apio-architect,代码行数:26,代码来源:FormMessageBodyWriter.java

示例5: _415MediaNotSupportException

import javax.ws.rs.core.MediaType; //导入方法依赖的package包/类
public _415MediaNotSupportException(final Class<?> clazz,
                                    final MediaType media,
                                    final Set<MediaType> expected) {
    super(clazz, media.toString(), StringUtil.join(expected.toArray(new MediaType[]{})));
}
 
开发者ID:silentbalanceyh,项目名称:vertx-zero,代码行数:6,代码来源:_415MediaNotSupportException.java

示例6: MessageBodyReaderContext

import javax.ws.rs.core.MediaType; //导入方法依赖的package包/类
public MessageBodyReaderContext(InputStream in, MediaType mediaType){
    this.in = in;
    this.contentType = mediaType.toString();
    String charset = mediaType.getParameters().get("charset");
    this.charEncoding = charset == null ? "UTF-8" : charset;
}
 
开发者ID:teamdigitale,项目名称:ontonethub,代码行数:7,代码来源:IndexingJobInputReader.java


注:本文中的javax.ws.rs.core.MediaType.toString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。