Examples of Jackson2HalModule


Examples of org.springframework.hateoas.hal.Jackson2HalModule

  public ObjectMapper objectMapper() {

    RelProvider relProvider = new EvoInflectorRelProvider();
    ObjectMapper mapper = new ObjectMapper();

    mapper.registerModule(new Jackson2HalModule());
    mapper.registerModule(persistentEntityModule());
    mapper.setHandlerInstantiator(new Jackson2HalModule.HalHandlerInstantiator(relProvider, null));
    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    mapper.setSerializationInclusion(Include.NON_EMPTY);
View Full Code Here

Examples of org.springframework.hateoas.hal.Jackson2HalModule

  @Before
  public void setUp() {

    this.mapper = new ObjectMapper();
    this.mapper.registerModule(new Jackson2HalModule());
    this.mapper.setHandlerInstantiator(new HalHandlerInstantiator(new EvoInflectorRelProvider(), null));
  }
View Full Code Here

Examples of org.springframework.hateoas.hal.Jackson2HalModule

   */
  @Test
  public void rendersHalContentCorrectly() throws Exception {

    ObjectMapper mapper = new ObjectMapper();
    mapper.registerModule(new Jackson2HalModule());
    mapper.setHandlerInstantiator(new Jackson2HalModule.HalHandlerInstantiator(new EvoInflectorRelProvider(), null));

    Customer customer = new Customer();
    customer.firstname = "Dave";
    customer.lastname = "Matthews";
View Full Code Here

Examples of org.springframework.hateoas.hal.Jackson2HalModule

    HalHandlerInstantiator instantiator = new HalHandlerInstantiator(getDefaultedRelProvider(), curieProvider);

    ObjectMapper mapper = basicObjectMapper();
    mapper.registerModule(persistentEntityJackson2Module());
    mapper.registerModule(new Jackson2HalModule());
    mapper.setHandlerInstantiator(instantiator);

    return mapper;
  }
View Full Code Here

Examples of org.springframework.hateoas.hal.Jackson2HalModule

  @Before
  public void setUp() throws Exception {

    jackson2Mapper = new com.fasterxml.jackson.databind.ObjectMapper();
    jackson2Mapper.registerModule(new Jackson2HalModule());
    jackson2Mapper.setHandlerInstantiator(new Jackson2HalModule.HalHandlerInstantiator(relProvider, null));
    jackson2Mapper.configure(SerializationFeature.INDENT_OUTPUT, true);

    JAXBContext context = JAXBContext.newInstance(VndErrors.class);
    marshaller = context.createMarshaller();
View Full Code Here

Examples of org.springframework.hateoas.hal.Jackson2HalModule

   * @return
   */
  private static final HttpMessageConverter<?> getHalConverter() {

    ObjectMapper mapper = new ObjectMapper();
    mapper.registerModule(new Jackson2HalModule());
    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

    MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();

    converter.setObjectMapper(mapper);
View Full Code Here

Examples of org.springframework.hateoas.hal.Jackson2HalModule

      CurieProvider curieProvider = getCurieProvider(beanFactory);
      RelProvider relProvider = beanFactory.getBean(DELEGATING_REL_PROVIDER_BEAN_NAME, RelProvider.class);
      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));
View Full Code Here

Examples of org.springframework.hateoas.hal.Jackson2HalModule

  public Server() {

    this.relProvider = new EvoInflectorRelProvider();

    this.mapper = new ObjectMapper();
    this.mapper.registerModule(new Jackson2HalModule());
    this.mapper.setHandlerInstantiator(new Jackson2HalModule.HalHandlerInstantiator(relProvider, null));

    initJadler(). //
        that().//
        respondsWithDefaultContentType(MediaTypes.HAL_JSON.toString()). //
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.