Class RestConfig

java.lang.Object
com.evolveum.midpoint.rest.impl.RestConfig
All Implemented Interfaces:
org.springframework.web.servlet.config.annotation.WebMvcConfigurer

@Configuration @ComponentScan public class RestConfig extends Object implements org.springframework.web.servlet.config.annotation.WebMvcConfigurer
Spring configuration for MVC-based REST service. This prepares needed XML/JSON/YAML message converters. It also drives the package scan for REST controllers under this package.
  • Constructor Details

    • RestConfig

      public RestConfig()
  • Method Details

    • configureContentNegotiation

      public void configureContentNegotiation(@NotNull @NotNull org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer configurer)
      Registers content-types for path extension and request parameter usage. Not needed for header-based content negotiation and midPoint typically doesn't use this, but it doesn't hurt and may be handy for download URLs.

      See this tutorial for more about content negotiation.

      Specified by:
      configureContentNegotiation in interface org.springframework.web.servlet.config.annotation.WebMvcConfigurer
    • yamlConverter

      @Bean public MidpointYamlHttpMessageConverter yamlConverter(PrismContext prismContext, LocalizationService localizationService)
    • xmlConverter

      @Bean public MidpointXmlHttpMessageConverter xmlConverter(PrismContext prismContext, LocalizationService localizationService)
    • jsonConverter

      @Bean public MidpointJsonHttpMessageConverter jsonConverter(PrismContext prismContext, LocalizationService localizationService)
    • extendMessageConverters

      public void extendMessageConverters(List<org.springframework.http.converter.HttpMessageConverter<?>> converters)
      All beans above will be first in the converter list and other Spring converters will be available as well. We want to add "catch-all" converter for cases like error output for any (even unsupported) content type.
      Specified by:
      extendMessageConverters in interface org.springframework.web.servlet.config.annotation.WebMvcConfigurer