我想调试我的本地开发服务器上的一些GAE代码,但已经打了一堵墙。该代码使用Google的Blobstore服务来促进文件上传。该代码在生产环境中工作得很好,但不在我的本地开发服务器上。Blobstore问题GAE云工具和本地开发服务器
我在我的jsp blobstoreService.createUploadUrl("/uploadSurvey")
中使用包含作为我的表单动作的标准Google模式,然后在我的servlet中调用blobstoreService.getUploads(request)
。
的文件正确上传(我可以使用本地管理控制台看到它),但是调用getUploads()
抛出异常:java.lang.IllegalStateException: Must be called from a blob upload callback request.
看在调试器的请求,要求blobkey
属性未找到,也没有任何其他输入参数的形式。查看原始请求(发送给/ _ah/upload/...的请求),表单参数存在。
我使用google云工具app-engine-plugin,它使用gcloud python开发服务器来运行生成的war。
我认识到blobstore是一个较老的GAE功能,但由于此代码在产品上“工作”,我宁愿不必切换到较新的子系统。
任何人都能够给我一个线索在哪里寻找得到这一切在我的开发服务器上工作?
感谢,
- 戴夫
附:下面是上传文件后转发到我的servlet请求已经被剥离出来:
POST /uploadSurvey HTTP/1.1
Accept-Encoding: identity
X-APPENGINE-BACKEND-ID: 8
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
X-APPENGINE-SERVER-NAME: localhost
Cookie: JSESSIONID=5773y31x3eut
X-Appengine-User-Email:
X-APPENGINE-DEFAULT-VERSION-HOSTNAME: localhost:8888
X-APPENGINE-SERVER-PROTOCOL: HTTP/1.1
X-Appengine-User-Organization:
X-APPENGINE-DEV-SCRIPT: unused
ORIGIN: http://localhost:8888
X-Appengine-User-Id:
Accept-Language: en-us
X-APPENGINE-SERVER-SOFTWARE: Development/2.0
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8
X-Appengine-User-Nickname:
Host: localhost:8888
X-Appengine-Dev-Request-Id: wCTAonUKrB
Content-Type: multipart/form-data; boundary="===============1477989950756010976=="
Content-Length: 1372
X-APPENGINE-REQUEST-LOG-ID: 5e8eaef5aff4add89b774badea1fd3a30da8be
X-Appengine-User-Is-Admin: 0
UPGRADE-INSECURE-REQUESTS: 1
X-APPENGINE-SERVER-PORT: 8888
Referer: http://localhost:8888/settings
X-AppEngine-Country: ZZ
X-APPENGINE-REQUEST-ID-HASH: BFD4FDDA
X-APPENGINE-REMOTE-ADDR: ::1
更新:
我加了一些调试http_proxy.py的gcloud devserver2目录下,并观察该内容类型为转发。我更糊涂了,因为它看起来像的内容存在...
--===============5516630363169856841==
Content-Type: message/external-body; blob-key="XOQvaKc1cdczcwkIHfRFOw=="; access-type="X-AppEngine-BlobKey"
Content-Disposition: form-data; name="myFile"; filename="Naro Group - SNHU - Sales Readiness Assessment - Dec 2016.xls"
Content-Type: application/vnd.ms-excel
Content-Length: 164352
Content-MD5: NjBiNjI0N2M3MjZiMzc3NWMxZDQxYmM5YTU2YmM5YmM=
content-disposition: form-data; name="myFile"; filename="Naro Group - SNHU - Sales Readiness Assessment - Dec 2016.xls"
X-AppEngine-Upload-Creation: 2017-02-16 20:17:05.729401
--===============5516630363169856841==
Content-Type: text/plain
Content-Disposition: form-data; name="newSurveyId"
10001
--===============5516630363169856841==
Content-Type: text/plain
Content-Disposition: form-data; name="newSurveyName"
N
--===============5516630363169856841==
Content-Type: text/plain
Content-Disposition: form-data; name="newUserMessage"
--===============5516630363169856841==
Content-Type: text/plain
Content-Disposition: form-data; name="selectedClient"
6
--===============5516630363169856841==
Content-Type: text/plain
Content-Disposition: form-data; name="selectedPsf"
3
--===============5516630363169856841==
Content-Type: text/plain
Content-Disposition: form-data; name="selectedSection"
1
--===============5516630363169856841==--