Java Code Examples for org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer#defaultContentType()

The following examples show how to use org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer#defaultContentType() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DelegatingCatnapWebMvcConfiguration.java    From catnap with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 2
Source File: WidgetConfiguration.java    From catnap with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 3
Source File: WebConfig.java    From Project with Apache License 2.0 4 votes vote down vote up
@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
	configurer.defaultContentType(MediaType.TEXT_HTML);//默认为HTML
}
 
Example 4
Source File: WebConfig.java    From Microservices-with-Spring-Cloud with MIT License 4 votes vote down vote up
@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
    configurer.defaultContentType(MediaType.APPLICATION_JSON_UTF8);
}
 
Example 5
Source File: WebConfig.java    From Microservices-with-Spring-Cloud with MIT License 4 votes vote down vote up
@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
    configurer.defaultContentType(MediaType.APPLICATION_JSON_UTF8);
}
 
Example 6
Source File: WebConfig.java    From Microservices-with-Spring-Cloud with MIT License 4 votes vote down vote up
@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
    configurer.defaultContentType(MediaType.APPLICATION_JSON_UTF8);
}
 
Example 7
Source File: WebMvcConfiguration.java    From graviteeio-access-management with Apache License 2.0 4 votes vote down vote up
@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
    configurer.defaultContentType(MediaType.APPLICATION_JSON);
}
 
Example 8
Source File: SpringMvcConfiguration.java    From chassis with Apache License 2.0 4 votes vote down vote up
@Override
protected void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
    // default to JSON
    configurer.defaultContentType(MediaType.APPLICATION_JSON);
}
 
Example 9
Source File: TestWebAppConfig.java    From spring-blog with MIT License 4 votes vote down vote up
@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer){
	configurer.defaultContentType(MediaType.APPLICATION_JSON);
}
 
Example 10
Source File: MvcConfig.java    From tutorials with MIT License 4 votes vote down vote up
@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
    configurer.defaultContentType(MediaType.APPLICATION_JSON);
}
 
Example 11
Source File: MvcConfig.java    From tutorials with MIT License 4 votes vote down vote up
@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
    configurer.defaultContentType(MediaType.APPLICATION_JSON);
}
 
Example 12
Source File: WebMvcConfig.java    From BlogManagePlatform with Apache License 2.0 2 votes vote down vote up
/**
 * 配置默认媒体类型
 * @author Frodez
 * @date 2019-05-10
 */
@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
	configurer.defaultContentType(MediaType.APPLICATION_JSON);
}