@Override
    public View resolveViewName(
        @Nonnull
        final String viewName, @Nonnull
        final Locale locale) {
        try {
            val theme = Optional.of(RequestContextHolder.currentRequestAttributes())
                .filter(ServletRequestAttributes.class::isInstance)
                .map(ServletRequestAttributes.class::cast)
                .map(ServletRequestAttributes::getRequest)
                .map(themeResolver::resolveThemeName);
            val delegate = theme.map(this::getViewResolver);
            if (delegate.isPresent()) {
                return delegate.get().resolveViewName(viewName, locale);
            }
        } catch (final Exception e) {
            LOGGER.debug("error resolving view [{}] for theme", viewName, e);
        }
        return null;
    }
{@link ThemeBasedViewResolver} is a View Resolver that takes the active theme into account to selectively choose
which set of UI views will be used to generate the standard views.

@author Daniel Frett
@since 5.2.0
support/cas-server-support-thymeleaf-core/src/main/java/org/apereo/cas/services/web/ThemeBasedViewResolver.java