Example usage for org.springframework.boot.actuate.endpoint.web Link Link

List of usage examples for org.springframework.boot.actuate.endpoint.web Link Link

Introduction

In this page you can find the example usage for org.springframework.boot.actuate.endpoint.web Link Link.

Prototype

public Link(String href) 

Source Link

Document

Creates a new Link with the given href .

Usage

From source file:org.springframework.boot.actuate.endpoint.web.EndpointLinksResolver.java

/**
 * Resolves links to the known endpoints based on a request with the given
 * {@code requestUrl}./*w  w w  .ja  va2 s.com*/
 * @param requestUrl the url of the request for the endpoint links
 * @return the links
 */
public Map<String, Link> resolveLinks(String requestUrl) {
    String normalizedUrl = normalizeRequestUrl(requestUrl);
    Map<String, Link> links = new LinkedHashMap<>();
    links.put("self", new Link(normalizedUrl));
    for (ExposableEndpoint<?> endpoint : this.endpoints) {
        if (endpoint instanceof ExposableWebEndpoint) {
            collectLinks(links, (ExposableWebEndpoint) endpoint, normalizedUrl);
        } else if (endpoint instanceof PathMappedEndpoint) {
            links.put(endpoint.getId(),
                    createLink(normalizedUrl, ((PathMappedEndpoint) endpoint).getRootPath()));
        }
    }
    return links;
}

From source file:org.springframework.boot.actuate.endpoint.web.EndpointLinksResolver.java

private Link createLink(String requestUrl, String path) {
    return new Link(requestUrl + (path.startsWith("/") ? path : "/" + path));
}