Package javax.ws.rs.core

Examples of javax.ws.rs.core.Link$JaxbAdapter


      // If the size returned is equal then assume there is a next
      if (productEntities.size() == size)
      {
         int next = start + size;
         URI nextUri = builder.clone().build(next, size);
         Link nextLink = Link.fromUri(nextUri).rel("next").type("application/xml").build();
         links.add(nextLink);
      }
      // previous link
      if (start > 0)
      {
         int previous = start - size;
         if (previous < 0) previous = 0;
         URI previousUri = builder.clone().build(previous, size);
         Link previousLink = Link.fromUri(previousUri).rel("previous").type("application/xml").build();
         links.add(previousLink);
      }
      Products products = new Products();
      products.setProducts(list);
      products.setLinks(links);
View Full Code Here


      // If the size returned is equal then assume there is a next
      if (customerEntities.size() == size)
      {
         int next = start + size;
         URI nextUri = builder.clone().build(next, size);
         Link nextLink = Link.fromUri(nextUri).rel("next").type("application/xml").build();
         links.add(nextLink);
      }
      // previous link
      if (start > 0)
      {
         int previous = start - size;
         if (previous < 0) previous = 0;
         URI previousUri = builder.clone().build(previous, size);
         Link previousLink = Link.fromUri(previousUri).rel("previous").type("application/xml").build();
         links.add(previousLink);
      }
      Customers customers = new Customers();
      customers.setCustomers(list);
      customers.setLinks(links);
View Full Code Here

     * @param relation link relation.
     * @return the link builder for the relation, otherwise {@code null} if not
     *         present.
     */
    public Link.Builder getLinkBuilder(String relation) {
        Link link = getLink(relation);
        if (link == null) {
            return null;
        }

        return Link.fromLink(link);
View Full Code Here

     * @param relation link relation.
     * @return the link builder for the relation, otherwise {@code null} if not
     *         present.
     */
    public Link.Builder getLinkBuilder(String relation) {
        Link link = getLink(relation);
        if (link == null) {
            return null;
        }

        return Link.fromLink(link);
View Full Code Here

       
        meta.add(HttpHeaders.LINK, "<http://next>;rel=next");
        meta.add(HttpHeaders.LINK, "<http://prev>;rel=prev");
       
        assertTrue(ri.hasLink("next"));
        Link next = ri.getLink("next");
        assertNotNull(next);
        assertTrue(ri.hasLink("prev"));
        Link prev = ri.getLink("prev");
        assertNotNull(prev);
       
        Set<Link> links = ri.getLinks();
        assertTrue(links.contains(next));
        assertTrue(links.contains(prev));
       
        assertEquals("http://next", next.getUri().toString());
        assertEquals("next", next.getRel());
        assertEquals("http://prev", prev.getUri().toString());
        assertEquals("prev", prev.getRel());
    }
View Full Code Here

        if (linkValues == null) {
            return Collections.emptyMap();
        } else {
            Map<String, Link> links = new HashMap<String, Link>();
            for (Object o : linkValues) {
                Link link = Link.valueOf(o.toString());
                links.put(link.getRel(), link);
            }
            return links;
        }
    }
View Full Code Here

   
    public boolean hasLink(String relation) {
        List<Object> linkValues = metadata.get(HttpHeaders.LINK);
        if (linkValues != null) {
            for (Object o : linkValues) {
                Link link = o instanceof Link ? (Link)o : Link.valueOf(o.toString());
                if (relation.equals(link.getRel())) {
                    return true;
                }
            }
        }
        return false;
View Full Code Here

        }
        return null;
    }

    public Link.Builder getLinkBuilder(String relation) {
        Link link = getLink(relation);
        return link == null ? null : Link.fromLink(link);
    }
View Full Code Here

        if (linkValues == null) {
            return Collections.emptyMap();
        } else {
            Map<String, Link> links = new LinkedHashMap<String, Link>();
            for (Object o : linkValues) {
                Link link = o instanceof Link ? (Link)o : Link.valueOf(o.toString());
                if (!link.getUri().isAbsolute()) {
                    URI requestURI = URI.create((String)outMessage.get(Message.REQUEST_URI));
                    link = Link.fromLink(link).baseUri(requestURI).build();
                }
                links.put(link.getRel(), link);
            }
            return links;
        }
    }
View Full Code Here

   
    public boolean hasLink(String relation) {
        List<Object> linkValues = metadata.get(HttpHeaders.LINK);
        if (linkValues != null) {
            for (Object o : linkValues) {
                Link link = o instanceof Link ? (Link)o : Link.valueOf(o.toString());
                if (relation.equals(link.getRel())) {
                    return true;
                }
            }
        }
        return false;
View Full Code Here

TOP

Related Classes of javax.ws.rs.core.Link$JaxbAdapter

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.