Package javax.ws.rs.core

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


   }

   @Override
   public Link.Builder getLinkBuilder(String relation)
   {
      Link link = getLinkHeaders().getLinkByRelationship(relation);
      if (link == null) return null;
      return Link.fromLink(link);
   }
View Full Code Here


   }

   @Override
   public Link.Builder link(String link)
   {
      Link l = LinkImpl.valueOf(link);
      return link(l);
   }
View Full Code Here

   {
      @GET
      @Produces("application/xml")
      public Customer getCustomer() {
         Customer cust = new Customer("bill");
         Link link = Link.fromUri("a/b/c").build();
         cust.getLinks().add(link);
         link = Link.fromUri("c/d").rel("delete").build();
         cust.getLinks().add(link);
         return cust;
      }
View Full Code Here

   public void testRelativized() throws Exception
   {
      URI uri = new URI("a").relativize(new URI("a/d/e"));
      System.out.println(uri);

      Link link = Link.fromUri("a/d/e")
                      .rel("update").type("text/plain")
                      .buildRelativized(new URI("a"));
      System.out.println(link.toString());

      link = Link.fromUri("a/d/e")
              .rel("update").type("text/plain")
              .baseUri("http://localhost/")
              .buildRelativized(new URI("http://localhost/a"));
      System.out.println(link.toString());

   }
View Full Code Here

   @Test
   public void testFromMethod()
   {
      for (Method m : Resource.class.getDeclaredMethods())
      {
         Link link = Link.fromMethod(Resource.class, m.getName()).build();
         String string = link.toString();
         System.out.println("initial: " + string);
         Link fromValueOf = Link.valueOf(string);
         Assert.assertEquals(string, fromValueOf.toString());
      }
   }
View Full Code Here

   @Test
   public void testIllegalUri()
   {
      Link.Builder builder = Link.fromUri("http://:@");
      try {
         Link link = builder.build();
         Assert.fail();
      } catch (UriBuilderException e) {
      }

   }
View Full Code Here

         int len = responseContext.getLength();
         setEntity(String.valueOf(len));
      }

      public void getLink() {
         Link link = responseContext.getLink(RELATION);
         setLinkForGetLink(link);
      }
View Full Code Here

      }

      public void getLinkBuilder() {
         Link.Builder builder = responseContext.getLinkBuilder(RELATION);
         if (builder != null) {
            Link link = builder.build();
            setLinkForGetLink(link);
         } else
            setEntity(NULL);
      }
View Full Code Here

      // 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

TOP

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

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.