Package org.springframework.hateoas.mvc

Examples of org.springframework.hateoas.mvc.TypeConstrainedMappingJackson2HttpMessageConverter


    // Configure this mapper to be used if HAL is not the default media type
    if (!config().useHalAsDefaultJsonMediaType()) {
      mediaTypes.add(MediaType.APPLICATION_JSON);
    }

    MappingJackson2HttpMessageConverter jacksonConverter = new TypeConstrainedMappingJackson2HttpMessageConverter(
        ResourceSupport.class);
    jacksonConverter.setObjectMapper(objectMapper());
    jacksonConverter.setSupportedMediaTypes(mediaTypes);

    return jacksonConverter;
  }
View Full Code Here


    // Enable returning HAL if application/json is asked if it's configured to be the default type
    if (config().useHalAsDefaultJsonMediaType()) {
      mediaTypes.add(MediaType.APPLICATION_JSON);
    }

    MappingJackson2HttpMessageConverter converter = new TypeConstrainedMappingJackson2HttpMessageConverter(
        ResourceSupport.class);
    converter.setObjectMapper(halObjectMapper());
    converter.setSupportedMediaTypes(mediaTypes);

    return converter;
  }
View Full Code Here

      ObjectMapper halObjectMapper = beanFactory.getBean(HAL_OBJECT_MAPPER_BEAN_NAME, ObjectMapper.class);

      halObjectMapper.registerModule(new Jackson2HalModule());
      halObjectMapper.setHandlerInstantiator(new Jackson2HalModule.HalHandlerInstantiator(relProvider, curieProvider));

      MappingJackson2HttpMessageConverter halConverter = new TypeConstrainedMappingJackson2HttpMessageConverter(
          ResourceSupport.class);
      halConverter.setSupportedMediaTypes(Arrays.asList(HAL_JSON));
      halConverter.setObjectMapper(halObjectMapper);

      List<HttpMessageConverter<?>> result = new ArrayList<HttpMessageConverter<?>>(converters.size());
      result.add(halConverter);
      result.addAll(converters);
      return result;
View Full Code Here

TOP

Related Classes of org.springframework.hateoas.mvc.TypeConstrainedMappingJackson2HttpMessageConverter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.