的Java BLOBSTORE和谷歌SPI AppEngine上端点
问题描述:
我使用本地主机:8080/_ah/API /探险谷歌探索: 我不断收到的Java BLOBSTORE和谷歌SPI AppEngine上端点
{
"error": {
"message": "com.google.appengine.repackaged.org.codehaus.jackson.map.JsonMappingException: Can not construct instance of javax.servlet.http.HttpServletResponse, problem: abstract types can only be instantiated with additional type information\n at [Source: N/A; line: -1, column: -1]",
"code": 400,
"errors": [
{
"domain": "global",
"reason": "badRequest",
"message": "com.google.appengine.repackaged.org.codehaus.jackson.map.JsonMappingException: Can not construct instance of javax.servlet.http.HttpServletResponse, problem: abstract types can only be instantiated with additional type information\n at [Source: N/A; line: -1, column: -1]"
}
]
}
我的谷歌SPI代码是:
@ApiMethod(name = "findBillImage", httpMethod = ApiMethod.HttpMethod.GET)
public void findImage(HttpServletResponse httpServletResponse , @Named("blobkey") String blobKeyValue) throws IOException {
BlobKey blobKey = new BlobKey(blobKeyValue);
BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService();
blobstoreService.serve(blobKey, httpServletResponse);
}
随时随地我试图写任何东西到HttpServletResponse我得到这个错误..我失去了为什么我不能写入httpServletResponse
答
Soooo .. 一个对我而言,swer真的是'设计'。
因为我是谷歌应用程序引擎实现“休息”...我不应该修改HttpResponse返回一个“图像”。
因此,将图像“提供”回HttpResponse并不理想。 我应该与存储URL直接暴露形象客户:
https://storage.cloud.google.com/myapp.appspot.com/20160603_154924.jpg
不能说我“100%”这样的答案,但是从我读什么,我相信这是正确的。