Class Links

java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<String,Link>
io.jenkins.blueocean.rest.hal.Links
All Implemented Interfaces:
Serializable, Cloneable, Map<String,Link>

public final class Links extends HashMap<String,Link>
Implementation of JSON Hypertext application language (HAL).
  • Only _links element is implemented
  • Only required href element is supported
  • TODO: decide on whether application/hal+json or just use application/json
Any Resource implementation can add their resource specific path by calling add(String, Link) Example:
 

   {
       "_links":{
          "self":{"href":"http://.../pipelines/1/runs/23"},
          "test":{"href":"http://.../pipelines/1/runs/23/test"}
       }
   }
 
 
Author:
Vivek Pandey
See Also:
  • Constructor Details

  • Method Details

    • add

      public Links add(String ref, Link link)
    • self

      public Link self()
    • add

      public Links add(String ref)
      Add a new link with key 'ref' and href being self.href+ref
       
           links.add("testResult");
      
           {
               "_links":[
                {
                    "self":{"href":"/organizations/jenkins/pipelines/p1/runs/2/"},
                    "testResult":{"href":"/organizations/jenkins/pipelines/p1/runs/2/testResult"},
                }
      
               ]
           }
       
       
      Parameters:
      ref - relative path to be added as new Link relative to 'self''s href
      Returns:
      this Links instance
    • ensureTrailingSlash

      public static String ensureTrailingSlash(String path)