@Override
    protected InputStream getResourceInputStream(final Resource resource, final String entityId) throws IOException {
        if (resource instanceof UrlResource && resource.getURL().toExternalForm().toLowerCase(Locale.ENGLISH).endsWith("/entities/")) {
            HttpResponse response = null;
            try {
                val encodedId = EncodingUtils.urlEncode(entityId);
                val url = resource.getURL().toExternalForm().concat(encodedId);
                LOGGER.debug("Locating metadata input stream for [{}] via [{}]", encodedId, url);
                val exec = HttpExecutionRequest.builder()
                    .method(HttpMethod.GET)
                    .url(url)
                    .headers(Map.of("Accept", "*/*"))
                    .build();
                response = HttpUtils.execute(exec);
                if (response != null && response.getCode() == HttpStatus.SC_OK) {
                    try (val content = ((HttpEntityContainer) response).getEntity().getContent()) {
                        val result = IOUtils.toString(content, StandardCharsets.UTF_8);
                        return new ByteArrayInputStream(result.getBytes(StandardCharsets.UTF_8));
                    }
                }
            } catch (final Exception e) {
                LoggingUtils.error(LOGGER, e);
            } finally {
                HttpUtils.close(response);
            }
        }
        return ClosedInputStream.CLOSED_INPUT_STREAM;
    }
Instantiates a new static metadata resolver adapter.

@param metadataResources the metadata resources
support/cas-server-support-saml-mdui-core/src/main/java/org/apereo/cas/support/saml/mdui/DynamicMetadataResolverAdapter.java