private static String loadReadme()

in src/main/java/org/apache/tomee/website/Examples.java [156:175]


    private static String loadReadme(final String auth, final WebTarget github, final GithubContentItem i) {
        try {
            final Invocation.Builder request = github.path("repos/apache/tomee/contents/examples/{name}/README.md")
                    .resolveTemplate("name", i.getName()).request(APPLICATION_JSON_TYPE);
            if (auth != null) {
                request.header("Authorization", auth);
            }
            return ofNullable(request
                    .get(GithubContentItem.class)
                    .getContent())
                    .map(c -> new String(decodeBase64(c), StandardCharsets.UTF_8))
                    .orElse(DEFAULT_README);
        } catch (final NotFoundException wae) {
            System.err.println(wae.getMessage() + " for the README.md of " + i.getName());
            return DEFAULT_README;
        } catch (final ForbiddenException wae) {
            System.err.println("Can't retrieve examples, set -Dgithub.auth=.... to get a higher rate limit");
            return DEFAULT_README;
        }
    }