use of org.hisp.dhis.webapi.view.CustomPathExtensionContentNegotiationStrategy in project dhis2-core by dhis2.
the class MvcTestConfig method requestMappingHandlerMapping.
@Bean
public CustomRequestMappingHandlerMapping requestMappingHandlerMapping(FormattingConversionService mvcConversionService, ResourceUrlProvider mvcResourceUrlProvider) {
CustomPathExtensionContentNegotiationStrategy pathExtensionNegotiationStrategy = new CustomPathExtensionContentNegotiationStrategy(mediaTypeMap);
pathExtensionNegotiationStrategy.setUseRegisteredExtensionsOnly(true);
ContentNegotiationManager manager = new ContentNegotiationManager(Arrays.asList(pathExtensionNegotiationStrategy, new HeaderContentNegotiationStrategy(), new FixedContentNegotiationStrategy(MediaType.APPLICATION_JSON)));
CustomRequestMappingHandlerMapping mapping = new CustomRequestMappingHandlerMapping();
mapping.setOrder(0);
mapping.setContentNegotiationManager(manager);
TestInterceptorRegistry registry = new TestInterceptorRegistry();
addInterceptors(registry);
registry.addInterceptor(new ConversionServiceExposingInterceptor(mvcConversionService));
registry.addInterceptor(new ResourceUrlProviderExposingInterceptor(mvcResourceUrlProvider));
mapping.setInterceptors(registry.getInterceptors().toArray());
return mapping;
}
use of org.hisp.dhis.webapi.view.CustomPathExtensionContentNegotiationStrategy in project dhis2-core by dhis2.
the class WebMvcConfig method mvcContentNegotiationManager.
@Primary
@Bean
@Override
public ContentNegotiationManager mvcContentNegotiationManager() {
CustomPathExtensionContentNegotiationStrategy pathExtensionNegotiationStrategy = new CustomPathExtensionContentNegotiationStrategy(mediaTypeMap);
pathExtensionNegotiationStrategy.setUseRegisteredExtensionsOnly(true);
return new ContentNegotiationManager(Arrays.asList(pathExtensionNegotiationStrategy, new HeaderContentNegotiationStrategy(), new FixedContentNegotiationStrategy(MediaType.APPLICATION_JSON)));
}
Aggregations