Java Code Examples for org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer#mediaType()
The following examples show how to use
org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer#mediaType() .
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: BootMvcConfigurerAdapter.java From onetwo with Apache License 2.0 | 5 votes |
@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())); } } }
Example 2
Source File: DelegatingCatnapWebMvcConfiguration.java From catnap with Apache License 2.0 | 5 votes |
@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: WidgetConfiguration.java From catnap with Apache License 2.0 | 5 votes |
@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 4
Source File: SpringWebMvcConfigurer.java From runelite with BSD 2-Clause "Simplified" License | 4 votes |
/** * Configure .js as application/json to trick Cloudflare into caching json responses */ @Override public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { configurer.mediaType("js", MediaType.APPLICATION_JSON); }
Example 5
Source File: CatnapWebMvcConfigurerAdapter.java From catnap with Apache License 2.0 | 4 votes |
@Override public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { configurer.mediaType("json", MediaType.APPLICATION_JSON); configurer.mediaType("jsonp", new MediaType("application", "x-javascript")); }
Example 6
Source File: ConfigServerMvcConfiguration.java From spring-cloud-config with Apache License 2.0 | 4 votes |
@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")); }