@Override
    protected ITemplateResource computeTemplateResource(final IEngineConfiguration configuration,
                                                        final String ownerTemplate,
                                                        final String template,
                                                        final String resourceName,
                                                        final String characterEncoding,
                                                        final Map<String, Object> templateResolutionAttributes) {
        val rest = casProperties.getView().getRest();
        val request = HttpRequestUtils.getHttpServletRequestFromRequestAttributes();
        val themeName = themeResolver.resolveThemeName(request);
        val headers = new LinkedHashMap<String, String>();
        headers.put("owner", ownerTemplate);
        headers.put("template", template);
        headers.put("resource", resourceName);

        if (StringUtils.isNotBlank(themeName)) {
            headers.put("theme", themeName);
        }
        val queryParams = UriComponentsBuilder
            .fromHttpUrl(HttpRequestUtils.getFullRequestUrl(request))
            .build()
            .getQueryParams();
        
        headers.put("locale", request.getLocale().getCountry());
        headers.putAll(HttpRequestUtils.getRequestHeaders(request));
        headers.putAll(rest.getHeaders());

        HttpResponse response = null;
        try {
            val exec = HttpExecutionRequest.builder()
                .basicAuthPassword(rest.getBasicAuthPassword())
                .basicAuthUsername(rest.getBasicAuthUsername())
                .method(HttpMethod.valueOf(rest.getMethod().toUpperCase(Locale.ENGLISH).trim()))
                .url(rest.getUrl())
                .headers(headers)
                .parameters(queryParams.toSingleValueMap())
                .build();
            response = HttpUtils.execute(exec);
            val statusCode = response.getCode();
            if (HttpStatus.valueOf(statusCode).is2xxSuccessful()) {
                val entity = ((HttpEntityContainer) response).getEntity();
                try (val content = entity.getContent()) {
                    val result = IOUtils.toString(content, StandardCharsets.UTF_8);
                    return new StringTemplateResource(result);
                }
            }
        } catch (final Exception e) {
            LoggingUtils.error(LOGGER, e);
        } finally {
            HttpUtils.close(response);
        }

        return super.computeTemplateResource(configuration, ownerTemplate, template, resourceName,
            characterEncoding, templateResolutionAttributes);
    }
This is {@link RestfulUrlTemplateResolver}.

@author Misagh Moayyed
@since 5.3.0
support/cas-server-support-thymeleaf-core/src/main/java/org/apereo/cas/web/view/RestfulUrlTemplateResolver.java