@Override
    public void process(Request request, TreeNode<Resource> resultNode, String href) {
      if (! href.contains("/hosts/")) {
        Resource r = resultNode.getObject();
        Schema schema = ClusterControllerHelper.getClusterController().getSchema(r.getType());
        Object host = r.getPropertyValue(schema.getKeyPropertyId(Resource.Type.Host));
        Object hostComponent = r.getPropertyValue(schema.getKeyPropertyId(r.getType()));

        int idx = href.indexOf("clusters/") + "clusters/".length();
        idx = href.indexOf("/", idx) + 1;

        href = href.substring(0, idx) +
            "hosts/" + host + "/host_components/" + hostComponent;

        resultNode.setProperty("href", href);
      } else {
        super.process(request, resultNode, href);
      }
    }
Host_Component resource processor which is responsible for generating href's for host components.
This is called by the ResultPostProcessor during post processing of a result.
ambari-server/src/main/java/org/apache/ambari/server/api/resources/HostComponentResourceDefinition.java