Examples of LinkDiscoverer


Examples of org.springframework.hateoas.LinkDiscoverer

    MockHttpServletResponse response = mvc.perform(get(href)).//
        andExpect(status().is2xxSuccessful()).//
        andReturn().getResponse();

    LinkDiscoverer discoverer = discoverers.getLinkDiscovererFor(MediaType.valueOf(response.getContentType()));
    return discoverer.findLinkWithRel(rel, response.getContentAsString());
  }
View Full Code Here

Examples of org.springframework.hateoas.LinkDiscoverer

  }

  private LinkDiscoverer getDiscoverer(MockHttpServletResponse response) {

    String contentType = response.getContentType();
    LinkDiscoverer linkDiscovererFor = discoverers.getLinkDiscovererFor(contentType);

    assertThat("Did not find a LinkDiscoverer for returned media type " + contentType + "!", linkDiscovererFor,
        is(notNullValue()));

    return linkDiscovererFor;
View Full Code Here

Examples of org.springframework.hateoas.LinkDiscoverer

     * @see org.springframework.hateoas.client.Rels.Rel#findInResponse(java.lang.String, org.springframework.http.MediaType)
     */
    @Override
    public Link findInResponse(String response, MediaType mediaType) {

      LinkDiscoverer discoverer = discoverers.getLinkDiscovererFor(mediaType);

      if (discoverer == null) {
        throw new IllegalStateException(String.format("Did not find LinkDiscoverer supporting media type %s!",
            mediaType));
      }

      return discoverer.findLinkWithRel(rel, response);
    }
View Full Code Here

Examples of org.springframework.hateoas.LinkDiscoverer

    this.context = new AnnotationConfigWebApplicationContext();
    this.context.register(HypermediaAutoConfiguration.class);
    this.context.refresh();
    LinkDiscoverers discoverers = this.context.getBean(LinkDiscoverers.class);
    assertNotNull(discoverers);
    LinkDiscoverer discoverer = discoverers.getLinkDiscovererFor(MediaTypes.HAL_JSON);
    assertTrue(HalLinkDiscoverer.class.isInstance(discoverer));
  }
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.