Package org.springframework.hateoas

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


  }

  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

     * @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

    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

Related Classes of org.springframework.hateoas.LinkDiscoverer

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.