Package org.springframework.hateoas

Examples of org.springframework.hateoas.UriTemplate


   * @return
   */
  public Link appendPaginationParameterTemplates(Link link) {

    Assert.notNull(link, "Link must not be null!");
    return createLink(new UriTemplate(link.getHref()), null, link.getRel());
  }
View Full Code Here


    for (S element : page) {
      resources.add(assembler.toResource(element));
    }

    UriTemplate base = new UriTemplate(link == null ? getDefaultUriString() : link.getHref());

    PagedResources<R> pagedResources = new PagedResources<R>(resources, asPageMetadata(page));
    pagedResources.add(createLink(base, null, Link.REL_SELF));

    if (page.hasNext()) {
View Full Code Here

    UriComponents components = builder.build();
    TemplateVariables variables = new TemplateVariables(base.getVariables());
    variables = variables.concat(pageableResolver.getPaginationTemplateVariables(getMethodParameter(), components));

    return new Link(new UriTemplate(components.toString()).with(variables), rel);
  }
View Full Code Here

        link = assembler.appendPaginationParameterTemplates(link);
      } else if (mapping.isSortableResource()) {

        TemplateVariables sortVariable = sortResolver.getSortTemplateVariables(null, UriComponentsBuilder
            .fromUriString(link.expand().getHref()).build());
        link = new Link(new UriTemplate(link.getHref()).with(sortVariable), link.getRel());
      }

      links.add(link);
    }
View Full Code Here

    if (projectionConfiguration.hasProjectionFor(type)) {
      variables = variables.concat(new TemplateVariable(projectionConfiguration.getParameterName(), REQUEST_PARAM));
    }

    return variables.asList().isEmpty() ? linkFor(type).withRel(metadata.getRel()) : new Link(new UriTemplate(href,
        variables), metadata.getRel());
  }
View Full Code Here

      return link;
    }

    String parameterName = projectionConfiguration.getParameterName();
    TemplateVariables templateVariables = new TemplateVariables(new TemplateVariable(parameterName, REQUEST_PARAM));
    UriTemplate template = new UriTemplate(link.getHref(), templateVariables);

    return new Link(template.toString(), metadata.getItemResourceRel());
  }
View Full Code Here

     * @see com.fasterxml.jackson.databind.JsonDeserializer#deserialize(com.fasterxml.jackson.core.JsonParser, com.fasterxml.jackson.databind.DeserializationContext)
     */
    @Override
    public Object deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {

      URI uri = new UriTemplate(jp.getValueAsString()).expand();
      TypeDescriptor typeDescriptor = TypeDescriptor.valueOf(property.getActualType());

      return converter.convert(uri, URI_DESCRIPTOR, typeDescriptor);
    }
View Full Code Here

   * @param source must not be {@literal null}.
   */
  private void addLocationHeader(HttpHeaders headers, PersistentEntityResourceAssembler assembler, Object source) {

    String selfLink = assembler.getSelfLinkFor(source).getHref();
    headers.setLocation(new UriTemplate(selfLink).expand());
  }
View Full Code Here

    new DefaultCurieProvider("acme", null);
  }

  @Test(expected = IllegalArgumentException.class)
  public void preventsUriTemplateWithoutVariable() {
    new DefaultCurieProvider("acme", new UriTemplate("http://localhost:8080/rels"));
  }
View Full Code Here

    new DefaultCurieProvider("acme", new UriTemplate("http://localhost:8080/rels"));
  }

  @Test(expected = IllegalArgumentException.class)
  public void preventsUriTemplateWithMoreThanOneVariable() {
    new DefaultCurieProvider("acme", new UriTemplate("http://localhost:8080/rels/{rel}/{another}"));
  }
View Full Code Here

TOP

Related Classes of org.springframework.hateoas.UriTemplate

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.