%@ include file="/portal/include/include_java.jsp" %>
<%@ page import="com.appiancorp.ap2.PageFilter"%>
<%@ page import="com.appiancorp.ap2.environment.EnvironmentUtils.Environment"%>
<%@ page import="com.appiancorp.security.util.StringSecurityUtils"%>
<%@ page import="com.appiancorp.ap2.common.RelativeInternalURI"%>
<%@ page import="com.appiancorp.asi.components.common.Decorators"%>
<%@ page import="com.appiancorp.asi.components.common.Decorators.Decorator"%>
<%@ page import="com.appiancorp.suite.SuiteConfiguration"%>
<%@ page import="com.appiancorp.suite.cfg.ConfigurationFactory"%>
<%@ page import="com.appiancorp.suite.cfg.FeatureToggleConfiguration"%>
<%/* The following end-user copyright statement MUST remain visible in browser source */%>
<%
response.setHeader("Cache-Control","no-cache, no-store");
response.setHeader("Pragma","no-cache");
response.setDateHeader ("Expires", -1);
%>
<%= Environment.DESIGNER.getId() %><%= Environment.APPS_PORTAL.getId() %>
<%-- #37680 & AN-41960 --%>
<%pageContext.setAttribute("showicons", ConfigurationFactory.getConfiguration(SuiteConfiguration.class).isShowFavicon());%>
" />
" sizes="48x48" />
" sizes="32x32" />
<%
if (request.getParameter("$p") != null) {
PageFilter.forceSetLastPage(request, "/portal.do", "$p="+request.getParameter("$p"));
}
String lastServletPath = PageFilter.getLastPath(request);
String lastQueryString = PageFilter.getLastQueryString(request);
Environment env = (Environment) request.getAttribute(Environment.ATTRIBUTE_KEY);
// In the designer environment, the "state" is stored in the session. When doing
// a full page refresh, we will go through this jsp that will check
// the last page visited. However, in the case of environments other than the designer
// (i.e. the apps portal environment) we currently keep track of the state just
// through the "fragment" part of the URL.
//
// When doing a full page refresh in these new environments, we just need to go
// through the "/portal/loadEnvironmentHome" and it will take care of taking the user
// to the last state. #37044
//
// If the lastServletPath is null or empty, it means that the user has a valid session
// but not an initial state. This can happen when a user has logged in in one browser
// window and opens a new one trying to go to a new environment. In this case, we
// must point again to "portal/loadEnvironment" as the starting point. #37916
if (env == Environment.APPS_PORTAL || lastServletPath == null || lastServletPath == "") {
lastServletPath = "/portal/loadEnvironmentHome.do";
lastQueryString = "";
}
// prevent any decorator, other than MAIN, to be applied to the last page #40688
StringBuffer path = new StringBuffer(lastServletPath);
int extensionIndex = -2; // something less than -1 to discriminate whether there was a match
int extensionLength = 0;
for (Decorator d : Decorator.values()) {
if (extensionIndex <= path.lastIndexOf(d.getExtension())) {
extensionIndex = path.lastIndexOf(d.getExtension());
if (extensionLength < d.getExtension().length()) {
extensionLength = d.getExtension().length();
}
}
}
if (extensionIndex >= 0) {
path.replace(extensionIndex, extensionIndex + extensionLength, Decorator.MAIN.getExtension());
lastServletPath = path.toString();
}
RelativeInternalURI lastResource = new RelativeInternalURI(request, response);
lastResource.setDecorator(Decorator.MAIN);
lastResource.setPath(lastServletPath);
lastResource.setQuery(lastQueryString);
lastResource.addContextPath(false);
// AN-59071
String url = lastResource.toString();
if ("/analytics/report/view/base.do?alias=all_processes&%24navContentId=processesNav&appian_environment=designer".equals(url) ||
"/portal/loadEnvironmentHome.do?appian_environment=designer".equals(url)) {
url = "/framework/error/pageretired.jsp";
}
// enable GWT development mode
SuiteConfiguration suiteConfig = ConfigurationFactory.getConfiguration(SuiteConfiguration.class);
if (suiteConfig.isGwtDevelopmentMode()) {
lastResource.addQueryParameter("gwt.codesvr", suiteConfig.getGwtCodeSvr());
}
// set URL to be used in frame
pageContext.setAttribute("url", url);
// set env. path JS regular expression
String envPath = request.getContextPath()+env.getPath();
pageContext.setAttribute("envPath", envPath);
%>