2012-02-02 89 views
3

在我更新了2.4.0的GWT版本和1.6.2的GAE版本之后,com.google.gwt.user.client.ui.FormPanel不再提交jSessionId。当我尝试在servlet-doPost方法中获得HttpSession(request.getSession(false)时,我发现了这个错误,该方法现在返回null。 在我的appspot.com上部署的版本中,该应用程序仍在运行。所以我分析了铬开发工具的请求后,并检测到jSessionId不被FormPanel提交:GWT FormPanel在GWT版本2.4.0更新后未提交会话ID

发展模式:

Request  URL:http://halligalli:8888/_ah/upload/ahJtcDNzdHJlYW1pbmdwbGF5ZXJyGwsSFV9fQmxvYlVwbG9hZFNlc3Npb25fXxhHDA 
Request Method:POST 
Status Code:302 Found 
Request Headersview source 
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3 
Accept-Encoding:gzip,deflate,sdch 
Accept-Language:de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4 
Cache-Control:max-age=0 
Connection:keep-alive 
Content-Length:7181438 
Content-Type:multipart/form-data; boundary=----WebKitFormBoundaryB1bDbQ8YLCAabTG5 
Host:halligalli:8888 
Origin:http://127.0.0.1:8888 
Referer:http://127.0.0.1:8888/Mp3Streaming.html?gwt.codesvr=127.0.0.1:9997 
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.75 Safari/535.7 
Request Payload 
------WebKitFormBoundaryB1bDbQ8YLCAabTG5 
Content-Disposition: form-data; name="newBlob"; filename="09Anything new.mp3" 
Content-Type: audio/mp3 

部署的版本:

Request URL:http://***.appspot.com/_ah/upload/AMmfu6ZrLfT_jYLHJKBXRoWX9_DeeYoa3Ob-vY0bbOcAJ3bj9ihT7Wp5yPmM3yjhn2RBpJAE8Pr7fIA8O-rhY8k0ARTy7hyU3GU3Qw4WrTHvXcSJ9mXZndA/ALBNUaYAAAAATyp8A-H7HSFTkl5ekVfXgXOmd3gK2PQ3/ 
Request Method:POST 
Status Code:302 Found 
Request Headersview source 
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3 
Accept-Encoding:gzip,deflate,sdch 
Accept-Language:de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4 
Cache-Control:max-age=0 
Connection:keep-alive 
Content-Length:7181438 
Content-Type:multipart/form-data; boundary=----WebKitFormBoundaryXy11Yxjeo1JfdJdq 
Cookie:JSESSIONID=KOiv4hx1rqIJ1aZdP8CufQ ◄◄◄◄◄◄◄◄◄◄◄◄◄◄◄◄◄◄◄◄HERE IS THE DIFFERENCE 
Host:***.appspot.com 
Origin:http://***.appspot.com 
Referer:http://***.appspot.com/ 
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.75 Safari/535.7 
Request Payload 
------WebKitFormBoundaryXy11Yxjeo1JfdJdq 
Content-Disposition: form-data; name="newBlob"; filename="09Anything new.mp3" 
Content-Type: audio/mp3 

我我正在使用FormPanel来上传将存储在GAE Blobstore中的文件,并且我需要会话对象来获取上传文件的所有者(在开发模式中,其他每个RPC都包含jSessionId)。 有什么建议吗?

感谢您的期待!

+0

下面的答案对您有帮助吗?如果可以,请接受。 – 2016-06-14 21:39:38

回答

3

从你失败的请求:

Request  URL:http://halligalli:8888/_ah/upload/ahJtcDNzdHJlYW1pbmdwbGF5ZXJyGwsSFV9fQmxvYlVwbG9hZFNlc3Npb25fXxhHDA 
[…] 
Host:halligalli:8888 
Origin:http://127.0.0.1:8888 
Referer:http://127.0.0.1:8888/Mp3Streaming.html?gwt.codesvr=127.0.0.1:9997 

你不是将请求发送到同一起源:你的浏览器不发送到halligalli已设置为127.0.0.1一个cookie 。

据我所知,这是开发环境中BlobstoreService的限制。请参阅GWT Blobstore error calling createUploadUrl()