<%@ page import="com.appiancorp.ap2.environment.EnvironmentUtils.Environment"%> <%@ page import="com.appiancorp.common.config.ApplicationContextHolder"%> <%@ page import="com.appiancorp.security.auth.rememberme.RememberMeSettings"%> <%@ page import="com.appiancorp.security.auth.SpringSecurityContextHelper"%> <%@ page import="com.appiancorp.suite.SuiteConfiguration"%> <%@ page import="com.appiancorp.suite.cfg.ConfigurationFactory"%> <%@ page import="com.appiancorp.suite.cfg.CustomBrandingService"%> <%@ page import="com.appiancorp.suite.cfg.CustomBrandingServiceImplHelper"%> <%@ page import="com.appiancorp.suiteapi.common.ServiceLocator"%> <%@ page import="com.appiancorp.type.cdt.CustomBranding"%> <%@ page import ="org.springframework.security.core.context.SecurityContext"%> <%@ page import="com.appiancorp.sites.backend.SiteService"%> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> <%@ taglib uri="/WEB-INF/appian-asi.tld" prefix="asi" %> <% final SecurityContext origSpringSecCtx = SpringSecurityContextHelper.getSpringSecurityContext(); CustomBranding b; try { SpringSecurityContextHelper.setSpringSecurityContextLazy(ServiceLocator.ADMIN_USERNAME); b = ApplicationContextHolder.getBean(CustomBrandingService.class).getCustomBranding(); request.setAttribute("logoUri", b.getLogoUri()); request.setAttribute("secondaryLogoUri", b.getSecondaryLogoUri()); request.setAttribute("faviconUri", b.getFaviconUri()); request.setAttribute("sitename", b.getSitename()); } catch (Exception e) { if (e instanceof RuntimeException) { throw (RuntimeException)e; } else { throw new RuntimeException(e); } } finally { SpringSecurityContextHelper.setSpringSecurityContext(origSpringSecCtx); } pageContext.setAttribute("showicons", ConfigurationFactory.getConfiguration(SuiteConfiguration.class).isShowFavicon()); final Object environmentAttribute = request.getAttribute("$env"); final String environment = environmentAttribute != null ? environmentAttribute.toString() : null; if (environment == Environment.SITES.getId()) { Object reqUri = request.getAttribute("javax.servlet.forward.request_uri"); if (reqUri != null) { String requestUri = request.getAttribute("javax.servlet.forward.request_uri").toString(); String[] splitUrl = requestUri.split("/sites/"); if (splitUrl.length > 1) { String urlStub = splitUrl[1].split("/")[0]; SiteService s = ApplicationContextHolder.getBean(SiteService.class); try { request.setAttribute("faviconUri", s.getFaviconHrefByUrlStub(urlStub)); } catch (Exception e) { try { request.setAttribute("faviconUri", s.getDefaultFaviconHref()); } catch (Exception e1) { // No-op. Fall back to admin-configured favicon when the default Sites favicon is unavailable. } } } } } %> " />