Esempio n. 1
0
  public Link getLocationLink() {
    if (location != null) return location;
    if (!headers.containsKey("Location")) return null;
    String header = headers.getFirst("Location");

    location = new Link();
    location.setHref(header);
    location.setExecutor(executor);

    return location;
  }
Esempio n. 2
0
 @Override
 public Link getHeaderAsLink(String headerName) {
   String value = headers.getFirst(headerName);
   if (value == null) return null;
   String type = headers.getFirst(headerName + "-type");
   Link link = new Link();
   link.setHref(value);
   link.setType(type);
   link.setExecutor(executor);
   return link;
 }
Esempio n. 3
0
 public LinkHeader getLinkHeader() {
   if (linkHeader != null) return linkHeader;
   linkHeader = new LinkHeader();
   if (!headers.containsKey("Link")) {
     return linkHeader;
   }
   List<String> links = headers.get("Link");
   LinkHeaderDelegate delegate = new LinkHeaderDelegate();
   for (String link : links) {
     LinkHeader tmp = delegate.fromString(link);
     linkHeader.getLinks().addAll(tmp.getLinks());
     linkHeader.getLinksByRelationship().putAll(tmp.getLinksByRelationship());
     linkHeader.getLinksByTitle().putAll(tmp.getLinksByTitle());
   }
   for (Link link : linkHeader.getLinks()) {
     link.setExecutor(executor);
   }
   return linkHeader;
 }