我们正在使用JSF 2.0 / Richfaces 4.2.2创建一个应用程序。该页面在IE9中加载速度很快(3-4秒),但在Chrome中速度非常慢。
看看网络问题似乎是大多数JSF& Richfaces资源,浏览器得到304响应,但它说话很长(我说的是分钟)才能最终得到这些资源。
我的web.xml:
<context-param>
<description>
Set the max time in miliseconds set on the "Expires" header for a resource rendered by the default ResourceHandler.
</description>
<param-name>org.apache.myfaces.RESOURCE_MAX_TIME_EXPIRES</param-name>
<param-value>2592000000</param-value><!-- 30 Days -->
</context-param>
<!-- RichFaces -->
<context-param>
<description>Defines in seconds how long streamed back to browser resources can be cached.</description>
<param-name>org.ajax4jsf.DEFAULT_EXPIRE</param-name>
<param-value>2592000</param-value><!-- 30 Days -->
</context-param>
<context-param>
<param-name>org.richfaces.resourceOptimization.enabled</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.LoadScriptStrategy</param-name>
<param-value>ALL</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.LoadStyleStrategy</param-name>
<param-value>ALL</param-value>
</context-param>
<context-param>
<!-- If org.richfaces.LoadScriptStrategy is set to ALL, this should be false -->
<param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
<param-value>false</param-value>
</context-param>
其中一个资源(Chrome)的示例请求/响应
Request URL:http://localhost/weblogicOMIA1003/APOMIA1003/faces/javax.faces.resource/calendar.js?ln=org.richfaces
Request Method:GET
Status Code:304 Not Modified
Request Headersview source
Accept:*/*
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
Cookie:JSESSIONID=RTJDSDYGFNnmDSVLySxVMJBJyhhm2GKSLtwPXmLtllqy9xh1MJjY!1711646894
Host:10.42.100.123
If-Modified-Since:Wed, 17 Oct 2012 18:13:54 GMT
Referer:http://10.42.100.123/weblogicOMIA1003/APOMIA1003/faces/analytics/trends/BasicTrends.xhtml?NODEID=545&STATEID=USGVDATIKOO1.e.p.hlzjqo1s462
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.76 Safari/537.36
Query String Parametersview sourceview URL encoded
ln:org.richfaces
Response Headersview source
X-Powered-By:Servlet/3.0 JSP/2.2
X-Powered-By:JSF/2.0
X-UA-Compatible:IE=edge