1

我们有一个 JSF 应用程序。有一个 ajax 调用会命中 JSP 页面。当应用程序由 Jetty 托管时,我们没有任何问题。当应用程序由 Glassfish 托管时,我们在使用 Chrome 或 Firefox 时会遇到问题(IE 工作正常)。

问题是这样的。JSP 页面似乎在单独的会话中发布,因此缺少会话数据。我可以演示如下:在服务器端,当他们点击 JSF 页面时记录会话 ID,当他们执行由 JSP 页面处理的操作时记录会话 ID。在带有 IE 的 Jetty 和 Glassfish 上,两个会话 id 匹配。在具有 Chrome 或 Firefox 会话 ID 的 Glassfish 上不匹配。

如果我查看 chrome 的 Web 开发人员视图,这两个请求都具有相同且正确的会话 ID,这已经足够有趣了。我在下面附上了这些。

有谁知道问题可能是什么?作为后台,此页面使用 JumpLoader 小程序,后端的 jsp 页面处理文件上传。

Chrome 记录的 HTTP 通信。初次访问页面。

Request URL:http://localhost:8080/site/page.jsf
Request Method:POST
Status Code:200 OK

Request Headers
Accept:application/xml, text/xml, */*; q=0.01
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Content-Length:248
Content-Type:application/x-www-form-urlencoded; charset=UTF-8
Cookie:JSESSIONID=fd9672a56d316006bcba33bbc0e0
Faces-Request:partial/ajax
Host:localhost:8080
Origin:http://localhost:8080
Referer:http://localhost:8080/site/page.jsf
User-Agent:Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.94 Safari/537.36
X-Requested-With:XMLHttpRequest

Form Data
javax.faces.partial.ajax:true
javax.faces.source:keepAlive:resetKeepAlive
javax.faces.partial.execute:@all
keepAlive:resetKeepAlive:keepAlive:resetKeepAlive
keepAlive:keepAlive
javax.faces.ViewState:6933564973876914096:3857165940441139007

Response Headers
Cache-Control:no-cache
Content-Length:500
Content-Type:text/xml;charset=UTF-8
Date:Tue, 04 Jun 2013 15:42:26 GMT
Server:GlassFish Server Open Source Edition 3.1.2.2
X-Powered-By:Servlet/3.0 JSP/2.2 (GlassFish Server Open Source Edition 3.1.2.2 Java/Oracle Corporation/1.7)
X-Powered-By:JSF/2.0

JCP 处理后。

Request URL:http://localhost:8080/site/page.jsf
Request Method:POST
Status Code:200 OK

Request Headers
Accept:application/xml, text/xml, */*; q=0.01
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Content-Length:418
Content-Type:application/x-www-form-urlencoded; charset=UTF-8
Cookie:JSESSIONID=fd9672a56d316006bcba33bbc0e0
Faces-Request:partial/ajax
Host:localhost:8080
Origin:http://localhost:8080
Referer:http://localhost:8080/site/page.jsf
User-Agent:Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.94 Safari/537.36
X-Requested-With:XMLHttpRequest

Form Data
javax.faces.partial.ajax:true
javax.faces.source:jumploaderMessages:updateJumploaderMessages
javax.faces.partial.execute:@all
jumploaderMessages:updateJumploaderMessages:jumploaderMessages:updateJumploaderMessages
fileName:My Pictures.zip
response:Error:Exception e = java.lang.NullPointerException
jumploaderMessages:jumploaderMessages
javax.faces.ViewState:6933564973876914096:3857165940441139007

Response Headers
Cache-Control:no-cache
Content-Length:1144
Content-Type:text/xml;charset=UTF-8
Date:Tue, 04 Jun 2013 15:43:14 GMT
Server:GlassFish Server Open Source Edition 3.1.2.2
X-Powered-By:Servlet/3.0 JSP/2.2 (GlassFish Server Open Source Edition 3.1.2.2 Java/Oracle Corporation/1.7)
X-Powered-By:JSF/2.0
4

0 回答 0