我正在使用WebSphere Portal8.0开发portlet,并且正在测试基于具有完整配置文件的Portal8.0默认主题的新自定义主题。我创建了四个门户网站页面,每个页面都显示一个portlet。浏览器顶部的水平导航菜单是主题提供的自动生成的导航菜单。当我从一个门户页面切换到另一个门户页面时,有相当多的延迟时间,大约5秒后我在Firebug中看到任何响应,然后整个页面空白最多两秒钟,然后最终加载新页面。我只期望浏览器的主体部分显示当前页面的内容,而不是整个页面,包括标题横幅和导航菜单。可能是什么导致了这个?
是否存在导致此问题的特定主题资源或配置文件?它可能是门户网站本身的一个设置,与主题分开吗?我在测试时打开了Firebug控制台,并注意到每次重新加载相同的dojo1.7模块。为什么没有缓存dojo1.7模块?我从Portal管理控制台验证了每个门户页面允许缓存24小时,我还验证了每个portlet本身也启用了24小时缓存。我还验证了Firefox浏览器启用了250MB缓存。
我创建了基于Portal8.0的自定义主题并将其打包到单个WAR文件中。在我的自定义主题中,我定制了theme_en.html,Default.jsp和commonActions.jsp文件。我已经开始尝试慢慢恢复我对每个文件所做的更改,希望我能够发现导致显着延迟的特定自定义,但到目前为止还没有看到它。
我是否在正确的轨道上?延迟可能是由于定制的主题文件?以下是自定义主题文件:
theme_en.html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
<!-- rel=dynamic-content indicates an element that is replaced with the contents produced by the specified href.
dyn-cs:* URIs are resolved using the WP DynamicContentSpotMappings resource environment provider. These values can
also be set using theme metadata if a theme is specified in the URI (e.g. @tl:oid:theme_unique_name). -->
<link rel="dynamic-content" href="co:head">
<link rel="dynamic-content" href="dyn-cs:id:FpmThemeURS8_head">
<!-- rendering is delegated to the specified href for each locale -->
</head>
<!-- <body class="lotusui30dojo tundra locale_en"> -->
<body class="jelam locale_en">
<div class="wpthemeFrame">
<header role="banner">
<!-- inserts the managed pages preview mode contributions
<div class="wpthemeHeader">
<a rel="dynamic-content" href="dyn-cs:id:80theme_preview"></a>
<div class="wpthemeInner">
<div class="wpthemeLogo wpthemeLeft">
<span class="wpthemeAltText">IBM WebSphere Portal</span>
</div>
</div>
</div>
-->
<!-- end header -->
<!-- inserts the universal toolbar -->
<a rel="dynamic-content" href="dyn-cs:id:80theme_toolbar"></a>
<div class="wpthemeBanner">
<div class="wpthemeBannerInner">
<div class="wpthemeInner" style="width:100%;">
<!-- <a rel="dynamic-content" href="dyn-cs:id:80theme_search"></a> -->
<a rel="dynamic-content" href="dyn-cs:id:FpmThemeURS8_commonActions"></a>
<!-- <a rel="dynamic-content" href="dyn-cs:id:80theme_commonActions"></a>
<a rel="dynamic-content" href="dyn-cs:id:80theme_mobileNav"></a>
<div class="wpthemeClear"></div>
-->
</div>
</div>
</div><!--end main banner-->
<div class="wpthemeBanner wpthemeBannerPrimaryNavigation">
<div class="wpthemeBannerInner">
<div class="wpthemeInner">
<a rel="dynamic-content" href="dyn-cs:id:FpmThemeURS8_primaryNav"></a>
<div class="wpthemeClear"></div>
</div>
</div>
</div><!--end primary nav banner-->
<div class="wpthemeSecondaryBanner">
<a rel="dynamic-content" href="dyn-cs:id:FpmThemeURS8_secondaryNav"></a>
<div class="wpthemeClear"></div>
</div><!--end secondary banner-->
</header>
<div class="wpthemeMainContent" role="main" >
<div class="wpthemeInner">
<!-- asa markup contributions for pages -->
<a rel="dynamic-content" href="dyn-cs:id:80theme_asa"></a>
<!-- <a rel="dynamic-content" href="dyn-cs:id:FpmThemeURS8_crumbTrail"></a> -->
<div class="wpthemeClear"></div>
<a rel="dynamic-content" href="dyn-cs:id:FpmThemeURS8_status"></a>
</div>
<!-- required - do not remove -->
<a rel="dynamic-content" href="state.portlet:portlet?include=windowState&include=portletMode&mime-type=text/html"></a>
<div id="layoutContainers" class="wpthemeLayoutContainers wpthemeLayoutContainersHidden" >
<div class="wpthemeInner">
<a rel="dynamic-content" href="dyn-cs:id:80theme_layout"></a>
<div class="wpthemeClear"></div>
</div>
</div>
</div><!--end main content-->
<footer class="wpthemeFooter" role="contentinfo">
<div class="wpthemeInner">
<a rel="dynamic-content" href="dyn-cs:id:FpmThemeURS8_footer"></a>
<div class="wpthemeClear"></div>
</div>
</footer><!-- page footer -->
</div><!-- end frame -->
<!-- This is responsible for bootstrapping the configuration for the javascript framework.
This is located here instead of the head section to improve client performance. -->
<div class="wpthemeComplementaryContent" id="wpthemeComplementaryContent" role="region" aria-labelledby="wpthemeComplementaryContentText">
<span class="wpthemeAltText" id="wpthemeComplementaryContentText" >Complementary Content</span>
<a rel="dynamic-content" href="co:config"></a>
</div>
</body>
</html>
&#13;
的Default.jsp:
<%@ page session="false" buffer="none" %>
<%@ page trimDirectiveWhitespaces="true" %>
<%-- Licensed Materials - Property of IBM, 5724-E76, (C) Copyright IBM Corp. 2001, 2004, 2006, 2010 - All Rights reserved. --%>
<%-- NOTE: By default, automatic reloading of theme and skin JSP files is turned off.
To see the changes you make to this file without stopping and restarting
the server, follow the instructions for enabling automatic JSP reloading
in the InfoCenter. Do not enable automatic JSP reloading in a production
environment because performance will decrease.
NOTE: Default.jsp uses the @include JSP directive to include jsp fragments
(denoted by the.jspf extension) which compiles these files into the servlet
for Default.jsp. If you change these files, you must "touch" the version
of Default.jsp which includes it to see your changes.
You can do this by editing Default.jsp and saving it. --%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ include file="./includePortalTaglibs.jspf" %>
<%@ taglib uri="/WEB-INF/tld/portal-internal.tld" prefix="portal-internal" %>
<%@ page import="java.util.*,javax.servlet.jsp.PageContext"%>
<%@ page import="com.ibm.portal.um.exceptions.PumaException"%>
<%@ page import="com.ibm.portal.um.PumaHome"%>
<%@ page import="com.ibm.portal.um.PumaController"%>
<%@ page import="com.ibm.portal.um.PumaLocator"%>
<%@ page import="com.ibm.portal.um.Group"%>
<%@ page import="com.ibm.websphere.cache.DistributedMap"%>
<%@ page import="javax.portlet.PortletSession" %>
<%-- BEGIN GCO --%>
<%
System.out.println("------------------------- COMPASS_THEME_URS: INSIDE Default.jsp 11:22");
String currentVP = "urs";
String vpPageTitle = "URS PORTAL"; // will be displayed just under banner at top of page to indicate to the user which virtual portal he is on
String sessionId = request.getSession().getId();
int PORTAL_TIMEOUT = request.getSession().getMaxInactiveInterval();
PORTAL_TIMEOUT = PORTAL_TIMEOUT / 60;
String firstName = null;
String lastName = null;
String userName = null;
String dotNumber = null;
String uri = request.getRequestURI();
// get the host - WebSphere_Portal or WebSphere_Portal_2
ServletContext sc = this.getServletContext();
String portalServer = (String)sc.getAttribute("com.ibm.websphere.servlet.application.host");
String portalIndicator = " "; // if node1 use one space
if(portalServer != null) {
if(portalServer.indexOf("2") != -1) {
portalIndicator = " "; // if node2 use two spaces
}
}
try {
javax.naming.Context jndiContext = new javax.naming.InitialContext();
DistributedMap dMap = (DistributedMap)jndiContext.lookup("services/cache/distributedmap");
request.getSession().setAttribute("dMap",dMap);
PumaHome ph = (PumaHome)jndiContext.lookup(PumaHome.JNDI_NAME);
firstName = (String)dMap.get(sessionId+"firstName");
lastName = (String)dMap.get(sessionId+"lastName");
userName = (String)dMap.get(sessionId+"userName");
PumaController pc = ph.getController();
dMap.put(sessionId+"themeName", "FpmThemeURS8");
dMap.putAll(request.getParameterMap());
if (firstName == null || lastName == null || userName == null) {
List getThese = new ArrayList();
getThese.add("uid");
getThese.add("givenName");
getThese.add("sn");
Object userObj = pc.getCurrentUser();
if(userObj != null) {
Map userInfo = pc.getAttributes(pc.getCurrentUser(), getThese);
Object val = userInfo.get("givenName");
firstName = (String)(val instanceof List ? ((List)val).get(0) : val);
val = userInfo.get("sn");
lastName = (String)(val instanceof List ? ((List)val).get(0) : val);
val = userInfo.get("uid");
userName = (String)(val instanceof List ? ((List)val).get(0) : val);
request.getSession().setAttribute("userFullName",firstName+" "+lastName);
dMap.put(sessionId+"userFullName", firstName+" "+lastName);
pageContext.setAttribute("userFullName",firstName+" "+lastName,PageContext.APPLICATION_SCOPE );
System.out.println("FpmThemeURS8: sessionId="+sessionId+" setting userFullName='"+firstName+" "+lastName+"'");
dMap.put(sessionId+"userName", userName);
PumaLocator pl = (PumaLocator)ph.getLocator();
List groups = pl.findGroupsByPrincipal(pc.getCurrentUser(), false);
List getCn = new ArrayList();
getCn.add("cn");
Map groupAttrs = null;
// only get the dotNumber from the POST, which prevents user from spoofing it in URL
if(request.getMethod().toLowerCase().equals("post")) {
dotNumber = request.getParameter("dotNumber"+sessionId.split("-")[0]);
}
if (dotNumber == null) {
dotNumber = (String)dMap.get(sessionId+"dotNumber");
} else {
dMap.put(sessionId+"dotNumber", dotNumber);
}
System.out.println("FpmThemeURS8 Default.jsp dotNumber="+dotNumber);
System.out.println("FpmThemeURS8 Default.jsp request.getMethod()="+request.getMethod());
ArrayList<String> parameterNames = new ArrayList<String>();
Enumeration enumeration = request.getParameterNames();
while (enumeration.hasMoreElements()) {
String parameterName = (String) enumeration.nextElement();
System.out.println("FpmThemeURS8 Default.jsp parameterName="+parameterName);
parameterNames.add(parameterName);
}
dMap.put(sessionId+"currentVP", currentVP);
}
}
} catch (javax.naming.NamingException e) {
System.out.println("FpmThemeURS8: got naming exception");
e.printStackTrace();
} catch (PumaException pe) {
System.out.println("FpmThemeURS8: got puma exception");
pe.printStackTrace();
} catch (Exception ex) {
System.out.println("FpmThemeURS8: got exception msg: "+ex.getMessage());
System.out.println("FpmThemeURS8: got exception class: "+ex.getClass());
System.out.println("FpmThemeURS8: got exception localMsg: "+ex.getLocalizedMessage());
System.out.println("FpmThemeURS8: got exception cause: "+ex.getCause());
ex.printStackTrace();
}
%>
<script src="/CompassThemesURS/themes/html/commonurs/js/dwrutil.js"></script>
<script type="text/javascript">
var displayedPortlets = new Array();
var loadingCount = 0; // incremented/decremented by various portlets to keep user from attempting to load one record while another one is still loading.
if( typeof(console) == "undefined"){
console = new Object();
console.debug = function(str){ var ignoreme; /* do nothing with these debug calls unless in Firefox */ };
console.log = function(str){ var ignoreme; /* do nothing with these debug calls unless in Firefox */ };
console.warn = function(str){ var ignoreme; /* do nothing with these debug calls unless in Firefox */ };
console.info = function(str){ var ignoreme; /* do nothing with these debug calls unless in Firefox */ };
console.error = function(str){ var ignoreme; /* do nothing with these debug calls unless in Firefox */ };
console.dir = function(str){ var ignoreme; /* do nothing with these debug calls unless in Firefox */ };
}
</script>
<%-- <link rel="stylesheet" type="text/css" href="/CompassThemesURS/themes/html/commonurs/dojo/gridx-1.3.0/resources/claro/Gridx.css" /> --%>
<link rel="stylesheet" type="text/css" href="/CompassThemesURS/themes/html/commonurs/dojo/1.9.1/dojox/grid/resources/Grid.css" />
<link rel="stylesheet" type="text/css" href="/CompassThemesURS/themes/html/commonurs/dojo/1.9.1/dojox/grid/resources/claroGrid.css" />
<!-- load Dojo -->
<script>
var dojoConfig = {
packages: [
{ name:'com', location:'/wps/themeModules/js/com' },
{ name:'ibm', location:'/wps/themeModules/js/ibm' },
{ name: "sizzle-master", location: "/CompassThemesURS/themes/html/commonurs/sizzle-master" },
{ name: "commonjs", location: "/CompassThemesURS/themes/html/commonurs/js" }
]
};
</script>
<!-- switched async:true to async:false to allow legacy dojo.require function to work for WebSphere's portlet-client-model
<script src="/CompassThemesURS/themes/html/commonurs/dojo/1.9.1/dojo/dojo.js.uncompressed.js"
data-dojo-config="isDebug:true, parseOnLoad: false"></script>
-->
<script type="text/javascript" src="/CompassThemesURS/themes/html/commonurs/help/help.js"></script>
<script type="text/javascript" src="/CompassThemesURS/themes/html/commonurs/js/PortletPreference.js"></script>
<script type="text/javascript" src="/CompassThemesURS/themes/html/commonurs/js/compassportal.js"></script>
<script type="text/javascript" src="/CompassThemesURS/themes/html/commonurs/js/CompassRefCodes.js"></script>
<script src="/CompassThemesURS/themes/html/commonurs/js/util.js"></script>
<%-- include a static copy of the DWR engine.js and UserProfileHelperDWR.js to enable cacheing of them --%>
<script src="/CompassThemesURS/themes/html/commonurs/js/engine.js"></script>
<%@ include file="./Dojo191CompassErrorHandler.jspf" %>
<script type="text/javascript">
var globalCeh = null;
<%-- require(["commonjs/CompassErrorHandler","dojo/_base/lang"], function(ceh, lang) {
dwr.engine.setErrorHandler(ceh.compassErrorHandler);
lang.setObject("global_ceh", ceh);
globalCeh = ceh;
});
function topInitializeErrHandler(dom, parser, lang) {
dom.byId("errDialogDivWrapper").style.display = "block";
console.debug("Default.jsp dojo parsing errDialogDivWrapper");
parser.parse(dom.byId("errDialogDivWrapper"));
}
--%>
</script>
<%-- END GCO --%>
<%--
--%><portal-core:constants/><portal-core:defineObjects/><portal-internal:adminNavHelper/><%@
include file="./bootstrap.jspf" %><%--
--%><%-- The theme template is determined by whether there is a value set in page meta data,
if no value is set in the meta data, then it defaults to the template stored in webdav --%><%--
--%><c:choose><%--
--%><c:when test="${!empty themeTemplateURI}"><%--
--%><r:dataSource uri='<%="spa:" + pageContext.getAttribute("currentNavNodeID", PageContext.REQUEST_SCOPE)%>' escape="none"><%--
--%><r:param name="themeURI" value="${themeTemplateURI}"/><%--
--%><r:param name="mime-type" value="text/html"/><%--
--%><r:param name="max-age" value="2"/><%--
--%></r:dataSource><%--
--%></c:when><%-- If no theme template is found, the fallback.jsp is rendered
--%><c:otherwise><%@ include file="./fallback.jsp" %></c:otherwise><%--
--%></c:choose>
&#13;
commonActions.jsp:
<%@ page session="false" buffer="none" %>
<%@ page trimDirectiveWhitespaces="true" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/portal-internal.tld" prefix="portal-internal" %>
<%@ include file="../includePortalTaglibs.jspf" %>
<%@ include file="../helper.jspf" %>
<portal-core:constants/><portal-core:defineObjects/>
<link href="/CompassThemesURS/themes/html/COMPASS_THEME_URS/NewFMCSASite_ReportSafetyViolations_completeFiles_files/css_ZMBdu8p5DxuWg4wW2gmFGAh7WzeTX659AOzXt0fJQmU.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
require(["commonjs/CompassErrorHandler","dojo/dom", "dojo/parser",
"dojo/_base/lang","dijit/ProgressBar", "dojo/domReady!"],
function(ceh, dom, parser, lang) {
dwr.engine.setErrorHandler(ceh.compassErrorHandler);
lang.setObject("global_ceh", ceh);
globalCeh = ceh;
topInitializeErrHandler(dom, parser, lang);
});
function topInitializeErrHandler(dom, parser, lang) {
dom.byId("errDialogDivWrapper").style.display = "block";
console.debug("Default.jsp dojo parsing errDialogDivWrapper");
parser.parse(dom.byId("errDialogDivWrapper"));
}
</script>
<%-- Renders links for Login/Logout and Help that are shown in the banner --%>
<%-- The following variables are defined in bootstrap.jspf for performance reasons and reused here:
* selectionPath
* deviceClass
* isMobile --%>
<table width="100%" cellspacing="0" cellpadding="0"
border="0"
style="background-color-obs:#FFFFFF;margin-bottom:0;">
<tr>
<td valign="top" width="100%" nowrap="nowrap">
<div id="mode-ribbon-wrapper">
<div class="mode-ribbon" style="max-width:100%;">
<a href="http://www.dot.gov"><img alt="d o t logo"
src="/CompassThemesURS/themes/html/COMPASS_THEME_URS/images/dot_ribbon_logo.png"><span class="dottext">United States Department of Transportation</span></a>
<ul class="mode-ribbon-links">
<li><a href="http://www.dot.gov/about">About DOT</a></li>
<li><a href="http://www.dot.gov/our-activities">Our Activities</a></li>
<li><a href="http://www.dot.gov/areas-of-focus">Areas of Focus</a></li>
</ul>
</div>
</div>
</td>
</tr>
<tr>
<td id="bannerId" valign="top" width="100%" height="90px" nowrap="nowrap"
style="background-image: url('/CompassThemesURS/themes/html/commonurs/images/FMCSA_URS_banner.png');background-repeat: no-repeat;border-bottom:1px solid black;">
</td>
</tr>
</table>
&#13;
注意:我很早就设置了跟踪字符串&#34; com.ibm.wps.resourceaggregator.CombinerDataSource.RemoteDebug = all&#34;通过Integrated Solutions Console按照文章:http://www-01.ibm.com/support/knowledgecenter/SSHRKX_8.0.0/dev/csa2t_trble_tracemod.dita导致门户加载未压缩的js和css文件,以帮助配置自定义主题,但为了加载更快的压缩版本,现在已删除跟踪字符串,我看到Firebug控制台中的错误直接与删除此跟踪字符串有关。最初的两个错误是:
GET https://localhost:10060/wps/myportal/urs/U/MaintainFees/!ut/p/a1/04_Sj9CPykssy0xPLMnMz0vMAfGjzOK9LFyMDJ1MDLzcTQzNDBw9TY0tfbzNDS1MDIEKIoEKDHAARwNC-sP1o_ArMYAqwGNFQW6EQaajoiIAxPeRKA!!/dl5/d5/L2dBISEvZ0FBIS9nQSEh/cldr/nls/number.js 301 Moved Permanently 10ms ra:coll...head_js (line 15)
GET https://localhost:10060/wps/mycontenthandler/urs/!ut/p/spa/Z6_J8D21B40JG4160AI539LK71841/html/cldr/nls/number.js 404 Not Found 6ms ra:coll...head_js (line 15)
这有什么意义吗?如何删除该跟踪字符串会导致这种情况?