本文整理汇总了Java中org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer.mediaType方法的典型用法代码示例。如果您正苦于以下问题:Java ContentNegotiationConfigurer.mediaType方法的具体用法?Java ContentNegotiationConfigurer.mediaType怎么用?Java ContentNegotiationConfigurer.mediaType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer
的用法示例。
在下文中一共展示了ContentNegotiationConfigurer.mediaType方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureContentNegotiation
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; //导入方法依赖的package包/类
@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
configurer.defaultContentType(MediaType.TEXT_HTML);
for (Type value : Type.values()) {
configurer.mediaType(value.getExtension(), value.getMediaType());
}
}
示例2: configureContentNegotiation
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; //导入方法依赖的package包/类
@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
Map<String, MediaType> mediaTypes = this.mvcProperties.getMediaTypes();
for (Entry<String, MediaType> mediaType : mediaTypes.entrySet()) {
configurer.mediaType(mediaType.getKey(), mediaType.getValue());
}
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:8,代码来源:WebMvcAutoConfiguration.java
示例3: configureContentNegotiation
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; //导入方法依赖的package包/类
/**
* Visitor method to configure content negotiation for this converter.
* @param configurer {@link WebMvcConfigurerAdapter#configureContentNegotiation(ContentNegotiationConfigurer)
* WebMvcConfigurerAdapter} configurer instance.
*/
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
configurer.mediaType(format.getDefaultFileExtension(),
MediaType.parseMediaType(format.getDefaultMIMEType()));
LOGGER.info("registering {} with {}", format.getDefaultFileExtension(),
format.getDefaultMIMEType());
}
示例4: configureContentNegotiation
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; //导入方法依赖的package包/类
@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
Properties mediaTypes = jfishBootConfig.getMvc().getMediaTypes();
if (!CollectionUtils.isEmpty(mediaTypes)) {
for (Entry<Object, Object> entry : mediaTypes.entrySet()) {
String extension = ((String)entry.getKey()).toLowerCase(Locale.ENGLISH);
configurer.mediaType(extension, MediaType.valueOf((String) entry.getValue()));
}
}
}
示例5: configureContentNegotiation
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; //导入方法依赖的package包/类
@Override
public void configureContentNegotiation(
ContentNegotiationConfigurer configurer) {
configurer.favorPathExtension(false);
configurer.ignoreAcceptHeader(false);
configurer.defaultContentType(MediaType.TEXT_PLAIN);
configurer.mediaType("html", MediaType.TEXT_HTML);
configurer.mediaType("xml", MediaType.APPLICATION_XML);
}
示例6: configureContentNegotiation
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; //导入方法依赖的package包/类
@Override
protected void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
configurer.defaultContentType(MediaType.APPLICATION_JSON);
configurer.favorPathExtension(true);
configurer.ignoreAcceptHeader(false);
configurer.mediaType("json", MediaType.APPLICATION_JSON);
configurer.mediaType("jsonp", new MediaType("application", "x-javascript"));
super.configureContentNegotiation(configurer);
}
示例7: configureContentNegotiation
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; //导入方法依赖的package包/类
@Override
public void configureContentNegotiation(
ContentNegotiationConfigurer configurer) {
configurer.ignoreAcceptHeader(true);
configurer.defaultContentType(MediaType.TEXT_HTML);
configurer.mediaType("html", MediaType.TEXT_HTML);
configurer.mediaType("xml", MediaType.APPLICATION_XML);
}
示例8: configureContentNegotiation
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; //导入方法依赖的package包/类
@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
configurer.mediaType("json", MediaType.APPLICATION_JSON_UTF8);
configurer.mediaType("xml", MediaType.APPLICATION_XML);
configurer.defaultContentType(API_V3_MEDIA_TYPE);
configurer.favorParameter(true);
configurer.favorPathExtension(false);
}
示例9: configureContentNegotiation
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; //导入方法依赖的package包/类
@Override
public void configureContentNegotiation(final ContentNegotiationConfigurer configurer) {
configurer.defaultContentType(MediaType.APPLICATION_FORM_URLENCODED);
configurer.favorPathExtension(false);
configurer.mediaType("xml", MediaType.TEXT_XML);
}
示例10: configureContentNegotiation
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; //导入方法依赖的package包/类
@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
configurer.mediaType("json", MediaType.APPLICATION_JSON);
configurer.mediaType("jsonp", new MediaType("application", "x-javascript"));
}
示例11: configureContentNegotiation
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; //导入方法依赖的package包/类
@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
configurer.mediaType("properties", MediaType.valueOf("text/plain"));
configurer.mediaType("yml", MediaType.valueOf("text/yaml"));
configurer.mediaType("yaml", MediaType.valueOf("text/yaml"));
}
示例12: configureContentNegotiation
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; //导入方法依赖的package包/类
@Override
public void configureContentNegotiation (ContentNegotiationConfigurer configurer) {
configurer.mediaType (NEWICK_EXTENSION, NEWICK_MEDIA_TYPE);
}