本文整理汇总了Java中org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer.defaultContentType方法的典型用法代码示例。如果您正苦于以下问题:Java ContentNegotiationConfigurer.defaultContentType方法的具体用法?Java ContentNegotiationConfigurer.defaultContentType怎么用?Java ContentNegotiationConfigurer.defaultContentType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer
的用法示例。
在下文中一共展示了ContentNegotiationConfigurer.defaultContentType方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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) {
configurer.favorPathExtension(false);
configurer.ignoreAcceptHeader(false);
configurer.defaultContentType(MediaType.TEXT_PLAIN);
configurer.mediaType("html", MediaType.TEXT_HTML);
configurer.mediaType("xml", MediaType.APPLICATION_XML);
}
示例3: 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);
}
示例4: 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);
}
示例5: 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);
}
示例6: 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);
}
示例7: configureContentNegotiation
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; //导入方法依赖的package包/类
@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
configurer.defaultContentType(MediaType.APPLICATION_JSON);
}
示例8: configureContentNegotiation
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; //导入方法依赖的package包/类
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
configurer.favorPathExtension(true);
configurer.ignoreAcceptHeader(true);
configurer.defaultContentType(MediaType.APPLICATION_JSON);
}
示例9: configureContentNegotiation
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; //导入方法依赖的package包/类
/**
* Setup a simple strategy: use all the defaults and return JSON by default when not sure.
*/
@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
configurer.defaultContentType(MediaType.APPLICATION_JSON);
}
示例10: configureContentNegotiation
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; //导入方法依赖的package包/类
@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer){
configurer.defaultContentType(MediaType.APPLICATION_JSON);
}
示例11: configureContentNegotiation
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; //导入方法依赖的package包/类
@Override
protected void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
// default to JSON
configurer.defaultContentType(MediaType.APPLICATION_JSON);
}